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 

Creating user ranges/styles and gutter objects in code

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



Joined: 12 Dec 2007
Posts: 12
Location: Poland

PostPosted: Wed Jan 14, 2009 11:50 pm    Post subject: Creating user ranges/styles and gutter objects in code Reply with quote

I'm trying to use the SyntaxMemo to display a list of log messages. This needs the following functionality:

1. Creating a new range on the fly (in code) for each added line, and assigning a user style to it.

2. Displaying an image in the gutter for each added line to indicate log message severity.

I've seen the demos included with the distribution, but they only showcase setting up these features in the designer. Do you perhaps have any demos that show how to do the above dynamically in code?

Thanks a lot,
Marek (registered user)
Back to top
View user's profile Send private message Visit poster's website
econtrol
Site Admin


Joined: 09 Jun 2006
Posts: 202

PostPosted: Wed Jan 28, 2009 7:59 am    Post subject: Reply with quote

Hello,

1. You may use UserRanges collection. But I suggest to write lexer which will colorize text automatically. For this purpose you may add control char sequence which will identify line type. This control char sequence may be hidden.

2. Use OnGetGutterImage event. For example:
Code:
procedure TFmLogViewer.SyntaxMemo1GetGutterImage(Sender: TObject;
  const Line: Integer; List: TList);
var g: TGutterObject;
begin
      g := TGutterObject.CreateObj(Line, integer(SyntaxMemo1.Lines.Objects[Line]));
      g.Band := 0;
      List.Add(g);
end;

All gutter objects added to List will be destroyed by the Syntax Memo. In gutter object you may define also line colors (fore-, background colors).

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