Heya,
I've recently started adding Editboxes to my UI, and they work fine, so yay.
What I do notice though is that if I press anywhere else, the editbox doesn't get deselected. It only gets deselected when I press another editbox or a button.
Is there a way that I can solve this, and also make it so that [Enter] deselect it as well?
Thanks in advance!
Anasky
[Solved] Deselecting an Editbox
Moderators: CEGUI MVP, CEGUI Team
Re: Deselecting an Editbox
Use deactivate/activate and isActive/GetActiveChild etc. for setting focussed windows or unsetting them
CrazyEddie: "I don't like GUIs"
Re: Deselecting an Editbox
How would that solve my issue?
-> client tells CEGUI a mouse button has been pressed
-> either CEGUI changes the selected child, or doesn't.
-> if it does, it's fine
-> if it doesn't, should I deselect the currently selected item? what if they just clicked the same editbox again? I shouldn't deselect it in that case?
Just in case clarifying would help:
- I have a root window
- With an editbox on it
- I select the editbox, and type
- Then I press somewhere else in my screen
- --> Editbox is still selected <-- (Clicking somewhere else should deselect the editbox?)
-> client tells CEGUI a mouse button has been pressed
-> either CEGUI changes the selected child, or doesn't.
-> if it does, it's fine
-> if it doesn't, should I deselect the currently selected item? what if they just clicked the same editbox again? I shouldn't deselect it in that case?
Just in case clarifying would help:
- I have a root window
- With an editbox on it
- I select the editbox, and type
- Then I press somewhere else in my screen
- --> Editbox is still selected <-- (Clicking somewhere else should deselect the editbox?)
Re: Deselecting an Editbox
Is your root window able to steal activation? Afaik there can only be one active Window, so.... Did you check if it gets selected if you click it (check with the functions i mentioned, e.g. use a click handler and output to console if it is active, when the click happens, maybe you need to click twice though to be sure the internal handling doesnt happen after the handler and be sure to return false in the handler so you dont intercept)
CrazyEddie: "I don't like GUIs"
Re: Deselecting an Editbox
How would I allow my root window to steal activation?
The activating of the editbox works, I can see it selecting the widget and I can start typing in it, so that part works fine
I tried adding a click handler with an empty function to the root window, but that didn't seem to work? What method would be needed for this?
The activating of the editbox works, I can see it selecting the widget and I can start typing in it, so that part works fine

I tried adding a click handler with an empty function to the root window, but that didn't seem to work? What method would be needed for this?
Re: Deselecting an Editbox
Anasky wrote:How would I allow my root window to steal activation?
The activating of the editbox works, I can see it selecting the widget and I can start typing in it, so that part works fine
I tried adding a click handler with an empty function to the root window, but that didn't seem to work? What method would be needed for this?
??? What what would an empty function do?
You can btw subscribe a handler for input events and check if the input is an Enter key and if so you can do deactivate on the Window*. Isnt that what you wanted?
CrazyEddie: "I don't like GUIs"
Re: Deselecting an Editbox
That would solve 1 of the 2 questions, thanks 
What remains would be clicking outside the editbox.
So clicking anywhere on the screen that is not an editbox -> deselect the active window.

What remains would be clicking outside the editbox.
So clicking anywhere on the screen that is not an editbox -> deselect the active window.
Re: Deselecting an Editbox
click handler for the other window (root?), in the function you deactivate whatever is clicked which you can find out with the functions i mentioned above.
CrazyEddie: "I don't like GUIs"
Re: Deselecting an Editbox
That's what I'm trying to do, but it doesn't work 
I've added a handler to EVERY widget that I have using:
CEGUI::Window* l_NewWindow;
//...
l_NewWindow->subscribeEvent( CEGUI::PushButton::EventClicked, CEGUI::SubscriberSlot( &OpenGLLib::GUIFramework::clsWidget::Activate, this ) );
and the activate function I made having a breakpoint in it.
However, the breakpoint is never triggered...
Am I using the wrong type of event perhaps?

I've added a handler to EVERY widget that I have using:
CEGUI::Window* l_NewWindow;
//...
l_NewWindow->subscribeEvent( CEGUI::PushButton::EventClicked, CEGUI::SubscriberSlot( &OpenGLLib::GUIFramework::clsWidget::Activate, this ) );
and the activate function I made having a breakpoint in it.
However, the breakpoint is never triggered...
Am I using the wrong type of event perhaps?
Re: Deselecting an Editbox
Ident wrote:Yes, wrong event.
CEGUI::PushButton::EventMouseClick
Thanks for the help

Re: Deselecting an Editbox
Anasky wrote:Ident wrote:Yes, wrong event.
CEGUI::PushButton::EventMouseClick
Thanks for the help
Isnt there a Window:EventMouseClick?
Not every window is a pushbutton.
CrazyEddie: "I don't like GUIs"
Re: Deselecting an Editbox
Ident wrote:Anasky wrote:Ident wrote:Yes, wrong event.
CEGUI::PushButton::EventMouseClick
Thanks for the help
Isnt there a Window:EventMouseClick?
Not every window is a pushbutton.
namespace CEGUI has no member EventMouseClick.
The PushButton version works though

Re: Deselecting an Editbox
Why dont you do a full-text search?
Window::EventMouseClick is what you want.
Window::EventMouseClick is what you want.
CrazyEddie: "I don't like GUIs"
Re: Deselecting an Editbox
Ident wrote:Why dont you do a full-text search?
Window::EventMouseClick is what you want.
Misread your last reply, my bad.
Yeah, Window::EventMouseClick does work ^^
Any clue how I can hide the password entered? I found the "setMaskCodePoint" on the forum questions, but that seems to be legacy code, and couldn't find anything on the tutorial page of the wiki.
Who is online
Users browsing this forum: Google [Bot] and 10 guests