GTKD - addOnButtonPress faulty?

TheDGuy via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jun 23 01:30:12 PDT 2016


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.


More information about the Digitalmars-d-learn mailing list