Page 1 of 1

tbfunction_pgExecuteRemote

PostPosted: Sat Nov 18, 2023 9:22 am
by John Robin Dove
Hi Clifton,
This may well be a stupid question but is there any difference between tbfunction_pgExecuteRemote("main", "tbfunction_pgTBObjSet", ["keys", "showWait"]); and top.keys.showWait()? I use both. Is that a problem?
John

Re: tbfunction_pgExecuteRemote

PostPosted: Sat Nov 18, 2023 2:06 pm
by Clifton
pgExecuteRemote() has considerably more features built into it. In does not just access the "main" window, but can asscess other window types that have been launched by the calling window. pgExecuterRemote() is able to access functions in non-Toolbook windows and retrieve data. This is really nice when using basic HTML files in windows and iframes and that must send data back to the calling window. In addition, if a function cannnot be executed, pgExecuteRemote() provide a more graceful exit mechanism so that your program doesn't just stop working. But as you showed in your example, if all that is needed is to call a function on an accessible object, you should be able to call it like you showed. It gets more complicated when that object is not readily available. pgExecuteRemote() can even do postMessage requests and then pass the data whenever the remote window responds.

So while is not absolutely necessary to use it, it can bridge the problems that can occur in a number of scenarios.

Clifton

Re: tbfunction_pgExecuteRemote

PostPosted: Sat Nov 18, 2023 2:51 pm
by John Robin Dove
Right. I understand. Thank you.