TextArea double-click?

Thank you very much Michel - I really appreciate you spending the time to make the example for me!
I will definitely be using that in future :slight_smile:

[quote=93478:@Richard Summers]Thank you very much Michel - I really appreciate you spending the time to make the example for me!
I will definitely be using that in future :)[/quote]

The idea here is that it requires no code, and uses the system settings for double click, instead of baking your own in the MouseDown event.

I would proceed as follow : when double clicked, lift the readonly, make the canvas invisible, and let the user edit the text. I would use the MouseExit event to record, make the canvas visible (although it is not seen), and set the readonly to true.

Thanks Michel!

I like the canvas idea for the double click, but using MouseExit to mark the end of editing would drive me nuts, as when I go to edit something I normally click in it, then move the mouse pointer out of the way before I start typing. Every time I went to edit, it would turn right back to read only and I’d report it as a bug.

Totally agree with this. I still think you need some sort of an icon or button, to give a clear intuitive link between clicking the it and unlocking the TextArea.

I have a switch button, which I can use in order to set the text area as either editable or read only.

If you’re going to make it editable anyway, why have the switch button (or the double click, for that matter)? Why not just come up with your saving scheme and leave it editable all the time?

I have come to the conclusion that this is probably my best approach:

Have the Textarea initially as Read Only, whereby the user has to click on the edit button in the toolbar, in order to open the edit window. (this is to prevent the user accidentally clicking and changing the text)

Have a toggle button, which allows / disallows inline editing (removes the read only aspect).

A user can then click and edit directly in the text area.
I am now just confused as to which event handler do I use, to update the database after the user has made the changes?

LostFocus when they tab into another field, and Close in case they close the window before moving to a different field.

Thanks Kem.
The TextArea is in my main window - so I will update the database in the lost focus event, and also in the main window’s close event.

That works. You can also use the TextArea’s Close event.

Or you can just use the Window’s CancelClose event. The advantage is, if something goes wrong with the database update, you can stop closing the window.

OK, I have a TextArea with some text in it.

In that text is the text for a URL, I would like to triple click on the URL text and go to the URL.

This is what I have and it works but I would like to improve on it.

In the action event of a pushbutton I have

Dim TheLinkString as string
  TheLinkString = Trim(TextArea1.SelText)
    ShowURL TheLinkString

The text that is triple-clicked is

https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&ved=0ahUKEwivvIzNy6zWAhVF4CYKHXjoBGEQFggnMAA&url=https%3A%2F%2Fwww.everydayhealth.com%2Futerine-cancer%2Fpcos-and-endometrial-cancer-risk.aspx&usg=AFQjCNGkP3ln9G9Hombi-FZWPQlFZNV2_w

It works.

What I want to accomplish is something like this


Dim TMU as Triple-click
// Triple-click would be the coder for the Triple-Click
// I do not know how to code that
 need some help here

 // In the Mouse-Up event of the TextArea1 would be something like this...

If TMU Then
If Trim(TextArea1.SelText) isa URLString then
// a method is required to check if TextArea1.SelText is a URL
// It has to have several components to it
// It must not have spaces
// It must have one of a URL’s prefix like http, https, etc
// and other parameters that make it a URL

 // The URL string does not need to be tested, the browser would do that

ShowURL Trim(TextArea1.SelText)

end if

end if

Any suggestions as to how I can accomplish that?
That would make the Pushbutton redundant and would be able to go to Trim(TextArea1.SelText) in one less click.

Thanks.

Lennox

Use single click.

Check the styleof the text below the mouse and if it is Blue + Underline (+ starts with http / ftp / whatever) get the styled text (the link) and show url it…

Edit: I forgot. Change the MouseCursor to the “Link below” Cursor when the text below the Cursor is a link. So the user knows (s)he just have to single click there.

Who will ask for a four-click feature ?
(that is not select all)

Thanks Emile, but the text is all monochrome, (black), and is plain text.

What I am looking for is how to do it the way I outlined.

Regards.

Lennox

I understand. But… how the heck your user knows this is a link ?