Mouseup event with textarea

Hi. I have a textarea where I want to handle some code. I read on a few posts that you need to include a mousedown that returns true. When I tried this, I am unable to select any of the text in the area. Do you need to include any other code in the mousedown event, or is the return true sufficient? Does using this event turn the textarea into a read only or disabled? I am in need of selecting some of the text in the textarea and then have code to fire on the mouseup

Selecting of text is automatic (ie… you don’t need to activate the MouseEvents)… just select the text the way you expect to be able to do so.

Then query the SelectChanged Event, SELSTART, SELLENGTH and SELTEXT properties.

Unless you return TRUE out of MouseDown.

Is there a reason you need to use MouseUp instead of MouseDown?

He should be using SelectChanged… MouseDown happens BEFORE any text could be selected.

Hi guys. Thanks for the replies. I’m writing a quick flash card app. I wanted to do a feature that would be similar to highlighting a note on the flash card. I have a text area for the answer/explanation. The user would be able to highlight some text as if they were doing it on an actual card.

I am using the selectchange method of the textarea to select some text and turn it red to stand out. I am then attempting to save the highlighted string to a table. I have figured this out with selecting the desired text and clicking a save button. However, what if the user wanted to highlight 2 or 3 phrases in the answer? I wanted to automate this save right after the user stopped highlighting the text, hence my thought of putting this save in the mouseup. If I include the save in the selectchange, it seems to save each character in the phrase progressively. For example, highlighting the word “cool”, the table saved like this:
C
Co
Coo
Cool

If you have any thoughts on how to accomplish this plan, I’d love to hear! I was basically just playing around and seeing what functions I had available.

Ok, I figured out how to manilupate this for my needs.

In the MouseDown

if me.SelLength > 0 then Return True else Return False end if

In the MouseUp

[code] SaveUpdateHighlights

me.SelLength = 0[/code]

This allows me to select the text to highlight in the MouseDown, save the string during MouseUp, and then “resets” so I can select additional text to save a new string