CGDevTools Forum

Welcome to the Official CGDevTools Support Community Forums.

[How To] Cursor coordinates in the event

Here you can find some answers to your questions, and also some tutorials.

by Alexander Bulei » 15 Dec 2014 11:58

To obtain the cursor coordinates, and send to the event, you need to use the BrowserParams.
Below, you will find the very simple example with IWCGJQButton.

Note

When you define the code of BrowserScript of BrowserParams, you must have attention on the event arguments.

E.g: IWCGJQButton.OnClick passes the event object as "e" parameter.



Example:

* Create and define the BrowserParams :

delphi code
procedure TIWForm1.IWAppFormCreate(Sender: TObject);
begin
with IWCGShowCursorPosBtn.JQButtonOptions.OnClick.BrowserParams.Add do
begin
ServerName:= 'curX';
BrowserScript:= 'e.pageX';
end;
with IWCGShowCursorPosBtn.JQButtonOptions.OnClick.BrowserParams.Add do
begin
ServerName:= 'curY';
BrowserScript:= 'e.pageY';
end;
end;


* Using of BrowserParams in Event:

delphi code
procedure TIWForm1.IWCGShowCursorPosBtnJQButtonOptionsClick(Sender: TObject; AParams: TStringList);
var
PosX, PosY: Integer;
begin
PosX:= StrToIntDef(AParams.Values['curX'],-1);
PosY:= StrToIntDef(AParams.Values['curY'],-1);
WebApplication.ShowMessage('X: ' + IntToStr(PosX) + #13+#10 + 'Y: ' + IntToStr(PosY) );
end;
Group: Developers | Support Team

  • info [at] cgdevtools.com - General information
  • sales [at] cgdevtools.com - Sales department
  • support [at] cgdevtools.com - Product and Technical Support
User avatar
Alexander Bulei
Site Admin
 
Posts: 3635
Joined: 15 May 2012 08:52
Location: Mealhada, Portugal

Return to Documentation / Tutorials

cron

Who is online

Users browsing this forum: No registered users and 1 guest

Contact Us.