12-15-2019, 09:40 PM
Now I see, I need to call back-end from IWImage click or mousedown, but it does not work so another idea. But I think this will not work without ajax. How to change the code? I need to get coordinates of the clicked point on IWImage.
IWImage.extraTag: id="FOTOGRAFIA"
IWForm
extraHeaders
<script>
document.getElementById("FOTOGRAFIA").addEventListener('click', getPosition)
function getPosition(e) {
var rect = e.target.getBoundingClientRect();
var x = e.clientX - rect.left;
var y = e.clientY - rect.top;
return { x, y }
}
</script>
procedure TIWForm1.IWAppFormCreate(Sender: TObject);
begin
RegisterCallBack('getPosition)',
procedure (aParams: TStrings; out aResult: string)
var
x, y: Integer;
begin
x := StrToIntDef(aParams.Values['x'], -1);
y := StrToIntDef(aParams.Values['y'], -1);
// do something with x and y
end
);
end;
IWImage.extraTag: id="FOTOGRAFIA"
IWForm
extraHeaders
<script>
document.getElementById("FOTOGRAFIA").addEventListener('click', getPosition)
function getPosition(e) {
var rect = e.target.getBoundingClientRect();
var x = e.clientX - rect.left;
var y = e.clientY - rect.top;
return { x, y }
}
</script>
procedure TIWForm1.IWAppFormCreate(Sender: TObject);
begin
RegisterCallBack('getPosition)',
procedure (aParams: TStrings; out aResult: string)
var
x, y: Integer;
begin
x := StrToIntDef(aParams.Values['x'], -1);
y := StrToIntDef(aParams.Values['y'], -1);
// do something with x and y
end
);
end;

