08-19-2019, 03:35 AM
(This post was last modified: 08-19-2019, 03:37 AM by DanBarclay.)
(08-19-2019, 03:14 AM)Kristy Wrote:(08-18-2019, 09:45 PM)Alexandre Machado Wrote: JNP's demo works fine and should work fine in any IW 15.x version.
I wonder what's the problem you are facing. Several users are running Http.sys applications in production for several months and there is not a single report of problems due Http.sys.
Have you tried a simple Indy SA server? What's the error you are getting?
I tried that on my new Dell notebook, brought at three week ago.
Flash install Delphi 10.3.2 + Intraweb 15.1.3
http.sys will hang then windows blue screen
indy SA server is work
but WebApplication.ShowMessage('12345678'); no message show and no error message.
Jose's demo work as display, but can't assign value to variable.
Try VCL windows application, everything ok.
Some fresh code for the demo Jose provided for you. Replace his two procedures with the following. They do things more than once, different ways, but provide your original request for timezone offset in addition to showing the callback with comments.
Code:
procedure TIWForm1.clbkGridSel(aParams: TStrings );
begin
// value of "Selection was sent by callback function, get it from parameters
fGridSelection := aParams.Values['Selection'];
// Now put it back into the IWEdit1 control if you want (or use it here on the Delphi side).
// It is in a Delphi variable now so do what you want with it.
WebApplication.
CallBackResponse.
AddJavaScriptToExecuteAsCDATA( 'document.getElementById("IWEDIT1").value = "' + fGridSelection + '"' );
// Show the value on the way out.
WebApplication.ShowNotification( fGridSelection );
// Put the timezone offset as caption of the button, on the server side
IWButton1.caption:=fGridSelection;
webapplication.showmessage('1234 for fun');
end;
procedure TIWForm1.IWButton1AsyncClick(Sender: TObject;
EventParams: TStringList);
begin
// Use the async click to execute a callback function on the browser side.
// Compute and send Timezone Offset minutes and pass as parameter
// Also put it in IWEdit1, using javascript on the browser side.
WebApplication.
CallBackResponse.
AddJavaScriptToExecute(
'var d = new Date();' + sLineBreak +
'var tn = d.getTimezoneOffset();' + sLineBreak +
'document.getElementById("IWEDIT1").value = tn;' + sLineBreak+
'ajaxCall("clbkGridSel", "Selection="+tn, false);'
);
end;It's not pretty or efficient, but see if that helps understanding.
Dan

