Subject Re: [IBO] positioning the cursor
Author Geoff Worboys
> Since I had to perform some string manipulation, I used the SelStart
> and SelLength properties to position my cursor at the end of the
> text. Now, it does not work anymore with the TIB_Edit component.

I suspect the problem is timing related.

It sounds like you are trying to put the cursor at the end of the
control OnEnter. If you create a derivation you can override CMEnter,
call inherited first (to let IBO do its thing) and then perform your

IBO refreshes the contents of the control from the field buffer using
the following code...

procedure TIB_CustomEdit.CMGotFocus(var Message: TCMGotFocus);
SysDataChange( nil );

While I have not setup a demo to confirm the exact order in which this
all hangs together I _think_ that what is happening is that OnEnter is
being called during the "inherited" call in the above method - you are
positioning the cursor andthen "SysDataChange" is begin called and
reloading the text into the control, with the consequence of the
cursor position being changed.

You may need to derive your own variation of TIB_Edit and override the
the CMGotFocus method with something like...

procedure TMyIB_Edit.CMGotFocus(var Message: TCMGotFocus);
// whatever it is you want to do

Of course all this is based on the idea that you need to do your
SelStart/SelLength stuff to achieve the desired result. Without
knowing exactly what it is you are trying to do it is difficult to be
precise or offer suitable alternatives.

Geoff Worboys
Telesis Computing