Re: [gtk-list] Re: itemfactory radiomenuitems?





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. If I can figure out what I'm
doing
wrong, I'll get back to this list ...

--> R




Stephen Witkop <switk@worldnet.att.net> on 05/02/99 01:13:49 PM

Please respond to gtk-list@redhat.com

To:   gtk-list@redhat.com
cc:    (bcc: Robert Gasch/PeopleSoft)
Subject:  [gtk-list] Re: itemfactory radiomenuitems?




Robert_Gasch/PeopleSoft@peoplesoft.com wrote:
>
> Hi,
>
> I'm having some similar problem using itemfactory and
> radiomenuitems. In my case, if I have 2 menu items (A & B) ,
> the first time I select B, I get an event for A and B. Subsequent
> selects work OK ...
> I've been stuck on this 'bug' now for quite a while (something
> like 2 months) and I'm encouraged by the fact that you have
> (somewhat similar) problems ..
>
> Can anybody confirm that it is possible to get a properly working
> menu of radioitems with itemfactory. I'm using Gtk--, but that
> shouldn't really matter ...
>
> Thanks
> --> R
>
> Marsel Osipov <virtuoso@jps.net> on 05/01/99 07:51:44 AM
>
> Please respond to gtk-list@redhat.com
>
> To:   Gtk list <gtk-list@redhat.com>
> cc:    (bcc: Robert Gasch/PeopleSoft)
> Subject:  [gtk-list] itemfactory radiomenuitems?
>
> Hello all
>
> Does anyone have  a working example of how to use radiomenuitems with
> itemfactory?  Or can anyone point me to what I am doing wrong?  I have
> an itemfactory that creates 2 radiomenuitems. "/Shade/Flat" and
> "/ShadeSmooth", now, when I run the prog, and click on "Shade", both of
> the items are selected.  I click on one of them, the other unselects,
> and the next time I click on the menu, they work as expected.  But it is
> the first time I click on the menu that I am having troubles with.  I
> create the items, and then use get_radiomenuitem_widget(path) to get the
> item so that I can set it active, but that does not work.  Any clues?
>
> Thank you
> Marsel
>
> --

 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-- ?

HTH,

--
          Stephen

--
To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null










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