View previous topic :: View next topic |
Author |
Message |
itsatomic
Joined: 12 Jun 2006 Posts: 38
|
Posted: Tue Jul 25, 2006 1:52 am Post subject: Bookmark example |
|
|
Hi Michael
do you mind providing a bookmark example - adding a bookmark using code, specifying position and index? ie not one of the 0..9 bookmarks, but an adhoc one would be preferred.
Or, is there an example in the demos that does this?
Thanks
Aaron |
|
Back to top |
|
|
econtrol Site Admin
Joined: 09 Jun 2006 Posts: 202
|
Posted: Tue Jul 25, 2006 7:02 am Post subject: |
|
|
Hi Aaron,
Using bookmarks is easy. Bookmark is a gutter object that is linked to the specified position, so bookmark has all features of gutter object:
- Image, displayed on the gutter
- Hint (for image icon in gutter)
- Line highlighting attributes
- Popup menu (for image icon in gutter)
Example:
Code: | with SyntaxMemo1.BookmarkObj.Add do
begin
Position := SyntaxMemo1.CaretStrPos;
ImageIndex := 3;
Hint := 'Some useful info ...';
BgColor := clYellow;
end;
// Changing bookmarks does not cause editor redrawing,
// so you should call Invalidate
// (it is useful if you are going perform many changes)
SyntaxMemo1.Invalidate; |
P.S.
I've updated declaration of TBookmark.BmIndex (to be read/write)
Code: | property BmIndex: integer read FBmIndex write FBmIndex; |
Michael. |
|
Back to top |
|
|
itsatomic
Joined: 12 Jun 2006 Posts: 38
|
Posted: Tue Jul 25, 2006 8:41 am Post subject: |
|
|
Hi Michael
Your code worked well, thankyou.
Aaron |
|
Back to top |
|
|
|