Re: Signals to and from menus



----- Original Message -----

> On Mon, 2005-04-04 at 15:52 -0500, Sudrien wrote:
> > I have hacked away at the Gtk::Menu::popup() stuff to find that the way I
> > am popping up menus can not control where they pop up.
>
> That should be possible. I think some of the popup() arguments allows
> you to control this. I'm not looking at the API documentation right now
> though.

Actually, late last night I did find a method that worked. For regerence:

http://svn.berlios.de/viewcvs/darimasen/trunk/src/darimasen.cpp?rev=48

Function Darimasen::DarimasenMenu::SpecialMenuForPath

This function handles menu replacement; I remove a submenu from a menuItem
(in a toolbar), create a new menu with the given information and set it as
the submenu. I wanted to use popup() to show this new submenu, but now I
realize that was a bad idea due to the fact that its parent menu is
missing by the time it is called - there is nothing to position relative
to.

I used MenuItemArray[position]->select(); instead, as it opened up the
menu normally. There was a side effect; This rebuilding can happen many
times, and using signal_activate().connect() for the MenuItems apparently
caused the menu to freeze up for several clicks after the first rebuild.
Using signal_button_release_event().connect() instead seems to work well.




>
> > *sigh*
> >
> > I come back to questions of when signals are emmited, and where to,
beyond
> > the scope of the libsigc++ documentation.
> >
> > 1. When you click a title in a menubar, obviously a signal must be
emited.
> > How can I hard-code it being emitted? (To trigger a submenu being opened)
> >
> > 2. There are other signals flying around on a menu hide(). What signal
can
> > a menubar recieve when one of its members' (a menuitem) submenu is
hidden?
>
> It would be easier for us to help you if you decide what you want to
> achieve, rather than just how you hope to achieve it.

Well, #1 has been addressed, as mentioned above.

For #2:

Well, You'd have to try The software for full effect. I'm using the menus
for file system navigation. Subenus are only one level deep.
http://developer.berlios.de/project/showfiles.php?group_id=2879&release_id=5362

I mentioned that submenus are replaced. There are circumstances that they
should revert to their original state - the submenu gets a hide signal
without a selection. Somewhere between that hide and its next appearance
it needs to be rebuilt - and somwere the must be a signal to trigger the
rubuilding without a segfault.

-Sud.



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