Change the text color of a disabled text field

Instead of creating headaches with LostFocus and setting focus on things, has anyone checked the documentation?
There is a property that makes it so the user can’t edit the field built in, and it’s not Enabled=false

[quote=402677:@Tim Parnell]Instead of creating headaches with LostFocus and setting focus on things, has anyone checked the documentation?
There is a property that makes it so the user can’t edit the field built in, and it’s not Enabled=false[/quote]
Emile pointed to ReadOnly, I’ll check the documentation for other options.

With that (readonly) and cursor change, there is no need to LostFocus and setting focus, but the user can select the words on the TextField. If that’s good enough for Sergio I think is better than all the extra code.

Well, I think that readonly is enough, I tested it before gotfocus event but I did not want the user to be able to select the text… anyway it could be better for me because of my limited knowledge.
I get angry because, responding to Alberto, I have tried to follow his recommendations but I have not got it and I would like to know how to do it with gotfocus. I know it’s not the best way to learn that you give me the code that I need directly but I’m still very new to Xojo and I’m doing my first complete application. Anyway I have reviewed all the documentation but there is not much documentation or examples of how to use this event.

Anyway, thank you very much everyone for your help but I hope you can be patient … I will need some time to learn.

Sergio

The thing is, you absolutely shouldn’t. The Focus events are some of the most temperamental ones, and trying to hack together a workaround using focus instead of the ReadOnly property isn’t going to be an easy process. In the end, the behaviour would also enrage users because of the wonky effects.

I’d be happy to help you learn how to do things the right way, and I even offer code examples when people are trying but absolutely stumped. However, I won’t lead you down a path I know will end in disaster.

I fully advise you not to attempt a GotFocus / LostFocus hack.

Thank you so much Tim. I totally agree with you, apologize if I have insisted on something that could end in disaster, you are the masters and I will listen to you. The fact is that the first time I tried to use ‘readonly’, but in addition to the textfields, I have 2 popupmenus and in these elements is not available the readonly option (I think) and I did not know how to solve it so I consulted in the forum.
Would you have any suggestions to get the “readonly” in the popupmenu element, please?

So you’re trying to disable a popupmenu but not change it’s visual state?
That’s a poor user experience, as they’ll have no way to identify that the field cannot be changed.

You may be able to use DrawInto and some position shuffling to create that effect though.

[quote=402687:@Tim Parnell]So you’re trying to disable a popupmenu but not change it’s visual state?
That’s a poor user experience, as they’ll have no way to identify that the field cannot be changed.

You may be able to use DrawInto and some position shuffling to create that effect though.[/quote]
Wouldn’t a label with a menu that appears on MouseDown work in this case? When it’s “Enabled” the menu shows, if not you just don’t call menuitem.popup.