GTKD - addOnButtonPress faulty?
Mike Wey via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Jun 23 15:00:18 PDT 2016
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
More information about the Digitalmars-d-learn
mailing list