EControl Ltd. Forum Index EControl Ltd.
VCL libraries and software support forum
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Bookmark example

 
Post new topic   Reply to topic    EControl Ltd. Forum Index -> EControl Syntax Editor
View previous topic :: View next topic  
Author Message
itsatomic



Joined: 12 Jun 2006
Posts: 38

PostPosted: Tue Jul 25, 2006 1:52 am    Post subject: Bookmark example Reply with quote

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
View user's profile Send private message
econtrol
Site Admin


Joined: 09 Jun 2006
Posts: 202

PostPosted: Tue Jul 25, 2006 7:02 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
itsatomic



Joined: 12 Jun 2006
Posts: 38

PostPosted: Tue Jul 25, 2006 8:41 am    Post subject: Reply with quote

Hi Michael

Your code worked well, thankyou.

Aaron
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    EControl Ltd. Forum Index -> EControl Syntax Editor All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group