Make textentry readonly?

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

Make textentry readonly?

Post 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

User avatar
msu
Posts: 71
Joined: Mon Jun 13, 2016 11:36 am
Location: Sinzig/Germany

Re: Make textentry readonly?

Post 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.

User avatar
airsoftsoftwair
Posts: 4612
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Make textentry readonly?

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

p-OS
Posts: 141
Joined: Mon Nov 01, 2010 11:56 pm

Re: Make textentry readonly?

Post by p-OS »

Just an idea.

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

And eventually change FrameType ?

User avatar
mrupp
Posts: 67
Joined: Sun Jan 31, 2021 7:44 pm
Location: Switzerland
Contact:

Re: Make textentry readonly?

Post 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.

p-OS
Posts: 141
Joined: Mon Nov 01, 2010 11:56 pm

Re: Make textentry readonly?

Post by p-OS »

Well, I was thinking in MUI world, maybe FrameStyles are not available in RapaGUI

User avatar
airsoftsoftwair
Posts: 4612
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Make textentry readonly?

Post 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

User avatar
mrupp
Posts: 67
Joined: Sun Jan 31, 2021 7:44 pm
Location: Switzerland
Contact:

Re: Make textentry readonly?

Post by mrupp »

I assume this can't be made ISG, or you probably would have, right?

User avatar
airsoftsoftwair
Posts: 4612
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Make textentry readonly?

Post 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.

amyren
Posts: 206
Joined: Thu May 02, 2019 11:53 am

Re: Make textentry readonly?

Post 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"/>

Post Reply