Android Question Multiple edittext one made up soft keyboard

Yves Mazzon

Member
Licensed 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
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?
 

klaus

Expert
Licensed 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.
 

Yves Mazzon

Member
Licensed 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
 

Erel

Administrator
Staff member
Licensed User

klaus

Expert
Licensed User
Can you please let me know what Sender is and do?
You have looked at ScondProgram in the Beginner's Guide, this program is using the Sender keyword and it is explained on page 49 !
 

Yves Mazzon

Member
Licensed 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

DonManfred

Expert
Licensed 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

klaus

Expert
Licensed 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

Yves Mazzon

Member
Licensed 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
 
Top