Atozed Forums
The visibility of variables - Printable Version

+- Atozed Forums (https://www.atozed.com/forums)
+-- Forum: Atozed Software (https://www.atozed.com/forums/forum-1.html)
+--- Forum: IntraWeb (https://www.atozed.com/forums/forum-3.html)
+---- Forum: English (https://www.atozed.com/forums/forum-16.html)
+----- Forum: IntraWeb General Discussion (https://www.atozed.com/forums/forum-4.html)
+----- Thread: The visibility of variables (/thread-1949.html)



The visibility of variables - Сергей Александрович - 09-09-2020

Please help me. I can't figure out how to see (use) the variable described in the program in a JavaScript script. For example:

Public
mTextToPrint: String;
.....
procedure TfmViewCheck.IWAppFormShow(Sender: TObject);
begin
mTextToPrint := 'Текст для печати';
end;

язык JavaScript :
alert (mTextToPrint); - does not work


RE: The visibility of variables - Jose Nilton Pace - 09-09-2020

Hi, you need to create a JS var:
Code:
procedure TfmViewCheck.IWAppFormShow(Sender: TObject);
begin
  Self.JavaScript.Add('var mTextToPrint = "Текст для печати"');
end;
язык JavaScript :
Code:
alert (mTextToPrint);



RE: The visibility of variables - Сергей Александрович - 09-09-2020

Thanks! It works!