Position of the cursor

The place for threads about TimoSoft EditControls.
Post Reply
bjoernlueders
Cadet
Posts: 9
Joined: 12 Nov 2008, 10:26

Position of the cursor

Post by bjoernlueders »

How can I retrieve / set the current position of the cursor in the textbox (as with .selstart)?

Thanks,

Bjoern
User avatar
TiKu
Administrator
Administrator
Posts: 832
Joined: 28 Sep 2004, 21:10
Location: München
Contact:

Re: Position of the cursor

Post by TiKu »

Have a look at the GetSelection() method.
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
bjoernlueders
Cadet
Posts: 9
Joined: 12 Nov 2008, 10:26

Re: Position of the cursor

Post by bjoernlueders »

Thank you for the fast response.

I'm stuck here. How do i identify the Position of the "selectionStart"?
User avatar
TiKu
Administrator
Administrator
Posts: 832
Joined: 28 Sep 2004, 21:10
Location: München
Contact:

Re: Position of the cursor

Post by TiKu »

Code: Select all

Dim selStart As Long

TextBox1.GetSelection selStart
' now selStart holds the cursor's position
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
bjoernlueders
Cadet
Posts: 9
Joined: 12 Nov 2008, 10:26

Re: Position of the cursor

Post by bjoernlueders »

Thank you very much.

One last question: How can i set the Position afterwards to "selstart+1"? .setselection(selstart,selstart+1)?
User avatar
TiKu
Administrator
Administrator
Posts: 832
Joined: 28 Sep 2004, 21:10
Location: München
Contact:

Re: Position of the cursor

Post by TiKu »

If you just want to change the cursor's position to one character ahead, use

Code: Select all

SetSelection selStart + 1, selStart + 1
If you want to select the first character after the cursor's position, use

Code: Select all

SetSelection selStart, selStart + 1
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
bjoernlueders
Cadet
Posts: 9
Joined: 12 Nov 2008, 10:26

Re: Position of the cursor

Post by bjoernlueders »

Thank you very much!
Everything is working just fine!
Post Reply