Page 1 of 1

setAutoRepeatRate - not working for me!

Posted: Wed Oct 14, 2009 04:51
by LearnerPlates
Me again - thanks for helping me out with all my little queries. :)

I'm having trouble setting the autorepeat rate for a button - no matter what value I give to setAutoRepeatRate(), it doesn't seem to be having any effect. I'm injecting a time pulse into CEGUI with each frame update as follows:

Code: Select all

CEGUI::System::getSingleton().injectTimePulse(evt.timeSinceLastFrame);


And setting the autorepeat on my CEGUI::PushButton* like so:

Code: Select all

btnVolumeUp->subscribeEvent(CEGUI::Window::EventMouseButtonDown, CEGUI::Event::Subscriber(&UserInterface::btnVolumeUpClick, this));
btnVolumeUp->setMouseAutoRepeatEnabled( true );
btnVolumeUp->setAutoRepeatDelay(1.0f);
btnVolumeUp->setAutoRepeatRate(1.0f);


The autorepeat works just fine - but it is ridiculously fast, no matter what value I put into setAutoRepeatRate. Am I missing something here?

Re: setAutoRepeatRate - not working for me!

Posted: Wed Oct 14, 2009 06:32
by LearnerPlates
Hmm, something odd - if I take out the injectTimePulse() line, the autorepeat still works! Is there something else that could be interfering here?

Re: setAutoRepeatRate - not working for me!

Posted: Wed Oct 14, 2009 09:25
by CrazyEddie
Are you calling Window::update on some window somewhere? If so, don't! :P

CE.

Re: setAutoRepeatRate - not working for me!

Posted: Wed Oct 14, 2009 11:03
by LearnerPlates
No, I'm not. :(

Could it be something to do with how I'm injecting mouse input into CEGUI? This is handled by another section of the program (not under my control - it's a team project), and I think

Code: Select all

CEGUI::System::getSingleton().injectMouseButtonDown( CEGUI::LeftButton )
is called every frame that the mouse button is down. Might that cause problems?

Something is definitely odd here - the autorepeat is happening even when I insert the line

Code: Select all

pBtnMusicUp->setMouseAutoRepeatEnabled( false );

in place of setting it to "true". :shock:

Re: setAutoRepeatRate - not working for me!

Posted: Wed Oct 14, 2009 13:36
by CrazyEddie
LearnerPlates wrote:I think

Code: Select all

CEGUI::System::getSingleton().injectMouseButtonDown( CEGUI::LeftButton )
is called every frame that the mouse button is down. Might that cause problems?

Yes, this is almost certainly the issue. Doing this is not recommended at all, and is definitely not any use that we intended.

CE.

Re: setAutoRepeatRate - not working for me!

Posted: Fri Oct 16, 2009 06:15
by LearnerPlates
Thanks for confirming, CE - I'll see what I can do to get that fixed!