almondega
15-04-2012 23:10:15
Hi all, I'm trying to inject key press on a MultiListBox, to navigate the itens up or down.
This works fine for ListBox, but for MultiListBox I got no item selection at all.
Here is what I'm doing:
Am I missing something?
Here is the layout:
Thanks.
This works fine for ListBox, but for MultiListBox I got no item selection at all.
Here is what I'm doing:
MyGUI::LayoutManager::getInstance().loadLayout("SpecialMenu.layout"); // TabControl with MultiLixBox
uiSpecialMenu = mGUI->findWidget<MyGUI::Window>("SpecialMenu"); // Getting the entire TabControl
uiSpecialMagic = uiSpecialMenu->findWidget("SpecialMagic")->castType<MyGUI::MultiListBox>(); // Getting the MultiLixBox
uiSpecialMagic->setIndexSelected(0);
...
MyGUI::InputManager::getInstance().setKeyFocusWidget(uiSpecialMagic); // This works
MyGUI::InputManager::getInstance().injectKeyPress(MyGUI::KeyCode::ArrowDown); // This doesn't work
Am I missing something?
Here is the layout:
<?xml version="1.0" encoding="UTF-8"?>
<MyGUI type="Layout" version="3.2.0">
<Widget type="Window" skin="PanelEmpty" position="0 0 275 230" align="Center" layer="Main" name="SpecialMenu">
<Widget type="TabControl" skin="TabControl" position="0 0 275 230" name="Special">
<Property key="Alpha" value="0.8"/>
<Widget type="TabItem" skin="" position="2 24 269 202">
<Property key="Caption" value="Magic"/>
<Widget type="MultiListBox" skin="MultiListBox" position="5 5 260 195" align="Stretch" name="SpecialMagic">
<Property key="NeedKey" value="true"/>
<Widget type="MultiListItem" skin="" position="0 0 25 166" name="MagicTeste">
<Property key="ItemWidth" value="25"/>
<Property key="ItemResizingPolicy" value="Fixed"/>
</Widget>
<Widget type="MultiListItem" skin="" position="25 0 202 166">
<Property key="Caption" value="Name"/>
<Property key="ItemResizingPolicy" value="Fill"/>
</Widget>
<Widget type="MultiListItem" skin="" position="227 0 25 166">
<Property key="Caption" value="AP"/>
<Property key="ItemResizingPolicy" value="Fixed"/>
<Property key="ItemWidth" value="25"/>
</Widget>
</Widget>
</Widget>
<Widget type="TabItem" skin="" position="2 24 269 202">
<Property key="Caption" value="Skill"/>
<Widget type="MultiListBox" skin="MultiListBox" position="5 5 260 195" align="Stretch" name="SpecialSkill">
<Widget type="MultiListItem" skin="" position="0 0 25 166">
<Property key="ItemResizingPolicy" value="Fixed"/>
<Property key="ItemWidth" value="25"/>
</Widget>
<Widget type="MultiListItem" skin="" position="25 0 202 166">
<Property key="Caption" value="Name"/>
<Property key="ItemResizingPolicy" value="Fill"/>
</Widget>
<Widget type="MultiListItem" skin="" position="227 0 25 166">
<Property key="Caption" value="AP"/>
<Property key="ItemResizingPolicy" value="Fixed"/>
<Property key="ItemWidth" value="25"/>
</Widget>
</Widget>
</Widget>
</Widget>
</Widget>
</MyGUI>
Thanks.