Re: Newbie Gtk+ questions...




> I've just started working with the Gtk+ toolkit, and I've run across a
> couple questions...
> 
> 1) Is there a way to get an integer-valued Scale widget, or do I need
>    to build my own? I didn't see one, but maybe I'm missing something.
>    If it currently isn't possible, this would certainly be a nice
>    addition.

If you want a scale widget that actually moves in integer increments,
then you are out of luck, unless you write your own. Otherwise,
just use

  gtk_scale_set_digits (GTK_SCALE(my_scale), 0);

> 2) I've noticed that when I create a new dialog with gtk_dialog_new(),
>    it is not markked as transient. If I do a
>    gtk_window_new(GTK_DIALOG_WINDOW), the window is a transient, but
>    it doesn't do the nice dialog setup. Is there a way to make the
>    gtk_dialog_new() window transient, or do I have to create the
>    window, and then do the equivilant of the dialog setup myself?

 
> 3) I have an idle procedure which ends up taking about 500ms. This
>    makes interactive performance *really* bad :). From UTS,L!

<curious> what's that? </curious>

> it appears that splitting it up into 2 procedures will still call both
>  procedures between event checks, no matter what. 

Not " matter what". One thing you can do which will work is to
set up the second half as a one-shot idle handler at a higher
priority than the first half. (You'll need the CVS gtk for this,
which has gtk_idle_add_priority(), or it will appear in the next
release)

>    Can I call
>    gtk_main_iteration_do() in the middle of my idle function and have
>    it process events correctly, or am I basically taking my chances if
>    I do that?

Just calling gtk_main_iteration_do() is taking your chances. (The
non-block isn't currently working) But doing:

  while (gtk_events_pending())
     gtk_main_iteration();

will work safely. Though, if you do this, idle redraws may not
work correctly. [ I haven't tested it out, but it strikes me
that this may be the case. Maybe gtk_events_pending() should count
idle handlers above some priority as pending events? ]

> 4) What's the correct syntax for using the space bar as a menu
>    accelerator?

I think " " should work. (I, unfortunately, won't show up on the menu,
though)

Hope this helps,
                                        Owen



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]