Page 1 of 1

StringRequest(): #NUMERICAL troubles

Posted: Sun Aug 08, 2021 11:59 am
by mrupp
There is some strange behaviour concerning SystemRequest() of type = #NUMERICAL and RapaGUI. Please have look at the following examples:

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")
EndIf
Script 2 (only difference ist the missing RapaGUI requirement):

Code: 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")
EndIf
Test-Results:
Windows:
  • 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
macOS:
  • 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
MUI (OS4, MorphOS):
  • Script 1 + 2: type = #NUMERICAL is not ignored, but it's not possible to enter a dot as decimal separator
These are bugs to squash, right? ;)

Cheers, Michael

Re: StringRequest(): #NUMERICAL troubles

Posted: Fri Aug 13, 2021 9:44 pm
by airsoftsoftwair
mrupp wrote: Sun Aug 08, 2021 11:59 am These are bugs to squash, right? ;)
Yes, but only the Windows and macOS issues sound actually fixable to me. It's right, RapaGUI on Windows/macOS/Linux currently ignores type #NUMERICAL. This can probably be fixed rather easily.

Concerning the unavailable decimal separator on AmigaOS and MorphOS, it's not really possible to fix this because neither requester.class (used on OS4) nor reqtools.library (used on all other Amigaoids) support real numbers. They only support an integer mode, hence no decimal point.

Re: StringRequest(): #NUMERICAL troubles

Posted: Wed Oct 20, 2021 6:56 pm
by mrupp
airsoftsoftwair wrote: Fri Aug 13, 2021 9:44 pm Yes, but only the Windows and macOS issues sound actually fixable to me. It's right, RapaGUI on Windows/macOS/Linux currently ignores type #NUMERICAL. This can probably be fixed rather easily.
That would be great.
airsoftsoftwair wrote: Fri Aug 13, 2021 9:44 pm Concerning the unavailable decimal separator on AmigaOS and MorphOS, it's not really possible to fix this because neither requester.class (used on OS4) nor reqtools.library (used on all other Amigaoids) support real numbers. They only support an integer mode, hence no decimal point.
In that case I would suggest to only allow integers on all platforms if type #NUMERICAL is used (if that's not too much trouble, that is). That way it's ensured that the app behaves the same on all platforms. And if real numbers are needed, it's actually quite easy for the developer to implement a custom dialog himself, imho.

Re: StringRequest(): #NUMERICAL troubles

Posted: Fri Oct 22, 2021 9:33 pm
by airsoftsoftwair
mrupp wrote: Wed Oct 20, 2021 6:56 pm That would be great.
Fixed now.

Code: Select all

- Fix [Windows/macOS/Linux]: StringRequest() didn't support the #NUMERICAL mode
mrupp wrote: Wed Oct 20, 2021 6:56 pm In that case I would suggest to only allow integers on all platforms if type #NUMERICAL is used (if that's not too much trouble, that is). That way it's ensured that the app behaves the same on all platforms. And if real numbers are needed, it's actually quite easy for the developer to implement a custom dialog himself, imho.
Actually, I prefer to have the full 0123456789-. support for #NUMERICAL in that case even if it's not supported on Amiga but maybe in the future with A-EON's enhancer ;)