Hi all
Could anyone help me with coding a numeric keypad.
I wish to send numbers to several independant text boxes.
Any advise on how to start would be welcome.
thanks
Rob
Hello fraxinus,
3 weeks ago, i started a similar project. Enclosed is a part of my program
from the beginning, so it shows only the basics and certainly not the best programming, but it works. Important to me was to provide larger 'keys' or buttons for a quick input. Now i have all button on a panel for sliding several screens.
Thanks Klauss
Thanks to your tutorial I have got the numeric keypad up and running for entering numbers into a textbox and using the btnBS to clear numbers.
How can I add another text box and enter numbers there without losing the numbers already in the miles text box
thanks
Rob
sample text
Sub btnevent_click
Send = Sender
miles.text = miles.Text & Send.Tag
End Sub
Sub btn0_click
Select Send.tag
miles.Text = Send.Tag
End Select
End Sub
Sub btn1_click etc...etc
Sub btnBS_click
If miles.text.Length >0 Then
miles.Text = miles.Text.SubString2(0,miles.text.Length - 1)
End If
End Sub
If you set up a global variable (lets call it CurrentEdit) of type EditText, then in your EditText FocusChanged events, check the HasFocus flag, and if it is selected set CurrentEdit to the EditText.
Then you can use CurrentEdit in your keyboard input routine:
B4X:
Sub btnevent_click
Send = Sender
CurrentEdit.text = CurrentEdit.Text & Send.Tag
You will need to add some code to check that an EditText has been selected, but I will leave that for you!
Sorry but cant find hasfocus ?
Have tried requestfocus
i.e
If miles.requestfocus = true then
miles.text = miles.text & Send.Tag
Tried several of above with no luck so far.... isinitialized etc
If the EditText is part of a layout, in designer go to Tools menu and select "generate members".
From there you can generate the EditText_FocusChanged sub. This has the HasFocus flag.
So, when the focus has changed on the EditText, the EditText_FocusChanged sub is called, and you can check the HasFocus flag to see if the EditText has got or lost focus.