Selecting text Textarea and readonly

How do I get selected text in a ReadOnly Textarea?
There is no exception in the LR about read only as far as I can see?
Desktop if it matters.

Did SelText not work?

I have sellength = 0 after MouseUp (at return). I cannot think of anything which prohibits it.

Mac or Windows? I’m not having any trouble getting the SelText value of a ReadOnly TextArea on Mac.

Thanks Tim.

Both. And current versions everywhere (except Mohave)

It happens in one Control Set. So not in other windows

Figured out the answer. MouseDown event. I have the Return as True.
The LR states:

[quote]Return True if you are going to handle the MouseDown. In such a case:
The Action event, if any, will not execute and the state of the object will not change.
You will receive the MouseDrag and MouseUp events.
If you return False, the system handles the MouseDown so the above event handlers do not get called.[/quote]

I should have the Return as False
I am confused. I want to receive the MouseUp events because it says I will handle them.
It also states [quote]the above event handlers do not get called[/quote]
I want the MouseUp event to be handled.
That does NOT make sense.

If you want the MouseUp event you need to handle the MouseDown event. This may make you responsible for changing the selection.

I understand your question now, and it was not related to SelText. You didn’t mention anything about trying to select the text with the mouse, and it not working. In the future, try to describe the problem, rather than the technologies you think are involved. As the clich goes, help us to help you :slight_smile:

What are you doing in MouseUp? Is it so important you want to implement selection tracking in MouseDown?
You may be able to move the MouseUp code somewhere better. If you care to share it, I’m happy to help figure out alternatives.

Yeah. I hadn’t debugged by eliminating events.

But question. I thought you could NOT get a cursor if it was readOnly, so I assumed it was obvious about the mouse.
Correct?

What I needed is to capture the length of the selText during an Edit. I don’t know why it was still in the ReadOnly part.
I think it used to be if you changed focus the selection was lost. I pushed a button on a window, the selection disappeared, so I had to save it.
I found out I don’t need that on a Mac at least.
The selection stays when focus is lost. Hurrah.

[quote=409020:@Arthur Gabhart]But question. I thought you could NOT get a cursor if it was readOnly, so I assumed it was obvious about the mouse.
Correct?[/quote]
Here’s a reference to help with that. I just tested these results:

[code]Windows Read Only:
Insertion carat
Selectable

Mac Read Only:
No insertion carat
Selectable

Windows Enabled False:
Visual cue

Mac Enabled False:
No visual cue
[/code]

Best bet though, never assume anything is obvious. Sometimes it’s a Monday :wink:
Describe the issue in full detail. Things like what steps you take to run into the issue, what you’re expecting, and what’s actually happening can really help.

[quote=409020:@Arthur Gabhart]I think it used to be if you changed focus the selection was lost. I pushed a button on a window, the selection disappeared, so I had to save it.
I found out I don’t need that on a Mac at least.
The selection stays when focus is lost. Hurrah.[/quote]
I tested this on Windows for you, and what you describe does happen. I don’t spend all day in Windows, so I’m not sure if that’s just a Windows behavior or a Xojo framework issue.

Did you resolve your issue or do you still need some help?

OOOOO. That’s even better.
I hadn’t hoped for a cursor from my complaint.
Thank You.

I have seen a new property for selection staying on Windows if LostFocus. That may solve my problem.
If not I know what to do better.

Mondays and programming are everyday for me.
Again Thank You.