Hi,
I'm trying to figure out if the user is in an editable window and typing stuff (so that it doesn't trigger key shortcuts) and I'm having a really bad time with this. When inside a MultiLineEditbox Window::getCaptureWindow() returns NULL, now why is that when I am clearly typing stuff in it ? I also tried EventInputCaptureGained/Lost only to see weird behaviour like receiving a lost message when I'm actually still inside it. What is the best way to detect if the keyboard is sending text to an edit box ?
Window::getCaptureWindow() returns NULL
Moderators: CEGUI MVP, CEGUI Team
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Re: Window::getCaptureWindow() returns NULL
Go to the search box and type in: editbox key event
HTH
CE.
HTH
CE.
Useful Links: Forum Guidelines | Documentation | Tutorials | HOWTO | Videos | Donate to CEGUI | CEGUI Twitter
Re: Window::getCaptureWindow() returns NULL
Thanks ! This piece of code is the solve (in case someone's reading through the post)
It also works with multiline boxes by just editing the classes involved from Editbox to MultiLineEditbox.
Code: Select all
CEGUI::Editbox* getActiveEditbox()
{
using namespace CEGUI;
Window* root = System::getSingleton().getGUISheet();
if (root)
{
Window* activeChild = root->getActiveChild();
if ((activeChild != 0) &&
activeChild->testClassName("Editbox") &&
static_cast<Editbox*>(activeChild)->hasInputFocus())
{
return static_cast<Editbox*>(activeChild);
}
}
return 0;
}
It also works with multiline boxes by just editing the classes involved from Editbox to MultiLineEditbox.
Who is online
Users browsing this forum: No registered users and 5 guests