B4J Question Default Button - how to set

Mark Stuart

Active Member
Licensed User
Longtime User
Hi,
How do I make a button the default button when the user presses Enter on a form?

Thanx,
Mark S.
 

Daestrum

Expert
Licensed User
Longtime User
assuming b is the button
B4X:
...
Dim jo as JavaObject
jo = b
jo.RunMethod("setDefaultButton",Array(True))
...
It will only work providing no other control on the form consumed the enter key press.
 
Upvote 0

Mark Stuart

Active Member
Licensed User
Longtime User
Daestrum,
Thank you, that works exactly as I'd expect...
Colors the default button a light blue and when Enter is pressed, executes the default button script.

Thanx,
Mark S.
 
Upvote 0
Top