2 small questions

nikki

18-07-2008 12:02:58

I have 2 small questions:-

1. How do I make a window 'undraggable' (not move when dragged)?

2. How do I make it such that a window is 'always on top' and the other windows never get focus? This is something like the 'modal = true' option for Messages, but for normal windows.

my.name

18-07-2008 13:30:04

1
original in WindowC:
<Child type="Button" skin="WindowCaption" offset = "3 0 18 30" align = "ALIGN_HSTRETCH ALIGN_TOP" name = "Caption">
<Property key="Scale" value = "1 1 0 0"/>
</Child>


Three variants:
1)
<Child type="Button" skin="WindowCaption" offset = "3 0 18 30" align = "ALIGN_HSTRETCH ALIGN_TOP" name = "Caption">
<Property key="Scale" value = "0 0 0 0"/>
</Child>

2)
<Child type="Button" skin="WindowCaption" offset = "3 0 18 30" align = "ALIGN_HSTRETCH ALIGN_TOP" name = "">
<Property key="Scale" value = "1 1 0 0"/>
</Child>

3)
use Window skin



2
InputManager::getInstance().addWidgetModal();

/** Add modal widget - all other widgets inaccessible while modal widget exist */
void addWidgetModal(WidgetPtr _widget);

nikki

18-07-2008 18:03:09

Ahh... Nice hack for the first issue. ;)

But for the second one, I'm using this code:-
//Load the layout.
MyGUI::LayoutManager::getInstance().loadLayout("LoadGame.layout");

//Center our window, make it modal.
mWindow = GlbVar.guiMgr->findWidget<MyGUI::Window>("win_loadGame");

Real height = mWindow->getHeight();
Real width = mWindow->getWidth();
mWindow->setPosition((WindowWidth - width) / 2, (WindowHeight - height) / 2);

MyGUI::InputManager::getInstance().addWidgetModal(mWindow);

Now, its modal (the other windows are not active), but this window is not active too. I can't use any of the Widgets on it, if I click on them nothing is happening. When I load this layout, another window is already present. If I destroy that window, then it works, but I want both the windows to be present at the same time.

my.name

19-07-2008 00:17:37

show layout

nikki

19-07-2008 06:28:54

Here's the layout:-
<?xml version="1.0" encoding="UTF-8"?>
<MyGUI type="Layout">
<Widget type="Window" skin="WindowC" position="544 160 232 360" layer="Back" name="win_loadGame">
<Property key="Widget_Caption" value="Load Game"/>
<Property key="Widget_Enabled" value="true"/>
<Widget type="StaticImage" skin="StaticImage" position="29 10 168 168" name="img_levelPic">
<Property key="Image_Texture" value="logo.jpg"/>
</Widget>
<Widget type="ComboBox" skin="ComboBox" position="29 194 168 24" name="cmb_level">
<Property key="Widget_Caption" value=""/>
<Property key="Widget_AlignText" value="ALIGN_LEFT ALIGN_VCENTER"/>
</Widget>
<Widget type="Button" skin="ButtonSmall" position="29 242 168 24" name="but_load">
<Property key="Widget_Caption" value="Load"/>
<Property key="Widget_AlignText" value="ALIGN_HCENTER ALIGN_VCENTER"/>
<Property key="Widget_Colour" value="1 1 1"/>
</Widget>
<Widget type="Button" skin="ButtonSmall" position="29 274 168 24" name="but_loadCancel">
<Property key="Widget_Caption" value="Cancel"/>
<Property key="Widget_AlignText" value="ALIGN_HCENTER ALIGN_VCENTER"/>
</Widget>
</Widget>
</MyGUI>

nikki

19-07-2008 06:33:48

Oh, I fixed it, by putting the Window on 'Main' layer. :)

my.name

19-07-2008 13:12:34

=)