[Glade-users] Option Menu Resizing
Damon Chaplin
damon@helixcode.com
Thu, 30 Nov 2000 00:54:15 +0000
David Cooper wrote:
>
> Damon,
>
> Ok, after checking into it, realize does not seem like the right place
> to make my function call.
>
> Here's what I'm trying to do. I want to create an empty option menu in
> glade and then, when the program is started, but before the main window
> is displayed, I want to read in a configuration file to add items to the
> options menu. Doing this on a realize event worked somewhat but things
> weren't sized correctly after I appended menuitems to the menu used by
> the option menu. I changed this function to be called on a window show
> event and it works fine and resized fine but does it after the window
> has been displayed. I'm looking for that "majic" event that happens
> sometime in between. I'm off to read some code...
Why can't you do it after calling the 'create_windowXXX()' function to
create the window, as I suggested?
Another option is the "style_set" signal, which happens just before the
size is calculated.
> While I'm asking... how do you add callbacks to menuitems of an options
> menu in glade? I haven't figured out a way to do it through the gui yet.
> For that matter, I haven't quite figured out how to get a pointer to an
> existing menu item so I can add a callback to it manually. Like I said,
> I'm off to read some code and hopefully figure this out.
The FAQ (at http://glade.pn.org) contains some info on using option menus.
You can't manipulate the individual menu items within Glade but you can
access them in your code.
Damon
> Damon Chaplin wrote:
> >
> > "David L. Cooper II" wrote:
> > >
> > > I am building an application with Glade. The main window contains an
> > > optionmenu that contains no entries. I add menu items to the menu used
> > > by the option menu in a callback on a main window realize. When the main
> > > window is displayed, the option menu is too short to display any of the
> > > items that I've appended to the menu. How can I get the items in the
> > > window to resize before the window is displayed? I don't want the main
> > > window to resize after it has been displayed.
> >
> > You could try adding the items immediately after creating the window:
> >
> > window1 = create_window1 ();
> > option_menu = lookup_widget (window1, "optionmenu1");
> > ... add items ...
> >
> > Was there any particular reason you used a "realize" callback?
> >
> > Damon