Another Custom Keyboard Question

Bill Norris

Active Member
Licensed User
Longtime User
Sorry if this has been addressed elsewhere, but I could not find. I am building a simple keyboard for a tablet app -- 26 buttons for the letters and 10 for the numbers. Is quite simple to do, but is there a way around having 36 separate subs for the click event for each button. Click event will simply append the text of the button pressed to the existing text in a label across the top of the keyboard. I'm a bit spoiled with vb.net and its "sender" and "handles" parameters and am looking to somehow replicate that feature, or like the "control array" functionality of VB6.

Thanks,
Bill
 

joseluis

Active Member
Licensed User
Longtime User
Yes. Simply initialize each button with the same EventName. And then you only need 1 sub that uses Sender keyword to retrieve the specific button. e.g.
B4X:
Sub Button_Click
   Dim Send As Button
   Send=Sender
   
   log(Send.Text)
End Sub
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…