Cycling event

zcout

01-03-2010 12:38:16

Hey all,
I've got a problem, my key listener in MyGUI acts like a cycle, im setting it up like this:

...
myWidget->eventKeyButtonPressed = MyGUI::newDelegate(this, &ThisClass::myWidget_keyPressed);
}

void ThisClass::myWidget_keyPressed(MyGUI::Widget* _sender, MyGUI::KeyCode _key, MyGUI::Char _char)
{
// once I press some key, this code starts repeating forever, why? :/
}



Input is injected from a buffered OIS input event callback.. but that OIS callback code is done only once for a pressed key (I've ensured myself about that using logging), while this MyGUI event callback keeps repeating. Any ideas why?

MyGUI 3.0.1
Ogre 1.7

Thanks for any help!

Altren

01-03-2010 13:32:46

When you press key and hold it autorepeats until you release that key. So you probably not releasing key or not injecting key released into GUI.

zcout

01-03-2010 13:50:06

When you press key and hold it autorepeats until you release that key. So you probably not releasing key or not injecting key released into GUI.

I've modified it for key release. And it does exactly the same (after the key release). So, I'm sure I'm releasing that key and also injecting the release. The widget in this case is Edit, could it be related?

Altren

01-03-2010 13:53:34

Another possible reason is that you put breakpoint there and you getting next thing:
- key pressed
- breakpoint triggered
- key released (but not handled by application because it was stopped at breakpoint)
- continue process: gui still think that key is pressed and start autorepeat.

zcout

03-03-2010 22:25:36

What can be a "breakpoint" in the code?

zcout

03-03-2010 23:53:09

First I thought it's a bug related to the new versions recently released, then I wanted to ensure myself that just my app is wrong in some point, which I did with some testing. But it still took me several hours more to find my mistake: in OIS's callback for key RELEASE I was injecting key PRESS to the MyGUI as well as in OIS's key PRESS I was injecting key RELEASE to the MyGUI.. simple inversion. Thanks for your time.