I want to make a buttom where the client can be closed. Is there a command for that?
I want to make a buttom where the client can be closed. Is there a command for that?
Hi Kristen,
In InTouch you could use the wwcontrol command or sendkeys in a animation.
But they do not seem to work if placed in a symbol and used in OMI.
A way that I did is to create a Attribute in your ViewAppNamespace
Then set your layout up with a script capturing this and execute the sendkeys command.
'Close OMI
SendKeys("%{F4}");
MyViewApp.ViewAppNamespace.CloseOMI = false;
LogMessage("Close OMI initiated by user...");
Then you can trigger the Attribute from graphics animation
Perhaps there is a alternative way, but I was unable to find anything related to this in the documentation.
Using the sendkeys command (alt+f4) will not work if you have disabled the alt key to lock down your application.
Let me know if this works for you.
There are some other ways, but I think the best way is this one:
That IS a very good way, thanks for sharing!
I have used the following script in a button on a graphic to close the ViewApp:
dim wProcess as System.Diagnostics.Process;
wProcess = System.Diagnostics.Process.GetCurrentProcess();
wProcess.CloseMainWindow();
This might require Admin rights. Not sure, so check before using it in an environment where th operator does not have local admin rights.
Are minimize, maximize and restore functions also available for making custom buttons?
All the SDK capabilities are documented here on an installed environment: https://localhost:28808/AVEVA%20OMI%20SDK/#OMISDK.html (we are working on getting it onto docs.aveva.com). As far as I can tell, Minimizem Maximise and Restore are not exposed, but you may be able to get at them directly via the .NET framework.
WARNING: This is untested, so I'd appreciate if you can feed back here if it worked or not...
First you need to reference the PresentationFramework like this:
You should then be able to use statements like these in scripting:
System.Windows.Application.Current.MainWindow.WindowState= System.Windows.WindowState.Normal;
System.Windows.Application.Current.MainWindow.WindowState= System.Windows.WindowState.Minimized;
System.Windows.Application.Current.MainWindow.WindowState= System.Windows.WindowState.Maximized;
I did not get this to work. There seems to be a threading/ownership issue:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidOperationException: The calling thread cannot access this object because a different thread owns it.