Page 1 of 1

Menubar inactive?

Posted: Thu Mar 27, 2008 13:50
by HexDump
Hi all,

Here I am again with one of my newbie questions :/.

This time is about the Menubar. I have created a menu bar with the editor. Nice, it has loaded perfectly. I can see the menu bar, but when I click on the items they don´t do anything. I have seen some code at the wiki, and it seems no events have to be registered for the manubar items (the one that expand the popup menues), but nothing happen when I click on the main menu items. This works perfectly in the editor... Do anybody know what could be hapenning?.

Thanks in advance,
HexDump.

Posted: Fri Mar 28, 2008 09:53
by CrazyEddie
Nothing comes to me immediately, in the mean time can you post the section of the layout xml?

Thanks :)

CE.

Posted: Fri Mar 28, 2008 10:27
by HexDump
HI Eddie,

Here is my layout:

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>

<GUILayout >
    <Window Type="DefaultWindow" Name="MainWindow" >
        <Property Name="InheritsAlpha" Value="False" />
        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
        <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" />
        <Window Type="TaharezLook/Menubar" Name="MainMenu" >
            <Property Name="ItemSpacing" Value="10" />
            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
            <Property Name="UnifiedAreaRect" Value="{{-0.00312502,0},{0.0033334,0},{0.996875,0},{0.0512503,0}}" />
            <Window Type="TaharezLook/MenuItem" Name="MainMenu/File" >
                <Property Name="Text" Value="File" />
                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                <Property Name="UnifiedAreaRect" Value="{{0,7},{0,0},{0,30},{0,21}}" />
                <Property Name="VerticalAlignment" Value="Centre" />
                <Window Type="TaharezLook/PopupMenu" Name="MainMenu/File/AutoPopup" >
                    <Property Name="Visible" Value="False" />
                    <Property Name="FadeInTime" Value="0" />
                    <Property Name="FadeOutTime" Value="0" />
                    <Property Name="ItemSpacing" Value="2" />
                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                    <Property Name="ClippedByParent" Value="False" />
                    <Property Name="UnifiedAreaRect" Value="{{0,0},{0,21},{0,36},{0,138.455}}" />
                    <Property Name="AutoResizeEnabled" Value="True" />
                    <Window Type="TaharezLook/MenuItem" Name="MainMenu/File/New" >
                        <Property Name="Text" Value="New" />
                        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                        <Property Name="UnifiedAreaRect" Value="{{0,2},{0,2},{0,34},{0,23}}" />
                    </Window>
                    <Window Type="TaharezLook/MenuItem" Name="MainMenu/File/Open" >
                        <Property Name="Text" Value="Open" />
                        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                        <Property Name="UnifiedAreaRect" Value="{{0,2},{0,25},{0,34},{0,46}}" />
                    </Window>
                    <Window Type="TaharezLook/MenuItem" Name="MainMenu/File/Close" >
                        <Property Name="Text" Value="Close" />
                        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                        <Property Name="UnifiedAreaRect" Value="{{0,2},{0,48},{0,34},{0,69}}" />
                    </Window>
                    <Window Type="TaharezLook/MenuItem" Name="MainMenu/File/Save" >
                        <Property Name="Text" Value="Save" />
                        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                        <Property Name="UnifiedAreaRect" Value="{{0,2},{0,71},{0,34},{0,92}}" />
                    </Window>
                    <Window Type="TaharezLook/MenuItem" Name="MainMenu/File/Exit" >
                        <Property Name="Text" Value="Exit" />
                        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                        <Property Name="UnifiedAreaRect" Value="{{0,2},{0,94},{0,34},{0,115}}" />
                    </Window>
                </Window>
            </Window>
            <Window Type="TaharezLook/MenuItem" Name="MainMenu/Help" >
                <Property Name="Text" Value="Help" />
                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                <Property Name="UnifiedAreaRect" Value="{{0,40},{0,0},{0,66},{0,21}}" />
                <Property Name="VerticalAlignment" Value="Centre" />
                <Window Type="TaharezLook/PopupMenu" Name="MainMenu/Help/AutoPopup" >
                    <Property Name="Visible" Value="False" />
                    <Property Name="FadeInTime" Value="0" />
                    <Property Name="FadeOutTime" Value="0" />
                    <Property Name="ItemSpacing" Value="2" />
                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                    <Property Name="ClippedByParent" Value="False" />
                    <Property Name="UnifiedAreaRect" Value="{{0,0},{0,21},{0,63},{0,69.2939}}" />
                    <Property Name="AutoResizeEnabled" Value="True" />
                    <Window Type="TaharezLook/MenuItem" Name="MainMenu/Help/Help" >
                        <Property Name="Text" Value="Contents..." />
                        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                        <Property Name="UnifiedAreaRect" Value="{{0,2},{0,2},{0,61},{0,23}}" />
                    </Window>
                    <Window Type="TaharezLook/MenuItem" Name="MainMenu/Help/About" >
                        <Property Name="Text" Value="About..." />
                        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                        <Property Name="UnifiedAreaRect" Value="{{0,2},{0,25},{0,61},{0,46}}" />
                    </Window>
                </Window>
            </Window>
        </Window>
        <Window Type="DefaultWindow" Name="AppWindow/" >
            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
            <Property Name="UnifiedAreaRect" Value="{{4.49363e-008,0},{0.0520834,0},{1.00312,0},{0.997917,0}}" />
        </Window>
    </Window>
</GUILayout>


Thanks in advance,
HexDump.

Posted: Fri Mar 28, 2008 11:26
by CrazyEddie
Hi,

I loaded the layout into a sample application, and it appeared to work ok, so it's likely be something wrong with the way you inject inputs.

Can you double check that, and post the relevant code if you feel it would help :)

CE.

Posted: Fri Mar 28, 2008 12:52
by HexDump
Well, I think the injection is working ok because all the other things I have are working ok.

Anyway I will do what you said as soon as I get home.

Thanks for your time,
HexDump.

Posted: Fri Mar 28, 2008 13:19
by CrazyEddie
Hi,

I read your reply, and then had the lightbulb come on ;)

I would be willing to bet that you have multiple overlapping full-screen 'pages' (DefaultWindows) attached to the same root - this means that when one page gets moved in front of the page with the menus on the page that is now underneath, events are stopped from getting to it by an invisible window (lol, that's not the clearest explanation).

My recommendation is to try and make sure you do not have multiple full-screen DefaultWindows. Although you could try setting the mouse passthrough on those windows to allow mouse events to "pass through" (hence the name) - which is an easier solution, I guess...

Window::setMousePassThroughEnabled
and
MousePassThroughEnabled property

HTH

CE

Posted: Fri Mar 28, 2008 16:08
by HexDump
Hi again!,

Well, I just came with a "I found a solution" full of proud, but I saw you just spotted the problem. I don´t really know what was hapenning but I suspect is something realted to what you stated.

My layout is something like this

-Sheet
--MAIN MENU
--Default Window (This will be used to change screens, I´m not using sheet)
---Default Window (In my case one of my screens, this was a tile editor)
----FrameWindow for a meshbrowser
----Other things

This is what I have now and it seems to work. I was playing with it and perhpas your were true and some default windows were overlapping. Anyway it is working now. What do you think about my layout? is it bad to have several default windows this way?.


Edit: By the way which is the best way to have some template of windows like a, Yes no dialog, etc...? Should I be adding them to my layout and hide them and show the one I need when needed?. For example I need a dialog, that shows a text, with 2 buttons (Yes/No) is it possible to add it to the layout for later use? This way I only had to change the text when needed and this will provide me a nice Yes/No selection dialog.

Thanks in advance,
HexDump.

Posted: Fri Mar 28, 2008 19:39
by CrazyEddie
Hi,

Sorry to have stolen your glory :lol:

Basically what you want to try and avoid is having full sized DefaultWindows (or sheets - basically the same thing) in a side-by-side arrangement (hierarchically speaking, as in attached to a common parent, not visually) . Except in cases where you intend to show/hide them in order to implement pages that are not supposed to be interacted with simultaneously.

If, for whatever reason, it is required or otherwise desirable to have things arranged in a side-by-side fashion, just ensure that the mouse pass through is enabled for those DefaultWindows / sheets - this way it should not matter how you have things arranged.

With regards to the yes/no dialog, there are a thousand and one ways of going about it ;) Having it permanently attached to the root sheet, and showing/hiding it as required is certainly one valid approach, especially for simple cases where you're never going to want more than one at the same time.

It's likely if I were to need such a thing myself it would be a more generic class based affair, though I am "Mr. Overkill". If things go well over the weekend, I might be inspired to Wiki such a thing ;) (Or maybe it already exists?!)

CE.

Posted: Fri Mar 28, 2008 20:24
by HexDump
Hehee, thanks for the answer mate.

HexDump.