[How To] Cursor coordinates in the event

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.
Example:
* Create and define the BrowserParams :
delphi code
* Using of BrowserParams in Event:
delphi code
Below, you will find the very simple example with IWCGJQButton.
![]() |
---|
When you define the code of BrowserScript of BrowserParams, you must have attention on the event arguments. |
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;