Is there an example for problems and setups for selecting text in a styled textarea? I am probably doing somethings wrong. I am on a Mac, but I have similar problems on Windows. For instance I created a start point with a mouse for selecting text in a textarea and then double-clicked and unfortunately for me got the word highlighted. Then I went back to the start point just the before the highlighted word and selected a length of text. It turned out to be a length of 24, but it wasn’t highlighted, Why? This isn’t true Apple’s TextEdit program.
I also tried selecting text from right to left and got a sellength of -20. If I’d had sellength as being greater > 0 I would be in trouble. I imagine this tutorial would include using absolute values. This happened with the mouse events and not keyboard interestingly enough. Yes, I’ve double checked that it’s negative.
Is there an example out there?
Sorry for asking. Sometime ago somebody suggested using in the mouseup event this code i=me.CharPosAtXY(x,y)
What wasn’t accounted for was if the mouse movement was right to left so here’s that code for mouse up
dim i, k as integer// for switching if i < me.SelStart
i=me.CharPosAtXY(x,y)
If i < me.SelStart Then
k = me.SelStart
me.SelStart = i
me.SelLength = k - me.SelStart + 1
ElseIf me.SelStart < i Then
me.SelLength = i - me.SelStart + 1
Else
me.SelLength = 0
End If
What the selected text not highlighting is about is not in the language reference. Apparently if you double-click now (don’t know which OS this came about with), the word nearby is highlighted, but the programmer has to reset sellength to 0 before moving the mouse, otherwise XOJO won’t highlight the text.
Sorry. Take out the +1 from
k - me.SelStart + 1