Hi all,
this came unexpected. This morning I'm working on an old system (XP, Java 1.8.0.74, B4J 4.2) and figured out something that I wasn't aware of (i.e. I didn't test it on my regular dev sys).
Using the Internal Designer to place a button on my UI and through "Tools/ Generate members", I flag both "Action" and "MouseClicked". The goal is to trap a "click" on that button from the user, indipendently if via mouse or keyboard.
What I observed is that :
- if the user uses the mouse to click on the button, both events are raised ("MouseClicked" first, "Action" last)
- if the user uses the keyboard (spacebar) to click the button, only the "Action" event is raised.
While the latter is to be ackowledged as "natural", why the former behavior?
I discovered the above because on Button_Action I placed a call to Button_MouseClicked in order to execute the same code on both circumstances but ended up with a duplicate action in case of a user's MouseClick (mouse-action-mouse sequence)!
I know how to circumvent the problem, but since I'm still building my B4J knowledge I believe is better to ask here and learn if I'm misusing the tool, having a logical fault or whatever.
Thanks
this came unexpected. This morning I'm working on an old system (XP, Java 1.8.0.74, B4J 4.2) and figured out something that I wasn't aware of (i.e. I didn't test it on my regular dev sys).
Using the Internal Designer to place a button on my UI and through "Tools/ Generate members", I flag both "Action" and "MouseClicked". The goal is to trap a "click" on that button from the user, indipendently if via mouse or keyboard.
What I observed is that :
- if the user uses the mouse to click on the button, both events are raised ("MouseClicked" first, "Action" last)
- if the user uses the keyboard (spacebar) to click the button, only the "Action" event is raised.
While the latter is to be ackowledged as "natural", why the former behavior?
I discovered the above because on Button_Action I placed a call to Button_MouseClicked in order to execute the same code on both circumstances but ended up with a duplicate action in case of a user's MouseClick (mouse-action-mouse sequence)!
I know how to circumvent the problem, but since I'm still building my B4J knowledge I believe is better to ask here and learn if I'm misusing the tool, having a logical fault or whatever.
Thanks