Android Question Multiple edittext one made up soft keyboard

Yves Mazzon

Member
Licensed User
Longtime User
All,
Bear with me I just learning the B4a language. I copied the soft keyboard provided on the beginner guide called "my second program".
Where I'm stock is how do I connect my soft keyboard on each editText so I can enter a numerical value when they pressed?
Perhaps I must write the routine in each sub?????????
 

Yves Mazzon

Member
Licensed User
Longtime User
Let me rephrase my question above.
I have 8 EditText what would be the routine that indicate which EditText has been touched so I can enter values with my keyboard?
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
Do you really need EditText views ?
SecondProgram in the Beginner's Guide uses a Label instead of an EditText to avoid that the user interfers in the EditText view.
There are different possibilties, below a simple example.
You could add a Global variable holding the selected Lablel for example:
Dim lblSelected As Label
Add a Click event for all Labels, in this event set the global variable to the calling Label.
Sub lbl_Click
lblSelected = Sender
End Sub

In the btnEvent_Click routine replace lblResult by lblSelected.
 
Upvote 0

Yves Mazzon

Member
Licensed User
Longtime User
Thanks Klaus,
I'm going to try your suggestion. Can you please let me know what Sender is and do? It is so difficult to find an indexed manual that explain every functions and properties with B4A. There is no proper manual. Does it?
Regards,

Yves
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0

Yves Mazzon

Member
Licensed User
Longtime User
Do you really need EditText views ?
SecondProgram in the Beginner's Guide uses a Label instead of an EditText to avoid that the user interfers in the EditText view.
There are different possibilties, below a simple example.
You could add a Global variable holding the selected Lablel for example:
Dim lblSelected As Label
Add a Click event for all Labels, in this event set the global variable to the calling Label.
Sub lbl_Click
lblSelected = Sender
End Sub

In the btnEvent_Click routine replace lblResult by lblSelected.

Thank you Klaus,
I'm still battling to understand the nitty gritty and not sure to understand the logic of it. I have attached what I wrote so far. Can you please give me a "push start" and I'm sure I will be able to fly with my own wings and stop bothering the forum with problems that may look silly to other.
 

Attachments

  • Metal.zip
    333 KB · Views: 176
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
you did create a sub
B4X:
Sub lbl_Click
    lblSelected = Sender
End Sub
but the labels you defined in designer does not have the eventname "lbl"... they had lbldata1 and lbldata2... I changed oth to lbl

THEN in your
B4X:
Sub btnEvent_Click
End Sub
sub you used always lablSelected instead of lblSelected
 

Attachments

  • secondedited.zip
    7.8 KB · Views: 148
Upvote 0

klaus

Expert
Licensed User
Longtime User
Attached a modified version.
You ust be consistent in the variable namees !!!!
Examples:
lablSelected and lblSelected
labelData2 and lblData2
I changed the colors of the labels to show which label is selected.
 

Attachments

  • Metal1.zip
    7.9 KB · Views: 139
Upvote 0

Yves Mazzon

Member
Licensed User
Longtime User
you did create a sub
B4X:
Sub lbl_Click
    lblSelected = Sender
End Sub
but the labels you defined in designer does not have the eventname "lbl"... they had lbldata1 and lbldata2... I changed oth to lbl

THEN in your
B4X:
Sub btnEvent_Click
End Sub
sub you used always lablSelected instead of lblSelected

Thank you very much Don,
No I learn where the event must be mentioned so now I can go on. You saved my day.

Yves
 
Upvote 0
Top