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 

Setting bookmark importance

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



Joined: 21 Jul 2006
Posts: 67
Location: North Carolina, USA

PostPosted: Thu Aug 03, 2006 1:38 pm    Post subject: Setting bookmark importance Reply with quote

I have a situation where I get 2 bookmarks on a single line. Both have a different ImageIndex, ForeColor, and BgColor. Is there a way where I can flag a bookmark as being more important than another and if it is set on the same line as another, less important bookmark, that it will always be the one shown?

Thanks.
Back to top
View user's profile Send private message
econtrol
Site Admin


Joined: 09 Jun 2006
Posts: 202

PostPosted: Fri Aug 04, 2006 1:31 pm    Post subject: Reply with quote

In this case OnGetGutterImage may be used

Code:
  TCustomSyntaxMemo.OnGetGutterImage:  TGetGutterImageEvent;

  TGetGutterImageEvent = procedure(Sender: TObject;
      const Line: integer; List: TList) of object;


List contains all gutter objects (TGutterObject, TBookmark) for the specified Line. You may add or remove gutter objects.


Example:
Code:
procedure Form1.SyntaxMemo1GetGutterImage(Sender: TObject; const Line: integer; List: TList);
var i: integer;
begin
  if (List.Count > 1) and (TObject(List[List.Count - 1]) is TBookmark) then
   begin
      for i := 0 to List.Count - 2 do
        List.Delete(i);
   end;
end;


Michael.
Back to top
View user's profile Send private message Send e-mail
mstaszew



Joined: 21 Jul 2006
Posts: 67
Location: North Carolina, USA

PostPosted: Mon Aug 07, 2006 1:57 pm    Post subject: Reply with quote

Thanks Michael, that worked perfectly. I do have one more question. I have a single TGutterObject that is created at design-time and many more that are created at run-time. Can I safely assume that TSyntaxMemo.Gutter.Objects[0] will always and forever be the one that I set at design-time or will the list ever get rearranged?

Thanks.
Back to top
View user's profile Send private message
econtrol
Site Admin


Joined: 09 Jun 2006
Posts: 202

PostPosted: Tue Aug 08, 2006 1:13 pm    Post subject: Reply with quote

Gutter objects are not rearranged, so you may safely access them via index like TSyntaxMemo.Gutter.Objects[0].

Additional info:
You may create new gutter objects and safely add them to list in OnGetGutterImage. All gutter objects without Owner (i.e. created with Collection = nil) will be automatically destroyed after processing line.

For example, see TEditorFrame.EditorMasterGetGutterImage in main demo.

Michael.
Back to top
View user's profile Send private message Send e-mail
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