StringRequest(): #NUMERICAL troubles
Posted: Sun Aug 08, 2021 11:59 am
There is some strange behaviour concerning SystemRequest() of type = #NUMERICAL and RapaGUI. Please have look at the following examples:
Script 1:
Script 2 (only difference ist the missing RapaGUI requirement):
Test-Results:
Windows:
Cheers, Michael
Script 1:
Code: Select all
@REQUIRE "RapaGUI", { Link = True }
Local ret$, ok = StringRequest("Current syntax", "You should only be able to enter numercial characters:", { type = #NUMERICAL })
If ok
SystemRequest("Your input", ret$, "OK")
EndIf
ret$, ok = StringRequest("Deprecated syntax", "You should only be able to enter numercial characters:", "", #NUMERICAL)
If ok
SystemRequest("Your input", ret$, "OK")
EndIfCode: Select all
Local ret$, ok = StringRequest("Current syntax", "You should only be able to enter numercial characters:", { type = #NUMERICAL })
If ok
SystemRequest("Your input", ret$, "OK")
EndIf
ret$, ok = StringRequest("Deprecated syntax", "You should only be able to enter numercial characters:", "", #NUMERICAL)
If ok
SystemRequest("Your input", ret$, "OK")
EndIfWindows:
- Script 1: type = #NUMERICAL is ignored
- Script 2: works as expected: only 0-9 can be entered plus 0 or 1 dot as decimal separator
- Script 1: type = #NUMERICAL is ignored
- Script 2: only 0-9 can be entered plus 0 or 1 dot as decimal separator, but as soon as the focus leaves the textentry, the number is rounded to an integer
- Script 1 + 2: type = #NUMERICAL is not ignored, but it's not possible to enter a dot as decimal separator
Cheers, Michael