Thread overview |
---|
June 23, 2016 GTKD - addOnButtonPress faulty? | ||||
---|---|---|---|---|
| ||||
Hi, sorry for my next thread but i did encounter a strange behaviour of the "Button.addOnButtnPress" - Event. Sometimes if i click very fast on the GTKD button, it reacts twice! I am working on a small game and i noticed that if i click slowly everything works as expected but sometimes i have to click a button more than once and if i do it very fast it is often recognized as 3 clicks. I did it like this: Button btn_1 = new Button(); auto call1 = &btn1ClickedEvent; btn_1.addOnButtonPress(call1); bool btn1ClickedEvent(Event e, Widget widget){ userInput ~= 1; checkForWin(); return true; } So is it my bad code or was it recognized by others as well? I know that GTKD claims that this method is deprecated but i didn't find anything else that works. |
June 24, 2016 Re: GTKD - addOnButtonPress faulty? | ||||
---|---|---|---|---|
| ||||
Posted in reply to TheDGuy | On 06/23/2016 10:30 AM, TheDGuy wrote: > Hi, > > sorry for my next thread but i did encounter a strange behaviour of the > "Button.addOnButtnPress" - Event. Sometimes if i click very fast on the > GTKD button, it reacts twice! I am working on a small game and i noticed > that if i click slowly everything works as expected but sometimes i have > to click a button more than once and if i do it very fast it is often > recognized as 3 clicks. I did it like this: I'm not sure about this one, but when you click the button more than once the event is also called more than once. > Button btn_1 = new Button(); > auto call1 = &btn1ClickedEvent; > btn_1.addOnButtonPress(call1); > > bool btn1ClickedEvent(Event e, Widget widget){ > userInput ~= 1; > checkForWin(); > return true; > } > > So is it my bad code or was it recognized by others as well? I know that > GTKD claims that this method is deprecated but i didn't find anything > else that works. addOnPressed is deprecated addOnButtonPress is not. -- Mike Wey |
June 24, 2016 Re: GTKD - addOnButtonPress faulty? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mike Wey | On Thursday, 23 June 2016 at 22:00:18 UTC, Mike Wey wrote:
>
> addOnPressed is deprecated addOnButtonPress is not.
Ah, okay. I changed the event type to addOnButtonRelease and it works fine now, i don't know if it's just me or if addOnButtonPress behaves a little bit strange.
|
Copyright © 1999-2021 by the D Language Foundation