View previous topic :: View next topic |
Author |
Message |
itsatomic
Joined: 12 Jun 2006 Posts: 38
|
Posted: Fri Jul 21, 2006 11:37 am Post subject: Delete selection |
|
|
Hi Michael
I cannot find a command constant (for ExecCommand) or a method to delete the current selection. Should there be one?
Aaron |
|
Back to top |
|
|
itsatomic
Joined: 12 Jun 2006 Posts: 38
|
Posted: Fri Jul 21, 2006 11:49 am Post subject: |
|
|
Ok I worked out something:
Code: | FMemo.DeleteText(-FMemo.SelLength); |
makes sense to me |
|
Back to top |
|
|
econtrol Site Admin
Joined: 09 Jun 2006 Posts: 202
|
Posted: Fri Jul 21, 2006 8:12 pm Post subject: |
|
|
Ways to delete selection:
Code: | 1. TSyntaxMemo.ClearSelection;
2. TSyntaxMemo.ExecCommand(smClearSelection); |
DeleteText(Count: integer) deletes abs(Count) characters right from caret if Count > 0 or left from caret if Count < 0.
Do not use DeleteText to delete selection because there will be error for columnar selection. Also caret may be at the start of the selection, at the end of the selection and even outside selection (for option "Persistent blocks").
Michael. |
|
Back to top |
|
|
itsatomic
Joined: 12 Jun 2006 Posts: 38
|
Posted: Sat Jul 22, 2006 3:18 am Post subject: |
|
|
oops, thanks. That'll teach me for developing when tired. I even looked through the helpfile, was looking for "Delete*".
Thanks Michael |
|
Back to top |
|
|
|