Numeric Keypad

fraxinus

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

fraxinus

Member
Licensed User
Longtime User
Erel
Yes I've used the internal keyboard O.K but I thought the app I am designing
would look better with a numeric keyboard of its own on screen.
Rob
 
Upvote 0

oldman

New Member
Licensed User
Longtime User
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.
 

Attachments

  • numkeypad.zip
    2.8 KB · Views: 489
Upvote 0

fraxinus

Member
Licensed User
Longtime User
Numeric Keyboard

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
 
Upvote 0

kickaha

Well-Known Member
Licensed User
Longtime User
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!
 
Upvote 0

fraxinus

Member
Licensed User
Longtime User
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
 
Upvote 0

kickaha

Well-Known Member
Licensed User
Longtime User
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.
 
Upvote 0

kickaha

Well-Known Member
Licensed User
Longtime User
I have put together a little program to illustrate,have a look and a play :)
 

Attachments

  • focus.zip
    5.9 KB · Views: 357
Upvote 0

fraxinus

Member
Licensed User
Longtime User
KickaHa

Sorry I'm still not with it.
I generated members as you said, but my brain (don't say it for another welshman)is somewhere else today.
 
Upvote 0

kickaha

Well-Known Member
Licensed User
Longtime User
Have you had a look at the example (now on the previous page).

Oh, I am NOT a Welshman - Manchester born. So where are you from (or where you to in welshspeak)?
 
Upvote 0

fraxinus

Member
Licensed User
Longtime User
Thanks Kickaha it was that hasfocus I could not get. I'll work on app tomorrow and let you know how I get on. I'm from Swansea.
thanks again
Rob
 
Upvote 0
Top