I probably wasn't clear. I just want to initialize my GUI. Suppose that I have a list of buttons (something like radio buttons, although I implement it myself in a customized fashion). I have a list of widgets, if widget_list[n] == active_widget, then the button is down, else it's up. So I do something like this:
...
if(widget_list[n] == active_widget){
GTK_BUTTON(buttons[n])->button_down = TRUE;
GTK_TOGGLE_BUTTON(buttons[n])->active = TRUE;
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(buttons[n]), TRUE);
}else{
GTK_BUTTON(buttons[n])->button_down = FALSE;
GTK_TOGGLE_BUTTON(buttons[n])->active = FALSE;
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(buttons[n]), FALSE);
}
gtk_widget_queue_draw(buttons[n]);
n++;
...
And its simply doesn't work as intended. The button does not appear down until I force the expose event. With gtk-1 I would use gtk_widget_draw instead of queue draw, and it worked just fine. But now in gtk-2 there is no gtk_widget_draw. How do I force the widget to draw?
Thanks!
<ADRIAN>
Tristan Van Berkom wrote:
On Mon, 31 Jan 2005 12:42:33 -0800, Adrian E. Feiguin <afeiguin@xxxxxxx> wrote:
Hi all. This is an example, but there are many cases when I want to do something similar:
Suppose that I change the state of a toggle button with
gtk_toggle_button_set_active or gtk_widget_set_state. The widget just
wont draw properly until I move the mouse pointer over it forcing an
expose event. What's going on? in gtk-1 I would simply call
gtk_widget_draw, but now, event calling gtk_widget_queue_draw, the
widget won't update. Can anyone explain it to me, please?
Hmm, seems like you're hijacking the main loop somewhere, you
got a `while (42) { /* code body */ }' lying around in your code ?
If its absolutely nescisary to implement the main program loop yourself; you can call: `while (gtk_events_pending()) gtk_main_iteration_do (FALSE);' once every loop.
Just a guess, OTOH maybe there is something wrong with your X server installation (if your not recieving expose events or are unable to queue them).
Cheers, -Tristan
.
_______________________________________________ gtk-list@xxxxxxxxx http://mail.gnome.org/mailman/listinfo/gtk-list