Page 1 of 1

Issue Re-opening a Popup [Solved]

Posted: Wed Jul 13, 2016 18:06
by TheWanderer
Hi everyone,

I'm working on a context menu which appears when you right-click on the screen and am having an issue when I try to re-open it after it's been used. Specifically, my context menu has (currently) 3 layers of menus (Top, Sub, then Options) as specified below.

The menu disappears correctly when I choose one of the options, but when I open it again by right-clicking, the context menu appears with all sub-menus already open. It's like it's not resetting properly.

Is this due perhaps to how I'm re-opening it? (I set it to visible and enable it) Looking at the recursive call for MenuItem::closeAllMenuItemPopups(), I see that it finds the parent and then calls hide on it, which I assume doesn't really close the submenus. Can anyone tell me what I should be looking for in order to determine why the submenus don't collapse?

Thank you for the help.

Code: Select all

        <Window name="MainMenu"  type="TaharezLook/PopupMenu" >
           
            <Window name="Menu1" type="TaharezLook/MenuItem" >
                <Property name="Text" value="Menu 1" />
               
                <Window name="Menu1_Categories"  type="TaharezLook/PopupMenu" >
                   
                    <Window name="Menu1_Submenu1" type="TaharezLook/MenuItem" >
                        <Property name="Text" value="Submenu 1" />
                   
                        <Window name="Menu1_Submenu1_Categories_Popup"  type="TaharezLook/PopupMenu" >
                           
                            <Window name="Category1" type="TaharezLook/MenuItem" >
                                <Property name="Text" value="Category1" />
                            </Window>
                            <Window name="Category2" type="TaharezLook/MenuItem" >
                                <Property name="Text" value="Category2" />
                            </Window>
                            <Window name="Category3" type="TaharezLook/MenuItem" >
                                <Property name="Text" value="Category3" />
                            </Window>                             
                           
                        </Window>
                    </Window>
                </Window>
            </Window>                                   
        </Window>                                               


Code: Select all

[13:01:07] Cegui: ---- Version: 0.8.4 (Build: Jul 13 2016 Static Debug Microsoft Windows MSVC++ 11.0 32 bit) ----
[13:01:07] Cegui: ---- Renderer module is: CEGUI::OgreRenderer - Official OGRE based 2nd generation renderer module. ----
[13:01:07] Cegui: ---- XML Parser module is: CEGUI::RapidXMLParser - Official RapidXML based parser module for CEGUI ----
[13:01:07] Cegui: ---- Image Codec module is: OgreImageCodec - Integrated ImageCodec using the Ogre engine. ----
[13:01:07] Cegui: ---- Scripting module is: None ----

Re: Issue Re-opening a Popup

Posted: Wed Jul 13, 2016 19:20
by YaronCT
@TheWanderer: I'll do my best to help u. Note, however, that there's been a flood of issues from users recently, and part of the cegui team is on vacation, so it may take time. Sorry.

Re: Issue Re-opening a Popup

Posted: Wed Jul 13, 2016 19:39
by TheWanderer
That's quite al'right, YaronCT. I appreciate you taking the time to look into it. If there's any information I can give or any avenue I can pursue to help diagnose the issue, just let me know.

Re: Issue Re-opening a Popup [Solved]

Posted: Thu Jul 14, 2016 18:41
by TheWanderer
Or I can just spend a bit more time and figure it out...

The magic line is:

Code: Select all

 <Property name="AutoCloseNestedPopups" value="true" />


Tracing the code, I found that MenuBase::d_autoCloseNestedPopups, the variable controlling the collapse behaviour, defaults to false. I'm not entirely sure why it was collapsing properly when I was using only two layers of menus given I wasn't using the above property.

In any case, I'm glad I found it. One more item off your plate, YaronCT :)

Re: Issue Re-opening a Popup [Solved]

Posted: Thu Jul 14, 2016 18:42
by YaronCT
:D

Re: Issue Re-opening a Popup [Solved]

Posted: Sat Jul 16, 2016 14:27
by YaronCT
@TheWanderer: If you're interested, feel free to share with us about the project u work on (in the dedicated forum).