View previous topic :: View next topic |
Author |
Message |
hyperspeed
Joined: 28 Sep 2006 Posts: 16
|
Posted: Fri Mar 02, 2007 2:57 am Post subject: Demo application question |
|
|
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 |
|
|
econtrol Site Admin
Joined: 09 Jun 2006 Posts: 202
|
Posted: Fri Mar 02, 2007 11:04 am Post subject: |
|
|
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 |
|
|
hyperspeed
Joined: 28 Sep 2006 Posts: 16
|
Posted: Mon Mar 05, 2007 1:06 am Post subject: Thanks |
|
|
Ok. It's work good.
Thank you. |
|
Back to top |
|
|
|