Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
java script variable access in intraweb
#6
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;
Reply


Messages In This Thread
RE: java script variable access in intraweb - by MrSpock - 12-15-2019, 09:40 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)