StringRequest(): #NUMERICAL troubles

Discuss GUI programming with the RapaGUI plugin here
Post Reply
User avatar
mrupp
Posts: 147
Joined: Sun Jan 31, 2021 7:44 pm
Location: Switzerland
Contact:

StringRequest(): #NUMERICAL troubles

Post 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
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: StringRequest(): #NUMERICAL troubles

Post 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.
User avatar
mrupp
Posts: 147
Joined: Sun Jan 31, 2021 7:44 pm
Location: Switzerland
Contact:

Re: StringRequest(): #NUMERICAL troubles

Post 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.
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: StringRequest(): #NUMERICAL troubles

Post 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 ;)
Post Reply