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 

Demo application question

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



Joined: 28 Sep 2006
Posts: 16

PostPosted: Fri Mar 02, 2007 2:57 am    Post subject: Demo application question Reply with quote

Hello

In demo application 'MouseHighlight',

in TokenRules OnMouseEvent procedure SyntAnalyzer1TokenRules0MouseClick...

why do not affect OnMouseEvent for Rules 'Key words' characters
(unit, interface, uses, type, procedure, var, implementation...etc)?

I want to use OnMouseEvent for Styled Rules...

How do this?

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


Joined: 09 Jun 2006
Posts: 202

PostPosted: Fri Mar 02, 2007 11:04 am    Post subject: Reply with quote

Hello,

"Tag detect" rule replaces reference of highlighted token with Self, therefore key words has no reference to parser rule "Any Name".

Example of alternative processing:

Code:
procedure TForm2.SyntaxMemo1MouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
const IdentifierTokenIndex = 2;
var TokIdx: Integer;
begin
  if (ssCtrl in Shift) and (Button = mbLeft) then
   begin
     TokIdx := SyntaxMemo1.SyntObj.TokenAtPos(SyntaxMemo1.CaretPosToStrPos(SyntaxMemo1.MouseToCaret(X,Y)));
     if (TokIdx <> -1) and (SyntaxMemo1.SyntObj.Tags[TokIdx].TokenType = IdentifierTokenIndex) then
       MessageBox(Handle, PChar('You click token: ' + SyntaxMemo1.SyntObj.TagStr[TokIdx]),
        'TTokenRule.OnMouseClick', MB_ICONINFORMATION or MB_OK);
     // You need to call Abort to skip mouse processing
     Abort;
   end;
end;



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



Joined: 28 Sep 2006
Posts: 16

PostPosted: Mon Mar 05, 2007 1:06 am    Post subject: Thanks Reply with quote

Ok. It's work good.
Thank you.
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