David S Member Licensed User Longtime User Nov 26, 2014 #1 I've been trying to control the way decimal numbers are input and displayed with the EditText control (input type decimal), but I am pretty unhappy with the result. It's difficult to get the keyboard to pre-open. Selecting all the text does not help. Setting the cursor at the end of the text works only once when focus is changed or text is changed. If you tap anywhere on the number more than once that is where the cursor ends up. Oh, and even though I have the FORCE DONE parameter set to FALSE, the keyboard still displays DONE instead of NEXT. I do know of a simple program with flawless control of decimal numbers. Its called TipMe and he/she/they did a great job on this well done Tip program. I love the way the amounts are input. Here is a MP4 video of it: https://www.dropbox.com/s/y83ejonjgcmokxq/MotoX_Capture TipMe.mp4?dl=0 The only way I can figure out to do the same in B4A is to have a label next to a very narrow edittext view with a width of 1 or 2. As the user inputs a character you update the preceding label's text from right to left. Does anyone else know how to emulate the way the TipMe programs handles amounts? Thanks!, David Last edited: May 21, 2015
I've been trying to control the way decimal numbers are input and displayed with the EditText control (input type decimal), but I am pretty unhappy with the result. It's difficult to get the keyboard to pre-open. Selecting all the text does not help. Setting the cursor at the end of the text works only once when focus is changed or text is changed. If you tap anywhere on the number more than once that is where the cursor ends up. Oh, and even though I have the FORCE DONE parameter set to FALSE, the keyboard still displays DONE instead of NEXT. I do know of a simple program with flawless control of decimal numbers. Its called TipMe and he/she/they did a great job on this well done Tip program. I love the way the amounts are input. Here is a MP4 video of it: https://www.dropbox.com/s/y83ejonjgcmokxq/MotoX_Capture TipMe.mp4?dl=0 The only way I can figure out to do the same in B4A is to have a label next to a very narrow edittext view with a width of 1 or 2. As the user inputs a character you update the preceding label's text from right to left. Does anyone else know how to emulate the way the TipMe programs handles amounts? Thanks!, David
Erel B4X founder Staff member Licensed User Longtime User Nov 26, 2014 #2 You can use CallSubDelayed to move the cursor to the end of the string. Upvote 0
David S Member Licensed User Longtime User May 19, 2015 #3 Erel said: You can use CallSubDelayed to move the cursor to the end of the string. Click to expand... Thanks Erel for the reply. I had put this down for a while and I am just getting back to it. So you mean I should create a sub where I set the cursor to the last position? CallSubDelayed(inputAmtEditText, PositionCursorToEndOfField) I am trying to understand when I should use the CallSubdelayed. Is there a rule of thumb? Maybe the rule is never use CallSub when a control... opps.... I mean "view" .... is involved? Upvote 0
Erel said: You can use CallSubDelayed to move the cursor to the end of the string. Click to expand... Thanks Erel for the reply. I had put this down for a while and I am just getting back to it. So you mean I should create a sub where I set the cursor to the last position? CallSubDelayed(inputAmtEditText, PositionCursorToEndOfField) I am trying to understand when I should use the CallSubdelayed. Is there a rule of thumb? Maybe the rule is never use CallSub when a control... opps.... I mean "view" .... is involved?
Erel B4X founder Staff member Licensed User Longtime User May 19, 2015 #4 Many views related events are raised during a view related process. Calling CallSubDelayed allows you to execute the code at the end of the process. This is usually useful with focus changes events. Upvote 0
Many views related events are raised during a view related process. Calling CallSubDelayed allows you to execute the code at the end of the process. This is usually useful with focus changes events.
David S Member Licensed User Longtime User May 21, 2015 #5 Added a video link showing just how right to left decimal input should work. So far I it's been a struggle getting it to work. I am going to try the CallSubDelayed https://www.dropbox.com/s/y83ejonjgcmokxq/MotoX_Capture TipMe.mp4?dl=0 Upvote 0
Added a video link showing just how right to left decimal input should work. So far I it's been a struggle getting it to work. I am going to try the CallSubDelayed https://www.dropbox.com/s/y83ejonjgcmokxq/MotoX_Capture TipMe.mp4?dl=0
klaus Expert Licensed User Longtime User May 22, 2015 #6 Attached you find a small project showing a solution. It uses Labels to show the data instead of EditText views and a custom keyboard instead of the internal keyboard. Feel free to adapt it to your requirements. Attachments DecimalInput.zip DecimalInput.zip 13.4 KB · Views: 383 Upvote 0
Attached you find a small project showing a solution. It uses Labels to show the data instead of EditText views and a custom keyboard instead of the internal keyboard. Feel free to adapt it to your requirements.
David S Member Licensed User Longtime User May 28, 2015 #7 klaus said: Attached you find a small project showing a solution. It uses Labels to show the data instead of EditText views and a custom keyboard instead of the internal keyboard. Feel free to adapt it to your requirements. Click to expand... Thanks ! i'll look it over... I did use labels to, but wasn't using a custom keyboard. Upvote 0
klaus said: Attached you find a small project showing a solution. It uses Labels to show the data instead of EditText views and a custom keyboard instead of the internal keyboard. Feel free to adapt it to your requirements. Click to expand... Thanks ! i'll look it over... I did use labels to, but wasn't using a custom keyboard.