Page 1 of 2

Make textentry readonly?

Posted: Sun Feb 07, 2021 12:46 pm
by mrupp
Hi

Is it really true that it's not possible to set a textentry to readonly? Setting readonly="true" in the XML works for texteditor, but not for textentry. It's not listed in the docs, but then disabled="true" is not listed, either, and works for both of these classes.

What am I missing?

Cheers,
Michael

Re: Make textentry readonly?

Posted: Sun Feb 07, 2021 2:22 pm
by msu
The disabled attribute belongs to the area class.
This is an upper class of every MOAI class.
You can apply the area class to any object that is displayed visually.

Re: Make textentry readonly?

Posted: Sun Feb 07, 2021 9:46 pm
by airsoftsoftwair
You're right, it's not supported. The problem is that MUI doesn't support it. On Amiga, Textentry uses String.mui and AFAICS MUI doesn't support read-only string gadgets. String.mui only allows to set certain characters that should be rejected but there is no way to tell it to reject all characters that are entered.

On Windows/macOS/Linux it would be easy to support read-only text entry widgets but I like to keep things in sync with the Amiga version but maybe I should make an exception here or file a feature request with the MUI authors ;)

Re: Make textentry readonly?

Posted: Sun Feb 07, 2021 10:08 pm
by p-OS
Just an idea.

Maybe explicitly setting String.Accept Attribute to an empty String "" ? (Not Nil)

And eventually change FrameType ?

Re: Make textentry readonly?

Posted: Sun Feb 07, 2021 11:08 pm
by mrupp
Indeed, setting accept="" did the trick, now the textentry is readonly. NICE TRICK!
What do you mean by setting the frametype? How do I do that? Couldn't find "frametype" in the RapaGUI doc...

@airsoftsoftwair
Maybe you could add the readonly attribute to textentry and solve it with MUI by using this trick. You would have to ensure that this still works, though:

Code: Select all

moai.Set("mytextentry", "accept", "0123456789")
(...)
moai.Set("mytextentry", "readonly", True)
(...)
moai.Set("mytextentry", "readonly", False)
After this, mytextentry must still accept only numbers.

Re: Make textentry readonly?

Posted: Mon Feb 08, 2021 2:39 am
by p-OS
Well, I was thinking in MUI world, maybe FrameStyles are not available in RapaGUI

Re: Make textentry readonly?

Posted: Tue Feb 09, 2021 9:43 pm
by airsoftsoftwair
p-OS wrote: Mon Feb 08, 2021 2:39 am Well, I was thinking in MUI world, maybe FrameStyles are not available in RapaGUI
No, they aren't. But using the "accept" tag to simulate a read-only textentry widget is a nice idea so I've added it.

Code: Select all

- New: Added Textentry.ReadOnly [I]; if this is set to TRUE, the text in the widget won't be editable at all

Re: Make textentry readonly?

Posted: Sat Mar 06, 2021 7:45 pm
by mrupp
I assume this can't be made ISG, or you probably would have, right?

Re: Make textentry readonly?

Posted: Sat Mar 13, 2021 11:26 pm
by airsoftsoftwair
mrupp wrote: Sat Mar 06, 2021 7:45 pm I assume this can't be made ISG, or you probably would have, right?
Yes, wxWidgets expects the wxTE_READONLY flag at creation time so changing this flag would involve re-creating the widget which is why setting this is not supported.

Re: Make textentry readonly?

Posted: Fri Apr 16, 2021 2:59 pm
by amyren
airsoftsoftwair wrote: Tue Feb 09, 2021 9:43 pm

Code: Select all

- New: Added Textentry.ReadOnly [I]; if this is set to TRUE, the text in the widget won't be editable at all
That comes with RapaGUI 2.0 I guess.
Would this be the correct syntax?

Code: Select all

<textentry id="Antall" ReadOnly="true"/>