3.3 Running FlexPendant Applications
3.3.5 FlexPendant TpsView attribute
© Copyri ght 200 7 - 2009 ABB . All ri ghts res erved.
3.3.5. FlexPendant TpsView attribute
OverviewA custom FlexPendant application must implement the assembly attribute TpsView. It is used to determine the visual appearance of the application in the ABB menu, for example. The TpsView attribute is auto generated and located before the namespace definition in the application view class, i.e. the class that displays the first view of a FlexPendant SDK application.
In this section all parameters of the TpsView attribute will be detailed. Project wizard settings
The TpsView attribute is auto generated according to your settings in the FlexPendant SDK
Project Wizard in Visual Studio:
6.2.2_1
In C# the settings of the figure will render this code:
[assembly: TpsView("MyApplicationName", "tpu-Operator32.gif", "tpu-Operator16.gif", "TpsViewHelloWorld.dll",
"TpsViewHelloWorld.TpsViewHelloWorld",
StartPanelLocation.Left, TpsViewType.Static, StartupType = TpsViewStartupTypes.Manual)]
3.3.5. FlexPendant TpsView attribute © Copyri ght 200 7 - 2009 ABB . All ri ghts res erved. NOTE!
You can edit your settings directly in the auto generated code if you want to.
Visual appearance
In run-time the most obvious result of this code is the way the custom application is presented in the ABB menu. In this example the first TpsView parameter has been changed from “MyApplicationName” to “Hello World”.
4.3.4_1
Application name
The first parameter of TpsView is the application name as it should appear in the ABB menu and on the task bar. The example uses “HelloWorld” as the application name.
Application icon
The second parameter is the file to be used as the application icon in the ABB menu. Usually a customized icon is used for the application.The example uses the default icon: “tpu- Operator32.gif".
TaskBar icon
The third parameter is the file to be used as the application task bar icon. The example uses the default icon "tpu-Operator16.gif".
Continued
3.3.5. FlexPendant TpsView attribute © Copyri ght 200 7 - 2009 ABB . All ri ghts res erved. Application assembly
The fourth parameter is the assembly name. If you change the name of the application assembly you also need to change this parameter to reflect that change. In the example, the assembly name is "TpsViewHelloWorld.dll".
NOTE!
The assembly name must start with “TpsView” for TAF to identify it as an application to be loaded. If you forget this an error will be generated by the ABB verification tool when you try to build the project.
Class name
The fifth parameter specifies the fully qualified class name of the initial view of your application, which you chose in the New Project dialog box. In the example, the fully qualified class name is "TpsViewHelloWorld.TpsViewHelloWorld".
Application location
The sixth parameter determines the location of the application icon and text in the ABB menu. In the example these are displayed in the left column: startPanelLocation.Left.
NOTE!
StartPanelLocation.None was introduced in 5.11.01. Applications that use it can therefore NOT be run on RobotWare releases older than 5.11.01.
Application type
As you can tell from the two Hello World icons visible in the task bar, two instances of the Hello World application have been started. To enable this the seventh parameter is changed to : TpsViewType.Dynamic. Possible view type values are shown in the table:
Parameter value Result
StartPanelLocation.Left application visible to the left in the ABB menu. StartPanelLocation.Right application visible to the right in the ABB menu. StartPanelLocation.None application is not visible at all in the ABB menu.
Parameter value Result
TpsViewType.Dynamic The user can start multiple instances of the application. TpsViewType.Static The user can only start one instance of the application. TpsViewType.Invisible A background application with no GUI and no icon on the task
bar. Can be started automatically or manually. Only one instance is possible.
Continued
3.3.5. FlexPendant TpsView attribute © Copyri ght 200 7 - 2009 ABB . All ri ghts res erved. NOTE!
Unless there is special need for it, you should allow the user to start only one instance of the application: TpsViewType.Static. The reason is that working with several instances takes up valuable memory resources.
Startup type
The eighth parameter determines how the application is started. In the example the startup type is TpsViewStartupTypes.Manual and the application is started from the ABB menu. Using the manual startup type it is also possible to have the application started by RAPID or at operating mode change to auto for example. See System features supporting the use of customized screens on page 78for information about how to do this.
If TpsViewStartupTypes.Automatic is chosen, the application is started automatically by TAF whenever the FlexPendant is restarted or a new user logs on.
Related information
For information about the Style setting of the Project Wizard, see Container style on page 97.
To find the FlexPendant SDK Project Wizard in Visual Studio, see Setting up a new project on page 80.
3.3.6. ITpsViewSetup and ITpsViewActivation © Copyri ght 200 7 - 2009 ABB . All ri ghts res erved.
3.3.6. ITpsViewSetup and ITpsViewActivation
ITpsViewSetupAn application that TAF needs to initialize must have a default (empty) constructor and must implement the interface ITpsViewSetup, which specifies the two methods Install and
Uninstall.
Install and Uninstall
Install is called when the application is created in TAF. The parameters are used by TAF and should not be modified. It is recommended to add code for further initiations and allocation of system resources in this method, e.g. load assemblies, open communication channels, etc.
When the user closes the application Uninstall is called. This happens right before the application is deleted. It is recommended to add code for disposal of system resources in this method, e.g. unload assemblies, close sockets, etc.
ITpsViewActivation
All custom applications should implement the ITpsViewActivation interface, which specifies the two methods Activate and Deactivate. These are used by TAF to notify applications when they get focus and when they lose it.
Activate and Deactivate
Activate is run every time the application gets focus. This happens at initialization, after the ITpsViewSetup.Install method has been run, and when the user presses the application icon in the task bar.
Deactivate, accordingly, is run every time the application loses focus. This happens when the user closes the application, before the ITpsViewSetup.Uninstall method has been run, and when the user presses another application icon in the task bar.
NOTE!
It is recommended to activate and deactivate timers in these methods. This way timers will not run when other applications are in focus, thus saving processor power. For the same reason, any subscription to controller events should be disabled in Deactivate and enabled again in Activate. Note that current values should be read before enabling the subscription. Simple code examples
This table shows the basic things that the ITpsView methods are used for in a custom appli- cation:
Method Usage
Install Create the Controller object: VB:
AController = New Controller
C#:
aController = new Controller();