Limiting what can be put into an Edit text box

46 views
Skip to first unread message

RhodriC

unread,
May 16, 2013, 11:46:11 AM5/16/13
to MapInfo-L
Is there a way to specify that an Edit Text box can only recieve input
from certain charicters (just as numbers)

I know it would be perfectly possible to make a sub to verify what has
been put into the text box is numeric values, but stopping the user
from putting non-numerics in in the first place would be ideal.

My current code for the dialog box looks like this

Dialog
Title "Geo-coding Rasters"
Control StaticText
Title "Horizontal Distance of Map (meters)"
Position 10, 10
Control EditText 'EditText Box
Position 130, 10
ID 23
Control StaticText
Title "Vertical Distance of Map (meters)"
Position 10, 30
Control EditText 'EditText Box
Position 130, 30
ID 25
Control Button 'Button "Choose File"
Title "Open File"
Width 40 Height 20
ID 24
calling fileInfoBox
End Sub

With ReadControlValue() functions later on to get the value of the
inputs.

Thanks in advance

Rhodri

Bill Thoen

unread,
May 16, 2013, 2:25:39 PM5/16/13
to mapi...@googlegroups.com
I don't believe there's anything in the edittext control's callback
functions like "onChange()". You could do this through Windows APIs though.



Tony Pilkington

unread,
May 17, 2013, 6:58:26 AM5/17/13
to mapi...@googlegroups.com
A slightly different approach is to create a numeric keyboard dialog. The
downside is that you have to mouse-click numbers, the upside is no apis and
total control over what numbers etc you want to use.

A sample is attached.

Tony
--
--
You received this message because you are subscribed to the
Google Groups "MapInfo-L" group.To post a message to this group, send
email to mapi...@googlegroups.com
To unsubscribe from this group, go to:
http://groups.google.com/group/mapinfo-l/subscribe?hl=en
For more options, information and links to MapInfo resources (searching
archives, feature requests, to visit our Wiki, visit the Welcome page at
http://groups.google.com/group/mapinfo-l?hl=en

---
You received this message because you are subscribed to the Google Groups
"MapInfo-L" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to mapinfo-l+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




-----
No virus found in this message.
Checked by AVG - www.avg.com
Version: 2013.0.3336 / Virus Database: 3162/6329 - Release Date: 05/16/13
Keypad.MB

Thomas Bacon

unread,
May 17, 2013, 7:31:28 AM5/17/13
to mapi...@googlegroups.com
Hi All,

Does anyone know where the fill patterns for MapInfo are now held (in v11). They used to be in the mires.dll file, but don't appear to be there anymore. I need to add some custom fills on a colleagues computer and not having much luck at the moment!

Thanks!

Tom Bacon
GIS Engineer, Mouchel
T 01444 472380 │ E thomas...@mouchel.com │ W www.mouchel.com
Our values: innovation │ excellence │ integrity │ responsibility
Mouchel Limited (Mouchel) is registered in England and Wales with registered number 01686040 at Export House, Cawsey Way, Woking, Surrey, UK, GU21 6QX. The information in this e-mail is confidential and may be legally privileged. It is intended solely for the addressee. Access to this email by anyone else is unauthorised. Any views or opinions expressed in this e-mail may be solely those of the author and are not necessarily those of Mouchel. No contracts may be concluded on behalf of Mouchel by means of email communications. Mouchel reserves the right to monitor and intercept emails sent and received on our network.

Peter Horsbøll Møller

unread,
May 17, 2013, 7:33:21 AM5/17/13
to mapi...@googlegroups.com
Nice approach, Tony!

Could that be extended with the use of Alt keys, so that the user could enter the numbers by holding down the Alt and typing the numbers?

Peter Horsbøll Møller

Fra: Tony Pilkington
Sendt: ‎17-‎05-‎2013 12:58
Til: mapi...@googlegroups.com
Emne: Re: [MI-L] Limiting what can be put into an Edit text box

Peter Horsbøll Møller

unread,
May 17, 2013, 8:37:41 AM5/17/13
to mapi...@googlegroups.com
If you add an "&" in front of the text on the buttons, you can use Alt + the text on the button to active the button.
And so you don't need the mouse. You just have to hold down the Alt key and press the key you want.

Peter Horsbøll Møller
Pitney Bowes Software



To: mapi...@googlegroups.com
From: pe...@horsboll-moller.dk
Subject: SV: [MI-L] Limiting what can be put into an Edit text box
Date: Fri, 17 May 2013 13:33:21 +0200


Nice approach, Tony!

Could that be extended with the use of Alt keys, so that the user could enter the numbers by holding down the Alt and typing the numbers?

Peter Horsbøll Møller

Fra: Tony Pilkington
Sendt: 17-05-2013 12:58

Til: mapi...@googlegroups.com
Emne: Re: [MI-L] Limiting what can be put into an Edit text box

Tony Pilkington

unread,
May 18, 2013, 7:08:09 AM5/18/13
to mapi...@googlegroups.com
Thanks Peter, I’ve tweaked the code to deal with ALT keyins; however I had to change the +/- sign to a – sign to use the ALT form.
I’ve also added a reset and return0 button, as well as adding a statictext item at the top to allow a note from the user to be displayed.
 
To get round the problem of underbars added by pressing the ALT key making some of the buttons difficult to read; especially the . and – buttons, I have added a full set of numeric keys and  ‘. < and –’ as hidden keys below the equivalent (no &s) keypad keys. There are still odd problems with the ALT format but the keys are far more legible.
 
Tony
 
'
'    Code to create and manage a data input dialog. Both mouse click and ALT+ key is supported.
'    It is restricted to:    Numerals 0-9
'                            Decimal point "."
'                            Minus sign "-" is used to change sign
'                            Less Than "<" is used to delete the last character
'
'    The dialog routine is declared as:
'    declare function numeric_keypad(byval h as string) as float 'h is string such as "X Distance"
'    The note string is shown as a static text at the top of the keypad.
'    The current input value is shown as a statictext control
'    The return value is converted to float format.
'    Users can use the ALT Key with the keyboard or click on characters
 
'    It is supported by sub keyin
'    It needs a module wide string t_string that is used in the dialog and support code routines.
'    (dim t_string as string ' t_string is used to store data that is common to all the modules.)
'

No virus found in this message.
Checked by AVG - www.avg.com

Version: 2013.0.3336 / Virus Database: 3162/6330 - Release Date: 05/16/13

ALT_Keypad.MB
Reply all
Reply to author
Forward
0 new messages