Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Questions (Windows Mobile)
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Questions (Windows Mobile) Post any question regarding Basic4ppc.

Numeric Data Input Mask?

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-02-2007, 03:15 AM
Junior Member
 
Join Date: May 2007
Location: Norwich, NY
Posts: 13
Send a message via Skype™ to david
Default Numeric Data Input Mask?

Hi Erel,

I feel a little ridiculous asking this question, especially since I know that you are busy with the new release.

On the other hand, I have worked in a number of languages over the years (including early Java), where you could spend literally days trying to figure out how to restrict data in a text box to numeric input with a set number of positions before and after the decimal point.

My question then, is there a numeric mask that can be applied to a textBox (or some other control) that will allow me to create a numeric only data input field on the form. I know I can do it by testing each character, but I thought there might be a more elegant and simpler way of doing this.

Might the answer lie in one of the library dll's?

I have searched the forum, as well as the help files and I did not find any numeric masked data input information.

Please advise.

Thanks again for the great work.

Regards,

David
Reply With Quote
  #2 (permalink)  
Old 11-02-2007, 06:20 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 13,162
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

Maybe the attached code will solve your problem.
It is a numpad created of buttons.
I prefer it over the smaller SIP buttons for numeric input.
Attached Files
File Type: sbp Numpad.sbp (3.8 KB, 89 views)
Reply With Quote
  #3 (permalink)  
Old 11-03-2007, 03:47 PM
Junior Member
 
Join Date: May 2007
Location: Norwich, NY
Posts: 13
Send a message via Skype™ to david
Default Numeric Data Mask

Hi Erel,

Thanks for the quick reply.

Unfortunately, in my current application, screen space is in very short supply, so instead I resorted to the code that follows at the end of this message.

I broke the numeric field into two fields (one for an integer value and one for a decimal value). I ignore all the keys except numbers, escape, backspace, enter, delete, and the left and right arrow keys. That suits my functionality in this particular application. Also, I decided to split the field into integer and decimal with two text boxes, since I will be dealing with an unsophisticated user who will mostly only be entering integer values. I am sure the same procedure can be used with a decimal point in one field.

I know that many, if not most 4th generation languages do not come with a numeric masked field (in which you can specify numeric data, and specify the number of places before and after the decimal point). These fields, which also usually display zeros as the mask, often have to be purchased from third party tool makers. I know this was the case with Borland's Delphi and C++ Builder in the early days.

In any case, I would like to put a numeric masked data input field on my wish list for one of the future Basic4PPC versions.

The code I have constructed is somewhat crude. It suits the purpose now, and I will clean it up later, but for anyone interested here is the code for the integer portion of the input:
=========================
Sub txtQuantityInteger_KeyPress (key)
If key = Chr(27) Then ' The User Pressed The Escape Key
txtQuantityInteger.Text = ""
Return
End If
' Mask Keys Except For Numeric, BackSpace, Delete, Enter (And Arrow Keys By Program Default)
If key <> Chr(48) AND key <> Chr(49) AND key <> Chr(50) AND key <> Chr(51) AND key <> Chr(52) AND key <> Chr(53) AND key <> Chr(54) AND key <> Chr(55) AND key <> Chr(56) AND key <> Chr(57) AND key <> Chr(8) AND key <> Chr(13) AND key <> Chr(127) Then
txtQuantityInteger.IgnoreKey
End If
' Now Check For Length
Len = StrLength(txtQuantityInteger.Text)
If key <> Chr(8) AND Key <> Chr(13) AND Key <> Chr(127) AND Len >= 6 Then
txtQuantityInteger.IgnoreKey
End If
End Sub
============================

I have one final question (at least for the moment).

I am considering writing a rather large sales application using Basic4PPC and Sqlite. It will have many screens and at least seven or eight tables. Am I likely to run into any memory restrictions or other problems with the Basic4PPC compiler, or will my problems be restricted to the total memory available on the device?

Thanks for all your help and timely answers.

Regards,

David
P.S. The development for the new application, will be done in the desktop IDE.
Reply With Quote
  #4 (permalink)  
Old 11-03-2007, 04:04 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 13,162
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

There are no special restrictions except of the device memory.
The device IDE is limited to 64k of characters. The workaround for large projects is to split the code to several files.
It should not bother you if you work on the desktop.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Leading zero(s) for numeric or string type variable not saved in database. mozaharul Questions (Windows Mobile) 1 10-26-2008 05:18 PM
SIP Input leestevens Questions (Windows Mobile) 2 08-01-2008 04:00 PM
Numeric Data Mask - Using Regular Expressions david Questions (Windows Mobile) 2 01-04-2008 02:13 PM
Assign value (numeric) to combox's items? kyto Questions (Windows Mobile) 17 08-17-2007 09:57 PM
Numeric conversion limitation? agraham Bug Reports 5 07-06-2007 06:08 PM


All times are GMT. The time now is 02:44 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0