Hi,
How can I capture the change mode (CTRL + 2) from B panel to E panel using H5 script?
Thanks & Regards,
Arun Gopal.
I would probably attach a script to each panel, cache a value if change mode during onRequesting, then check from the second panel during initial run if the cache value exists (just remember to remove the cached value).
//First Scriptprivate onRequesting(args: CancelRequestEventArgs): void { this.log.Info("onRequesting");
if (args.commandType === "KEY" && (args.commandValue === "F3" || args.commandValue === "F4" || args.commandValue === "F12")) { return; // The user should be allowed to go back }
// Cache the fact it's change mode if (args.commandType === "LSTOPT" && args.commandValue === "2") { InstanceCache.Add(this.controller, "OIS101LstOpt2", "OIS101LstOpt2"); }}
//Second Script private run(): void { // If value exists, do something, then remove cache item. if (InstanceCache.ContainsKey(this.controller, "OIS101LstOpt2")) { //Do something InstanceCache.Remove(this.controller, "OIS101LstOpt2"); }}
The mode can be retrieved directly in your OIS101/E script:
this.changeMode = (this.controller.GetMode() == '2'); if (!this.changeMode) return;
Thank you for the solution, Iain. I will get back to you if needed.
Thank you for the solution, PRavnborg. I will get back to you if needed.
Works if the user don't press the Enter key in Second Panel before the Script loads.
In that case OnRequesting will not be activated.