Re: How to test for a number

2005-03-16 Thread Ken Ray
On 3/16/05 3:44 PM, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:

> sez [EMAIL PROTECTED]:
>> I like that idea of:
>> 
>> on keydown tKey
>>  if tKey is a number then
>> pass keydown
>>  else
>>beep
>>  end if
>> end keydown
>> 
>> Is it ok to put it in the main stack rather then puting it just for
>> the fields.
>That depends on what you want the user to be able to do with the stack.
> Put that handler in the main stack script, and the user can NEVER type a
> non-numeral character into ANY field in that stack. Is that what you want? If
> you 
> want *some* fields to be number-restricted, while others are normal, you could
> put that handler into the script of the appropriate card(s). If the
> number-restricted fields are all part of the same group, you can put that
> handler into the 
> script of that group, and it will affect only the fields you want, while
> leaving everything else alone.

Better yet would be to assign a user property to those fields (like
"uNumbersOnly"), give it a value (like "true") and then check it in the
keydown handler, like:

on keydown tKey
  if the uNumbersOnly of the target = "true" then
if tKey is a number then
  pass keydown
else
 beep
end if
  else
pass keydown
  end if
end keydown

HTH,

Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: [EMAIL PROTECTED]


___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: How to test for a number

2005-03-16 Thread Cubist
sez [EMAIL PROTECTED]:
>I like that idea of:
>
>on keydown tKey
>  if tKey is a number then
> pass keydown
>  else
>beep
>  end if
>end keydown
>
>Is it ok to put it in the main stack rather then puting it just for
>the fields.
   That depends on what you want the user to be able to do with the stack. 
Put that handler in the main stack script, and the user can NEVER type a 
non-numeral character into ANY field in that stack. Is that what you want? If 
you 
want *some* fields to be number-restricted, while others are normal, you could 
put that handler into the script of the appropriate card(s). If the 
number-restricted fields are all part of the same group, you can put that 
handler into the 
script of that group, and it will affect only the fields you want, while 
leaving everything else alone.
   Hope this helps...
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


RE: How to test for a number

2005-03-16 Thread Rob Cozens

Awesome stuff Rob!
Thanks, Jonathan,
Mine was not that advanced.
The issue appears trivial at first; but when one examines the range of user 
errors possible (eg: "-" or currency symbols in mid number; thousand 
separators not four characters apart, out of sync with decimal position, or 
after the decimal), it gets to be more of a challenge.

The validNumber function evolved of some time, as I encountered each error 
type myself.

Rob Cozens, Staff Conservator
Mendonoma Marine Life Conservancy
P.O. Box 217
Manchester, CA 95459-0217
(707) 895-2584
"Like peace, the real work of saving the ocean is not only carried out in 
diplomatic chambers and government offices.  It is carried out in the 
hearts and hands of people.  People who think and act.  People who care."

-Anatoly Sagalevitch in "Saving the Oceans".  Editor Joseph MacInnis 

___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


RE: How to test for a number

2005-03-16 Thread MisterX
Sorry for coming in late in the test discussion...

My approach to this was to eleminate doubts 
regarding what format it was...

I've had many different occasions for this testing and
for lots of different log outputs from dos, emc tools,
copy tools, reskit tools, etc...

They all use different formats, exceptions, etc...

But in general it comes down to this...

function isanumber mynumber
  put char 2 of 3/2 into mydecimaldelimiter -- get the decimal

  -- eliminate thousands separators and other human crap

  if mydecimaldelimiter is comma then
replace "." with "" in mynumber
  else
replace "," with "" in mynumber
  end if
  put "'" into humancrap -- just one example of... ;)
  repeat for each char c in humancrap
replace c with "" in mynumber
  end repeat
  get mynumber is a number 
  return it
end isanumber

or

much simpler... and to avoid errors in handlers/functions
without a slower check if mynumber isanumber...

try
  get mathop(mynumber)
catch oops
  return "err:"&&oops -- or return 0, -1 or NAN or 
  -- whatever fruity human crap ;)
finally
return it
end try

OK, this is just for text. Styled text recognition would
have to be smarter...

I dont like registry checking because it's bound to change from
one windows version to the other.

Maybe an easier script would be to call a vbs script...
But im still trying to find an easy method to call them from
runrev... 

XOS has many testing routines for this to prevent human crap from
happening in the system's routines! ;)

Type of number/date/format checking, character, word, etc...

But it's not coming out very soon but at least there you have 
my basic laws of number checking ;)

cheers
Xavier


> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of 
> Thierry Arbellot
> Sent: Wednesday, March 16, 2005 17:37
> To: How to use Revolution
> Subject: Re: How to test for a number
> 
> On 2005, Mar 16, , at 17:28, Klaus Major wrote:
> 
> > Hi Jonathan,
> >
> >> Well, that brings up a possibility...
> >>
> >> Shouldn't there be a way to check for the system settings 
> (perhaps in 
> >> the registry) and adjust for that in the script?
> >
> > sounds good :-)
> >
> > Any hints on how to do this on win and a mac?
> >
> >
> > Regards
> >
> > Klaus Major
> > [EMAIL PROTECTED]
> > http://www.major-k.de
> >
> 
> some hints to get the local decimal separator
> 
> MacOS
> 
>  do "get item 2 of (1.1 as string)" as appleScript
>  put the result into theDecimalSeparator
>  replace quote with empty in theDecimalSeparator
> 
> Windows 2000/XP
> 
>  put queryRegistry("HKEY_CURRENT_USER\Control
> Panel\International\sMonDecimalSep") into theDecimalSeparator
> 
> Thierry
> 
> 
> ___
> use-revolution mailing list
> use-revolution@lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
> 

___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: How to test for a number

2005-03-16 Thread Klaus Major
Hi Thierry, Rob, Jonathan, Frank and all,
thanks a lot for your input, i surely will try all your cool solutions 
:-)

Regards
Klaus Major
[EMAIL PROTECTED]
http://www.major-k.de
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: How to test for a number

2005-03-16 Thread Thierry Arbellot
Oops, seems I'm wrong.
sMonDecimalSep specifies the symbol used to separate the decimal values  
in currency.

this page explains all registry keys:
http://www.microsoft.com/resources/documentation/Windows/2000/server/ 
reskit/en-us/Default.asp?url=/resources/documentation/Windows/2000/ 
server/reskit/en-us/regentry/69554.asp

On 2005, Mar 16, , at 17:53, Lynch, Jonathan wrote:
Is the registry key: sMonDecimalSep
Different from: sDecimal
?
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Thierry
Arbellot
Sent: Wednesday, March 16, 2005 11:37 AM
To: How to use Revolution
Subject: Re: How to test for a number
On 2005, Mar 16, , at 17:28, Klaus Major wrote:
Hi Jonathan,
Well, that brings up a possibility...
Shouldn't there be a way to check for the system settings (perhaps in
the registry) and adjust for that in the script?
sounds good :-)
Any hints on how to do this on win and a mac?
Regards
Klaus Major
[EMAIL PROTECTED]
http://www.major-k.de
some hints to get the local decimal separator
MacOS
 do "get item 2 of (1.1 as string)" as appleScript
 put the result into theDecimalSeparator
 replace quote with empty in theDecimalSeparator
Windows 2000/XP
 put queryRegistry("HKEY_CURRENT_USER\Control
Panel\International\sMonDecimalSep") into theDecimalSeparator
Thierry
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution

___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


RE: How to test for a number

2005-03-16 Thread Lynch, Jonathan
Is the registry key: sMonDecimalSep
Different from: sDecimal
?

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Thierry
Arbellot
Sent: Wednesday, March 16, 2005 11:37 AM
To: How to use Revolution
Subject: Re: How to test for a number

On 2005, Mar 16, , at 17:28, Klaus Major wrote:

> Hi Jonathan,
>
>> Well, that brings up a possibility...
>>
>> Shouldn't there be a way to check for the system settings (perhaps in
>> the registry) and adjust for that in the script?
>
> sounds good :-)
>
> Any hints on how to do this on win and a mac?
>
>
> Regards
>
> Klaus Major
> [EMAIL PROTECTED]
> http://www.major-k.de
>

some hints to get the local decimal separator

MacOS

 do "get item 2 of (1.1 as string)" as appleScript
 put the result into theDecimalSeparator
 replace quote with empty in theDecimalSeparator

Windows 2000/XP

 put queryRegistry("HKEY_CURRENT_USER\Control 
Panel\International\sMonDecimalSep") into theDecimalSeparator

Thierry


___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: How to test for a number

2005-03-16 Thread Rob Cozens
Hi Klaus,
Any hints on how to do this on win and a mac?
I gave up trying some time ago, and settled on my numberEditMask custom 
property + handler logic to open a dialog substack to set the property if 
it doesn't exist in the calling stack.

Transcript should be able to return the system number format just as it can 
return the system date format.

FYI, it's possible to determine the system date in xTalks by:
function systemDateFormat
  put "1999,1,9,0,0,0,0" into testDate
  convert testDate to short system date -- MC pads day/month regardless of 
settings
  put 2 into characterNumber
  repeat while char characterNumber of testDate is in "1,9"
add 1 to characterNumber
  end repeat
  put char characterNumber of testDate into dateSeparator
  put empty into returnDateFormat
  set the itemDelimiter to dateSeparator
  repeat for each item datePart in testDate
if datePart > 9 then
  if datePart > 99 then put "y" after returnDateFormat
  put "y" after returnDateFormat
else if datePart > 1 then
  if length(datePart) > 1 then put "d" after returnDateFormat
  put "d" after returnDateFormat
else
  if length(datePart) > 1 then put "m" after returnDateFormat
  put "m" after returnDateFormat
end if
  end repeat
  return returnDateFormat&dateSeparator
end systemDateFormat

If one could find a way to get a known numeric value from the system in 
system display format, this same logic could be used; but I never found one.

Rob Cozens CCW
Serendipity Software Company
"And I, which was two fooles, do so grow three;
 Who are a little wise, the best fooles bee."
 from "The Triple Foole" by John Donne (1572-1631) 

___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


RE: How to test for a number

2005-03-16 Thread Lynch, Jonathan
Awesome stuff Rob!

Mine was not that advanced.

It just allowed the permitted characters upon being typed in, then
checked to see if it is a valid number with the isnumber function on
closefield. If it was not a number, it emptied the field and told you to
try again.


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Rob Cozens
Sent: Wednesday, March 16, 2005 11:35 AM
To: How to use Revolution
Subject: RE: How to test for a number

Hi Jonathan,

>I have a field where I restrict it to only enter numbers...
>
>But I had to include extra script to allow the character to be a "." or
a 
>"-", in case the number included a decimal point or minus sign:
>
>On KeyDown theKey
>  If (isNumber(theKey) = true) or theKey = "." or theKey = "-" then

> pass keyDown
>End KeyDown

And you do check to see there is only one "." and/or "-" in the
character 
string, and that "-", if any, is char 1 or -1, right?

The following function is included in Serendipity Library 
<http://wecode.org/serendipity/>.

It checks for your issues and Klaus'; based on the contents of the
stack's 
numberEditMask custom property, which designates decimal & thousands 
separator characters, currency symbol (to three characters}, and
currency 
symbol placement (leading/trailing).

function validNumber theString,allowCurrency -- 08 Jan 04:RCC
   put (allowCurrency is true) into allowCurrency--defaults to false
   get the numberEditMask of this stack
   if it is empty then
 modal "Number Edit Mask"
 get the numberEditMask of this stack
 if it is empty then return sdbMessage(sdbNumberFormatError)
   end if
   put (char 1 of it is "<") into prefixCurrancy
   put char 2 to -1 of line 1 of it into currencyString
   put char 1 of line 2 of it into theDecimalSeparator
   put char 2 of line 2 of it into theThousandsSeparator
   put stripBlanks(theString,false) into strippedString
   put the length of strippedString into stringLength
   put 0 into periodPosition
   put 0 into characterNumber
   put empty into commaList
   put false into foundMinus
   repeat for each char theCharacter in theString
 add 1 to characterNumber
 if theCharacter is not in "0123456789-" and theCharacter is not 
theDecimalSeparator and theCharacter is not theThousandsSeparator and 
(theCharacter is not in currencyString or not allowCurrency) then return
false
 if theCharacter is "-" then
   if foundMinus or (characterNumber <> 1 and (characterNumber <> 
(length(currencyString)+1) or not allowCurrency or not prefixCurrency)) 
then return false
   put true into foundMinus
 end if
 if theCharacter is in currencyString then
   if not allowCurrency then return false
   if prefixCurrency then
 if characterNumber > length(currencyString) or 
offset(currencyString,theString) <> 1 then
   return false
 end if
   else if offset(currencyString,theString) <> 
(length(theString)-length(currencyString)+1) then return false
 end if
 if theCharacter is theThousandsSeparator then
   if periodPosition is not 0 or characterNumber is 1 then return
false
   else put characterNumbe&return after commaList
 end if
 if theCharacter is theDecimalSeparator then put characterNumber
into 
periodPosition
   end repeat
   if commaList is empty then return true
   if periodPosition is 0 then put stringLength+1 into periodPosition
   repeat with x = number of lines of commaList down to 1
 get (line x of commaList+0)
 if periodPosition - it <> 4 then return false
 subtract 4 from periodPosition
   end repeat
   return true
end validNumber

The Library includes other handlers to strip the thousand separators and

force the decimal separator to "." for numeric manipulation and convert 
calculation results for localized display.

Rob Cozens, CCW
Serendipity Software Co.

"First they ignore you.
Then they laugh at you.
Then they fight you.
Then you win."

-- Gandhi

___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


RE: How to test for a number

2005-03-16 Thread Lynch, Jonathan
On a Mac I've nary a clue...

But on Windows, looking through the registry...

In:
HKEY_CURRENT_USER\Control Panel\International

There is a key called:  sThousand
Its setting on my computer is "," - I bet on a German machine it would
say "."

There is another key called:   sDecimal
Its setting on my computer is "."

You could get the value of these keys with a shell command.


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Klaus
Major
Sent: Wednesday, March 16, 2005 11:28 AM
To: How to use Revolution
Subject: Re: How to test for a number

Hi Jonathan,

> Well, that brings up a possibility...
>
> Shouldn't there be a way to check for the system settings (perhaps in
> the registry) and adjust for that in the script?

sounds good :-)

Any hints on how to do this on win and a mac?


Regards

Klaus Major
[EMAIL PROTECTED]
http://www.major-k.de

___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


RE: How to test for a number

2005-03-16 Thread Robert Brenstein
Well, that brings up a possibility...
Shouldn't there be a way to check for the system settings (perhaps in
the registry) and adjust for that in the script?
Ya, I was thinking for a while that may be Rev should have a Gestalt 
function. Those familiar with Mac OS Toobox will know that it is a 
function that takes a keyword and returns appropriate value, be it 
some hardware characteristic or some system setting. The list of 
keywords could be OS-specific, with some keywords working for all, 
and returning empty if not applicable or not defined.

We already have specialPaths function which does basically that but 
only for system-related paths. Gestalt could be its generic 
equivalent, allowing RR to add keywords as needed or requested by 
users.

Robert
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: How to test for a number

2005-03-16 Thread Thierry Arbellot
On 2005, Mar 16, , at 17:28, Klaus Major wrote:
Hi Jonathan,
Well, that brings up a possibility...
Shouldn't there be a way to check for the system settings (perhaps in
the registry) and adjust for that in the script?
sounds good :-)
Any hints on how to do this on win and a mac?
Regards
Klaus Major
[EMAIL PROTECTED]
http://www.major-k.de
some hints to get the local decimal separator
MacOS
do "get item 2 of (1.1 as string)" as appleScript
put the result into theDecimalSeparator
replace quote with empty in theDecimalSeparator
Windows 2000/XP
put queryRegistry("HKEY_CURRENT_USER\Control 
Panel\International\sMonDecimalSep") into theDecimalSeparator

Thierry
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


RE: How to test for a number

2005-03-16 Thread Rob Cozens
Hi Jonathan,
I have a field where I restrict it to only enter numbers...
But I had to include extra script to allow the character to be a "." or a 
"-", in case the number included a decimal point or minus sign:

On KeyDown theKey
 If (isNumber(theKey) = true) or theKey = "." or theKey = "-" then 
pass keyDown
End KeyDown
And you do check to see there is only one "." and/or "-" in the character 
string, and that "-", if any, is char 1 or -1, right?

The following function is included in Serendipity Library 
.

It checks for your issues and Klaus'; based on the contents of the stack's 
numberEditMask custom property, which designates decimal & thousands 
separator characters, currency symbol (to three characters}, and currency 
symbol placement (leading/trailing).

function validNumber theString,allowCurrency -- 08 Jan 04:RCC
  put (allowCurrency is true) into allowCurrency--defaults to false
  get the numberEditMask of this stack
  if it is empty then
modal "Number Edit Mask"
get the numberEditMask of this stack
if it is empty then return sdbMessage(sdbNumberFormatError)
  end if
  put (char 1 of it is "<") into prefixCurrancy
  put char 2 to -1 of line 1 of it into currencyString
  put char 1 of line 2 of it into theDecimalSeparator
  put char 2 of line 2 of it into theThousandsSeparator
  put stripBlanks(theString,false) into strippedString
  put the length of strippedString into stringLength
  put 0 into periodPosition
  put 0 into characterNumber
  put empty into commaList
  put false into foundMinus
  repeat for each char theCharacter in theString
add 1 to characterNumber
if theCharacter is not in "0123456789-" and theCharacter is not 
theDecimalSeparator and theCharacter is not theThousandsSeparator and 
(theCharacter is not in currencyString or not allowCurrency) then return false
if theCharacter is "-" then
  if foundMinus or (characterNumber <> 1 and (characterNumber <> 
(length(currencyString)+1) or not allowCurrency or not prefixCurrency)) 
then return false
  put true into foundMinus
end if
if theCharacter is in currencyString then
  if not allowCurrency then return false
  if prefixCurrency then
if characterNumber > length(currencyString) or 
offset(currencyString,theString) <> 1 then
  return false
end if
  else if offset(currencyString,theString) <> 
(length(theString)-length(currencyString)+1) then return false
end if
if theCharacter is theThousandsSeparator then
  if periodPosition is not 0 or characterNumber is 1 then return false
  else put characterNumbe&return after commaList
end if
if theCharacter is theDecimalSeparator then put characterNumber into 
periodPosition
  end repeat
  if commaList is empty then return true
  if periodPosition is 0 then put stringLength+1 into periodPosition
  repeat with x = number of lines of commaList down to 1
get (line x of commaList+0)
if periodPosition - it <> 4 then return false
subtract 4 from periodPosition
  end repeat
  return true
end validNumber

The Library includes other handlers to strip the thousand separators and 
force the decimal separator to "." for numeric manipulation and convert 
calculation results for localized display.

Rob Cozens, CCW
Serendipity Software Co.
"First they ignore you.
Then they laugh at you.
Then they fight you.
Then you win."
-- Gandhi
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: How to test for a number

2005-03-16 Thread Klaus Major
Hi Jonathan,
Well, that brings up a possibility...
Shouldn't there be a way to check for the system settings (perhaps in
the registry) and adjust for that in the script?
sounds good :-)
Any hints on how to do this on win and a mac?
Regards
Klaus Major
[EMAIL PROTECTED]
http://www.major-k.de
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


RE: How to test for a number

2005-03-16 Thread Lynch, Jonathan
Well, that brings up a possibility...

Shouldn't there be a way to check for the system settings (perhaps in
the registry) and adjust for that in the script?

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Klaus
Major
Sent: Wednesday, March 16, 2005 11:16 AM
To: How to use Revolution
Subject: Re: How to test for a number

Hi Jonathan,

> Hi Klaus...
>
> Heh - the comma brings up another point.
>
> People often separate every third digit before the decimal with a 
> comma!
> (not sure how this is done in German)
>
> For example:
> 1,634,912.34
>
> So commas would need to be allowed, and then replace "," with empty
> would need to be used when working with the actual number...
>
> Which could really create a problem in having the program compatable 
> for
> both English use and German use!

EXACTLY!

We use it vice versa here in germany :-)

We use the comma as the decimal separator and the dot as a "thousand" 
separator!

e.g.
1.234.567,98

THAT will make it impossible to have an app that will handle both, 
english and german use...
Too bad! OK, we could have the user set this in the prefs, but still 
clumsy...

If only Rev would use the system settings for numbers (like other apps 
do ;-)


Regards

Klaus Major
[EMAIL PROTECTED]
http://www.major-k.de

___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: How to test for a number

2005-03-16 Thread Frank D. Engel, Jr.
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
One more thing to look out for: international characters are typically 
not fed to the keyDown handler.  On a Mac, try typing something like 
Option-8 (on Windows, it's ALT+ a 3-digit number on the numeric 
keypad), and it will typically get through to the field.  To prevent 
this, you need this as well:

on optionKeyDown
end optionKeyDown
On Mar 16, 2005, at 11:15 AM, Klaus Major wrote:
Hi Jonathan,
Hi Klaus...
Heh - the comma brings up another point.
People often separate every third digit before the decimal with a 
comma!
(not sure how this is done in German)

For example:
1,634,912.34
So commas would need to be allowed, and then replace "," with empty
would need to be used when working with the actual number...
Which could really create a problem in having the program compatable 
for
both English use and German use!
EXACTLY!
We use it vice versa here in germany :-)
We use the comma as the decimal separator and the dot as a "thousand" 
separator!

e.g.
1.234.567,98
THAT will make it impossible to have an app that will handle both, 
english and german use...
Too bad! OK, we could have the user set this in the prefs, but still 
clumsy...

If only Rev would use the system settings for numbers (like other apps 
do ;-)

Regards
Klaus Major
[EMAIL PROTECTED]
http://www.major-k.de
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution

- ---
Frank D. Engel, Jr.  <[EMAIL PROTECTED]>
$ ln -s /usr/share/kjvbible /usr/manual
$ true | cat /usr/manual | grep "John 3:16"
John 3:16 For God so loved the world, that he gave his only begotten 
Son, that whosoever believeth in him should not perish, but have 
everlasting life.
$
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.4 (Darwin)

iD8DBQFCOFz+7aqtWrR9cZoRAk/6AJ0a9tQ4jqhV6Fpl7CWo9WjsoN96PACeIlgW
uq2Oulpn0DAOOK/J28pZWAc=
=L6tn
-END PGP SIGNATURE-

___
$0 Web Hosting with up to 120MB web space, 1000 MB Transfer
10 Personalized POP and Web E-mail Accounts, and much more.
Signup at www.doteasy.com
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: How to test for a number

2005-03-16 Thread Klaus Major
Hi Jonathan,
Hi Klaus...
Heh - the comma brings up another point.
People often separate every third digit before the decimal with a 
comma!
(not sure how this is done in German)

For example:
1,634,912.34
So commas would need to be allowed, and then replace "," with empty
would need to be used when working with the actual number...
Which could really create a problem in having the program compatable 
for
both English use and German use!
EXACTLY!
We use it vice versa here in germany :-)
We use the comma as the decimal separator and the dot as a "thousand" 
separator!

e.g.
1.234.567,98
THAT will make it impossible to have an app that will handle both, 
english and german use...
Too bad! OK, we could have the user set this in the prefs, but still 
clumsy...

If only Rev would use the system settings for numbers (like other apps 
do ;-)

Regards
Klaus Major
[EMAIL PROTECTED]
http://www.major-k.de
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


RE: How to test for a number

2005-03-16 Thread Lynch, Jonathan
Hi Klaus...

Heh - the comma brings up another point.

People often separate every third digit before the decimal with a comma!
(not sure how this is done in German)

For example:
1,634,912.34

So commas would need to be allowed, and then replace "," with empty
would need to be used when working with the actual number...

Which could really create a problem in having the program compatable for
both English use and German use!

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Klaus
Major
Sent: Wednesday, March 16, 2005 11:00 AM
To: How to use Revolution
Subject: Re: How to test for a number

Hi Jonathan,

> I have a field where I restrict it to only enter numbers...
>
> But I had to include extra script to allow the character to be a "." 
> or a "-", in case the number included a decimal point or minus sign:
>
> On KeyDown theKey
>  If (isNumber(theKey) = true) or theKey = "." or theKey = "-" then

> pass keyDown
> End KeyDown

ah, yes, sure...

But we non english speaking users do have another problem!

We use the "," (Comma) as a decimal separator, so we have to do some 
extra
work before we can compute some values... :-(

If somone is interested, i use these 2 little functions to do the 
conversations before
computing and displaying the result again:

function ohnekomma was
## german for without comma :-)
replace "," with "." in was
return was
end ohnekomma

And back:

function mitkomma was
## german for with comma :-)
replace "." with "," in was
return was
end ohnekomma

So i can:
...
put mitkomma((ohnekomma(fld 1) * 12)) into fld "result"
...


Or a bit more readable ;-)
...
put ohnekomma(fld 1) into mynumber1
put mynumber * 12 into myresult
put mitkomma(myresult) into fld "result"
...


Regards

Klaus Major
[EMAIL PROTECTED]
http://www.major-k.de

___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: How to test for a number

2005-03-16 Thread Kevin J
I like that idea of:

on keydown tKey
  if tKey is a number then
 pass keydown
  else
beep
  end if
end keydown

Is it ok to put it in the main stack rather then puting it just for
the fields. I did it and it seems to work fine. Plus when ever you
don't put anything in the field you will still get the normal warrning
that you need to put a number in it. I have included a standalone and
the source if anyone would like to look at it. This is the first
program I have finished it might be small and simple but it works lol.

http://www.lotheria.com/Simplecalc.zip

On Wed, 16 Mar 2005 10:42:27 -0500, Lynch, Jonathan <[EMAIL PROTECTED]> wrote:
> I have a field where I restrict it to only enter numbers...
> 
> But I had to include extra script to allow the character to be a "." or a 
> "-", in case the number included a decimal point or minus sign:
> 
> On KeyDown theKey
>  If (isNumber(theKey) = true) or theKey = "." or theKey = "-" then pass 
> keyDown
> End KeyDown
> 
> 
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Klaus Major
> Sent: Wednesday, March 16, 2005 10:37 AM
> To: Kevin J; How to use Revolution
> Subject: Re: How to test for a number
> 
> Hi Kevin,
> 
> > How do you make an If check to check to see if a user has entered a
> > number and not a letter?
> > I can stop it from doing a divide by 0 doing this:
> >
> > on mouseUp
> > put field"num1" into tAdd
> > put field"num2" into tAdd2
> >   if tAdd2 is 0 then
> > answer "You can't divide by 0"
> >   else
> > put tAdd/tAdd2 into field"sum"
> > end if
> > end mouseUp
> 
> well, check "if add2 is a number" :-)
> 
> on mouseUp
> put field"num1" into tAdd
> put field"num2" into tAdd2
> if tAdd2 is 0 then
>answer "You can't divide by 0"
>exit mouseup
> end if
> if tAdd2 is a number then
>put tAdd/tAdd2 into field"sum"
> else
>answer "*##+[Â]|âÂÂ"
>## Or something more meaningful :-)
> end if
> end mouseUp
> 
> But you can also restrict your field to only allow numbers!
> 
> Put this into the script of your field:
> 
> on keydown tKey
>if tKey is a number then
>   pass keydown
>else
>  beep
>end if
> end keydown
> 
> This way only numbers can be entered into that field...
> 
> Hope that helps.
> 
> > Thanks
> >
> > Kevin
> 
> Regards
> 
> Klaus Major
> [EMAIL PROTECTED]
> http://www.major-k.de
> 
> ___
> use-revolution mailing list
> use-revolution@lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
> 
> 
> ___
> use-revolution mailing list
> use-revolution@lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
> 
> 
>
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: How to test for a number

2005-03-16 Thread Klaus Major
Hi Jonathan,
I have a field where I restrict it to only enter numbers...
But I had to include extra script to allow the character to be a "." 
or a "-", in case the number included a decimal point or minus sign:

On KeyDown theKey
 If (isNumber(theKey) = true) or theKey = "." or theKey = "-" then 
pass keyDown
End KeyDown
ah, yes, sure...
But we non english speaking users do have another problem!
We use the "," (Comma) as a decimal separator, so we have to do some 
extra
work before we can compute some values... :-(

If somone is interested, i use these 2 little functions to do the 
conversations before
computing and displaying the result again:

function ohnekomma was
## german for without comma :-)
   replace "," with "." in was
   return was
end ohnekomma
And back:
function mitkomma was
## german for with comma :-)
   replace "." with "," in was
   return was
end ohnekomma
So i can:
...
put mitkomma((ohnekomma(fld 1) * 12)) into fld "result"
...
Or a bit more readable ;-)
...
put ohnekomma(fld 1) into mynumber1
put mynumber * 12 into myresult
put mitkomma(myresult) into fld "result"
...
Regards
Klaus Major
[EMAIL PROTECTED]
http://www.major-k.de
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


RE: How to test for a number

2005-03-16 Thread Lynch, Jonathan
I have a field where I restrict it to only enter numbers...

But I had to include extra script to allow the character to be a "." or a "-", 
in case the number included a decimal point or minus sign:

On KeyDown theKey
 If (isNumber(theKey) = true) or theKey = "." or theKey = "-" then pass 
keyDown
End KeyDown


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Klaus Major
Sent: Wednesday, March 16, 2005 10:37 AM
To: Kevin J; How to use Revolution
Subject: Re: How to test for a number

Hi Kevin,

> How do you make an If check to check to see if a user has entered a
> number and not a letter?
> I can stop it from doing a divide by 0 doing this:
>
> on mouseUp
> put field"num1" into tAdd
> put field"num2" into tAdd2
>   if tAdd2 is 0 then
> answer "You can't divide by 0"
>   else
> put tAdd/tAdd2 into field"sum"
> end if
> end mouseUp

well, check "if add2 is a number" :-)

on mouseUp
put field"num1" into tAdd
put field"num2" into tAdd2
if tAdd2 is 0 then
   answer "You can't divide by 0"
   exit mouseup
end if
if tAdd2 is a number then
   put tAdd/tAdd2 into field"sum"
else
   answer "*##+[Â]|âÂÂâ
   ## Or something more meaningful :-)
end if
end mouseUp

But you can also restrict your field to only allow numbers!

Put this into the script of your field:

on keydown tKey
   if tKey is a number then
  pass keydown
   else
 beep
   end if
end keydown

This way only numbers can be entered into that field...

Hope that helps.

> Thanks
>
> Kevin

Regards

Klaus Major
[EMAIL PROTECTED]
http://www.major-k.de

___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: How to test for a number

2005-03-16 Thread Klaus Major
Hi Kevin,
How do you make an If check to check to see if a user has entered a
number and not a letter?
I can stop it from doing a divide by 0 doing this:
on mouseUp
put field"num1" into tAdd
put field"num2" into tAdd2
  if tAdd2 is 0 then
answer "You can't divide by 0"
  else
put tAdd/tAdd2 into field"sum"
end if
end mouseUp
well, check "if add2 is a number" :-)
on mouseUp
   put field"num1" into tAdd
   put field"num2" into tAdd2
   if tAdd2 is 0 then
  answer "You can't divide by 0"
  exit mouseup
   end if
   if tAdd2 is a number then
  put tAdd/tAdd2 into field"sum"
   else
  answer "*##+[¢]|≠¿¿“
  ## Or something more meaningful :-)
   end if
end mouseUp
But you can also restrict your field to only allow numbers!
Put this into the script of your field:
on keydown tKey
  if tKey is a number then
 pass keydown
  else
beep
  end if
end keydown
This way only numbers can be entered into that field...
Hope that helps.
Thanks
Kevin
Regards
Klaus Major
[EMAIL PROTECTED]
http://www.major-k.de
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


RE: How to test for a number

2005-03-16 Thread Lynch, Jonathan
If isNumber(tAdd) = false then...

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Kevin J
Sent: Wednesday, March 16, 2005 10:28 AM
To: rev
Subject: How to test for a number

How do you make an If check to check to see if a user has entered a
number and not a letter?
I can stop it from doing a divide by 0 doing this:

on mouseUp
put field"num1" into tAdd
put field"num2" into tAdd2
  if tAdd2 is 0 then
answer "You can't divide by 0"
  else
put tAdd/tAdd2 into field"sum"
end if
end mouseUp

Thanks

Kevin
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


How to test for a number

2005-03-16 Thread Kevin J
How do you make an If check to check to see if a user has entered a
number and not a letter?
I can stop it from doing a divide by 0 doing this:

on mouseUp
put field"num1" into tAdd
put field"num2" into tAdd2
  if tAdd2 is 0 then
answer "You can't divide by 0"
  else
put tAdd/tAdd2 into field"sum"
end if
end mouseUp

Thanks

Kevin
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution