Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Callback questions
#3
(03-11-2020, 11:15 AM)Hi Alexandre.Thanks for this, it is more or less what I have but I have created a callback function as my code is getting called directly from the HTML onClick event rather than an IW control.  Your JS looks a lot neater than mine though :-)Alexandre Machado Wrote: Hi,

this code exemplifies it:

Code:
procedure TIWForm1.IWButton1AsyncClick(Sender: TObject; EventParams: TStringList);
var
  jsCode: string;
begin
  jsCode := 'IW.$("mydiv").innerHTML = "my new text";';
  WebApplication.CallBackResponse.AddJavaScriptToExecuteAsCDATA(jsCode);
end;

In that case I have a div which id is "mydiv" (remember that JavaScript is case sensitive). When clicking a button on my form I want to set its text to "my new text".

WebApplication.CallBackResponse.AddJavaScriptToExecuteAsCDATA()

is just a long line to instruct IW JavaScript libraries to run that line of code, referenced by js local variable.

Please let me know if that helps.
Reply


Messages In This Thread
Callback questions - by davidmcevoy@outlook.com - 03-09-2020, 07:15 PM
RE: Callback questions - by Alexandre Machado - 03-11-2020, 11:15 AM
RE: Callback questions - by davidmcevoy@outlook.com - 03-11-2020, 06:39 PM

Forum Jump:


Users browsing this thread: 2 Guest(s)