Re: setting defaults with radio buttons in an item factory...



On Wednesday 11 April 2001 03:09, Cevat Ustun wrote:
I honestly searched all the documentation I could find but still the
following stumps me: I have the following in my code:


  gtk_check_menu_item_set_state(GTK_CHECK_MENU_ITEM(widget1),FALSE);
  gtk_check_menu_item_set_state(GTK_CHECK_MENU_ITEM(widget2),FALSE);
  gtk_check_menu_item_set_state(GTK_CHECK_MENU_ITEM(widget3),TRUE);


Now, the above _works_. The problem is if I substitute the booleans with
(integer valued ) flags, say,

flag_1,
flag_2 and
flag_3

only one of which is equal to 1 at any given time (the other two are equal
to zero).  So even if initially I set

flag_1=0,
flag_2=0,
flag_3=1,

not only does the _wrong_ button  get selected,  but I get

flag_1=1,
flag_2=0 ,
flag_3=0

right after!

What's going on?

Cevat.


I finally found a way to do it right: apparently if you try to manipulate 
_all_ of the radio buttons in a group it gets confused (for lack of a better 
word). The way to do it is to do:

if (flag_1)
 gtk_check_menu_item_set_state(GTK_CHECK_MENU_ITEM(widget1),TRUE);
else if (flag_2)           
gtk_check_menu_item_set_state(GTK_CHECK_MENU_ITEM(widget2),TRUE);
else if (flag_3)
 gtk_check_menu_item_set_state(GTK_CHECK_MENU_ITEM(widget3),TRUE);



_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list




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