Re: [gtk-list] Re: GtkItemFactoryEntry: no field for callback data?



On Thu, Jan 14, 1999 at 04:38:05AM +0000, Todd Dukes wrote:
> Andy Kahn wrote:
> > 
> > just wondering where there is no provision for specifying callback
> > data as part of GtkItemFactoryEntry... i think it would be good to
> > have, since not all menu items may have identical callback data.
> > without it, i'm finding flexibility somewhat limited.
> > 
> It appears you can specify the callback data. You would just have
> to have a create_item or create_items call for each different callback
> data value.
> 
> I am not that familiar with the C interface since I use gtk--. But,
> I have been using the item factory for quite some time now. I
> am using it for my main menu and for context pop-up menus. I make
> a separate create_item call for each entry.
> 
> It may not be as easy to type in, but it is sufficiently flexible.

that's exactly what i wanted to avoid.  imagine a menu with a lot
of similar and related commands, but each requiring different callback
data.  e.g., one could have menu items to print a letter of the
alphabet from the English language.  with the way it is now, each one
of these menu itmes would need their own (separate, and different)
callback function, and each would just be doing a printf()!

the better method would be to specify their callback data as part
of the menu item table, and each menu item would go to the *same*
callback function.  that routine would then have the smarts of
dealing with the subtleties between the menu items, which in this
example, amounts to a single printf(), not 26 separate ones doing
exactly the same thing.
--andy



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