Re: Menu Item Factory
- From: Ralf Heeg <heeg lmr khm de>
- To: gtk-app-devel-list gnome org
- Subject: Re: Menu Item Factory
- Date: Wed, 26 Sep 2001 19:39:23 +0200
Subject: Menu Item Factory
From: Filip Hroch <hroch physics muni cz>
Ciao,
I have some problems with using of menus created by the Gtk Item Factory.
There is a small part of my developing code:
...
{ "/_Settings/_Binning", "<control>B", NULL, 0, "<Branch>" },
{ "/_Settings/_Binning/_3x3", "<control>3", set_bin, 3, "<RadioItem>" },
{ "/_Settings/_Binning/_2x2", "<control>2", set_bin, 2, "/Settings/Binning/3x3" },
{ "/_Settings/_Binning/_1x1", "<control>1", set_bin, 1, "/Settings/Binning/3x3" },
...
{ "/_Settings/", NULL, NULL, 0, "<Separator>"},
{ "/_Settings/Enable _Legend", "<control>L", set_legend, 0, "<ToggleItem>" },
{ "/_Settings/_Reuse Darks", "<control>R", set_darks, 0, "<ToggleItem>" },
...
The meaning of these items is not important. I don't know:
1) how initialize radio item group to (for example) 2x2 item. The toggled
item by this way is 3x3 but I can't initialize some arbitrary item.
2) how set on the "Enable Legend" toggle button during init phase. I was
tried the gtk_item_factory_get_widget/item function to get a toggle button
from a item factory but without any success.
3) why, the choosing of argument 1x1 make 3x calls of set_bin with arguments
3,2,1? The set_bin is a void function, is it correct?
Is it possible use the item factory by this way? I can rewrite code
to use no item factory, but I prefers use of its because the code
is significantly simpler.
Thank for any suggestions
FH
Also Filip encountered problems with the evergreen GtkItemFactory:
re 2 (maybe also applies to 1):
right after gtk_init:
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtk_item_factory_get_item(
<name of gtkItemFactory variable>, "<main>/_Settings/Enable
_Legend")),
TRUE);
re 1) the first radio widget is active by default, try above method for
any other one
re 3) of course, the callback func gets called for each widget of a
radio widget group,
may it be active or inactive, the argument values 1,2,3 are prooving
that. Your set_bin-func
can respond to all formerly active and inactive widgets. In set_bin do:
if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(1st param)))
{ ... your code } for new active ones, for new inactive ones
accordingly.
bye
ralf heeg
Lab for Mixed Realities
Cologne, Germany
heeg lmr khm de
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]