Recent

Author Topic: BeginUndoBlock and EndUndoBlock of SynEdit  (Read 2145 times)

Edson

  • Hero Member
  • *****
  • Posts: 1044
BeginUndoBlock and EndUndoBlock of SynEdit
« on: October 11, 2013, 08:42:20 pm »
Are these methods:

BeginUndoBlock and EndUndoBlock

enabled in SynEdit?

If so, How do they work?
« Last Edit: October 11, 2013, 08:49:48 pm by Edson »
Lazarus 1.6 - FPC 3.0.0 - x86_64-win64 on  Windows 7

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5621
    • wiki
Re: BeginUndoBlock and EndUndoBlock of SynEdit
« Reply #1 on: October 11, 2013, 09:32:58 pm »
yes they are.
Code: [Select]
BeginUndoBlock;
//call edit
//call edit
//...
EndUndoBlock;

All edits will be undone in a single undo.
Without the undoblock, each edit requires one undo

Please read:
http://wiki.lazarus.freepascal.org/SynEdit#Change_text_from_code

access to SynEdit.Lines never works with undo

Edson

  • Hero Member
  • *****
  • Posts: 1044
Re: BeginUndoBlock and EndUndoBlock of SynEdit
« Reply #2 on: October 11, 2013, 10:37:22 pm »
Thanks Martin,

I haven't found information about these methods of SynEdit.

The wiki is a little poor about SynEdit.

In fact, I have started to complete the spanish version: http://wiki.freepascal.org/SynEdit/es
Lazarus 1.6 - FPC 3.0.0 - x86_64-win64 on  Windows 7

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5621
    • wiki
Re: BeginUndoBlock and EndUndoBlock of SynEdit
« Reply #3 on: October 11, 2013, 10:59:04 pm »
well yes, documenting synedit is still a big todo.

but the methods should be self explaining. Use code navigation, and you will see the declaration.

SynEdit.TextBetweenPoints[ Point(x,y), Point(x2,y2) ] := 'abc';

works like setting block-selection begin/end and then SelText := 'abc'

x,y are "logical". see same wiki page