it seems as though this function should not handle &e when the if() statement fails.
simply moving the statement
e.handled = true;
inside the preceding } should fix this issue.
thanks!
Code: Select all
void Editbox::onCharacter(KeyEventArgs& e)
{
// base class processing
Window::onCharacter(e);
// only need to take notice if we have focus
if (hasInputFocus() && getFont()->isCodepointAvailable(e.codepoint) && !isReadOnly())
{
// backup current text
String tmp(d_text);
tmp.erase(getSelectionStartIndex(), getSelectionLength());
// if there is room
if (tmp.length() < d_maxTextLen)
{
tmp.insert(getSelectionStartIndex(), 1, e.codepoint);
if (isStringValid(tmp))
{
// erase selection using mode that does not modify d_text (we just want to update state)
eraseSelectedText(false);
// advance carat (done first so we can "do stuff" in event handlers!)
d_caratPos++;
// set text to the newly modified string
setText(tmp);
}
else
{
// Trigger invalid modification attempted event.
WindowEventArgs args(this);
onInvalidEntryAttempted(args);
}
}
else
{
// Trigger text box full event
WindowEventArgs args(this);
onEditboxFullEvent(args);
}
}
e.handled = true;
}
i have a readonly Combobox, but as soon as something is selected from the dropdown, injectChar() begins returning true; claiming that my event is being handled
however, this should not be the case, as the combobox is readonly
processed |= CEGUI::System::getSingleton().injectChar( getKeyChar( rEvent.keyCode, modifiers ) );