Re: [gtk-list] Re: itemfactory radiomenuitems?
- From: Marsel Osipov <virtuoso jps net>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] Re: itemfactory radiomenuitems?
- Date: Sun, 02 May 1999 12:25:30 -0700
Robert_Gasch/PeopleSoft@peoplesoft.com wrote:
> Thank you for pointing me at that ... I will check it out
> and see if I can figure out what I'm doing wrong ... since
> I'm don't seem to be the only one wrestling with this stuff,
> I'm attaching a code sample of what I'm doing ... maybe
> someone will notice some obvious mistakes (given
> enough eyeballs, all bugs are shallow :-) ) ...
>
> #define MENU_VIEW_BRANCH "/View"
> #define MENU_VIEW_2DPLANE "/View/2D Plane"
> #define MENU_VIEW_2DPLANE_AC "<control>1"
>
> #define MENU_VIEW_3DWIRE "/View/3D Wire"
> #define MENU_VIEW_3DWIRE_AC "<control>2"
>
> #define MENU_VIEW_3DHEIGHT "/View/3D Height"
> #define MENU_VIEW_3DHEIGHT_AC "<control>3"
>
> #define MENU_VIEW_3DLIGHT "/View/3D Light"
> #define MENU_VIEW_3DLIGHT_AC "<control>4"
>
> char *s;
> Glib_Hash *d_menuHash; // menu item pointers, path is key
>
> s = d_mNames[d_nameCount++] = strdup (MENU_VIEW_BRANCH);
> d_menuHash->insert (s, d_itemFactory->create_item (s, 0, "<Branch>", 0));
> s = d_mNames[d_nameCount++] = strdup (MENU_VIEW_2DPLANE);
> d_menuHash->insert (s, d_itemFactory->create_item
> (s, MENU_VIEW_2DPLANE_AC, "<RadioItem>",
> ItemFactoryConnector<TFWindow, string>(this,&viewMenuCallback, s)));
> s = d_mNames[d_nameCount++] = strdup (MENU_VIEW_3DWIRE);
> d_menuHash->insert (s, d_itemFactory->create_item
> (s, MENU_VIEW_3DWIRE_AC, MENU_VIEW_2DPLANE,
> ItemFactoryConnector<TFWindow, string>(this,&viewMenuCallback, s)));
> s = d_mNames[d_nameCount++] = strdup (MENU_VIEW_3DHEIGHT);
> d_menuHash->insert (s, d_itemFactory->create_item
> (s, MENU_VIEW_3DHEIGHT_AC, MENU_VIEW_2DPLANE,
> ItemFactoryConnector<TFWindow, string>(this,&viewMenuCallback, s)));
> s = d_mNames[d_nameCount++] = strdup (MENU_VIEW_3DLIGHT);
> d_menuHash->insert (s, d_itemFactory->create_item
> (s, MENU_VIEW_3DLIGHT_AC, MENU_VIEW_2DPLANE,
> ItemFactoryConnector<TFWindow, string>(this,&viewMenuCallback, s)));
>
> This works except the problem I alluded to before.
I think you are doing a double work here, just use
itemfactory->get_radiomenuitem_widget(path) instead, and that should work as the
above. Here is how I do it:
view_opt_ifac->create_item("/Shading", 0, "<LastBranch>", 0);
view_opt_ifac->create_item("/Shading/Flat", 0, "<RadioItem>",
ItemFactoryConnector<ViewPort, string>
(this,
&change_shade_mode_callback, "SHADE_FLAT"));
view_opt_ifac->create_item("/Shading/Smooth", 0, "<RadioItem>",
ItemFactoryConnector<ViewPort, string>
(this,
&change_shade_mode_callback, "SHADE_SMOOTH"));
Gtk_ObjectHandle<Gtk_RadioMenuItem> flat_item =
view_opt_ifac->get_radiomenuitem_widget("/Shading/Flat");
Gtk_ObjectHandle<Gtk_RadioMenuItem> smooth_item =
view_opt_ifac->get_radiomenuitem_widget("/Shading/Smooth");
smooth_item->set_group(flat_item->group());
flat_item->set_active(GTK_STATE_ACTIVE);
> If I can figure out what I'm
> doing
> wrong, I'll get back to this list ...
>
> --> R
>
>
>
> Funny this came up now, I am just starting to change over my manually
> created menus to the itemfactory this morning and I have a group of
> radio_menuitems in it. I have been playing with an example from Eric
> Harlow's book http://www.bcpl.net/~eharlow/book/ch5.tar.gz that I had to
> add the paths to for them to work properly but it seems to work all
> right for me. It's not gtk-- but it should be similar enough. Maybe a
> bug in gtk-- ?
I just downloaded that chapter and compiled the examples The itemfactory example
suffers from similar problems. So, I don't think that that is a bug in Gtk--, but
it is either a bug in gtk+ itself, or we are doing something wrong...
> HTH,
>
> --
> Stephen
>
Marsel
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]