Navigation: Templates > Guide to all Templates > Extension Templates >====== FrameExtension Template ====== | |
The FrameExtension extension template adds two powerful features to any Application Frame; the ability to shut down any application when Windows shuts down , and the ability to dock your Clarion application on to the system tray.
The following options are available:
Enable ShutDown
Check this box to allow your application to close down when the Windows operating system is going to shut down.
Run only One Instance of the Application
Check this box to only allow a user to start one instnace of your application. If the user tries to start a second instance the running instance is given focus.
Make Topmost window
Check this box to make the Frame window 'topmost', so that it appears above all other windows.
Enable Tray Icon
Check this box to allow your application to be minimized in the system tray instead of the system toolbar. By default the icon used in the system tray is the same icon that is assigned to the application frame.
SetToTrayOnLoseFocus
This option allows an application to be minimized to the system tray when losing focus.
This option is only active if no MDI child windows are opened. This “lose focus” option is designed to be used in applications with only one window (like the IPDRV service manager).
Tray Icon Tooltip:
Enter a valid string value to use as a tool tip. When your mouse moves over the system tray icon, the tool tip is displayed.
Press the Tray Icon Mouse Right Button Menu button to access an additional dialog that allows you to add a context menu to the system tray icon. Right-clicking on the system tray icon activates the popup menu.
The Context Menu interface allows you to construct custom menu items to add to the popup menu used with the system tray icon. You can select from a list of actions to attach to each menu item that you create.
Press the appropriate button to add (Insert), modify (Properties), or remove (Delete) a context menu item. The following options are available or the subsequent dialog.
Is a separator?
Check this box if you would like to add a separator line to your context menu. There are no other prompts associated with this action.
Menu Text
Enter the name of the context menu item to display.
When Pressed
No Special Action
The menu item will have no template-generated action associated with it. This option normally is used when you are using an embed point to control this menu's action.
Execute Routine
Enter a valid Routine Name here. Of course, you must have the ROUTINE defined within the scope of this procedure.
Post Event to Control
Select a valid Field Equate from the drop list to post an event to the Control. Select an Accepted or Selected Event to post to the control from the drop list provided.
Call a Procedure
The Context Menu interface uses the standard interface for calling a procedure. If you need more detailed help here, see the following topic.
Run a Program
The Context Menu interface also uses the standard interface for running a program. If you need more detailed help here, see the following topic.
Embed and Class Support
The FrameExtension template is internally supported by the WindowExtenderClass ABC compliant CLASS, found in WINEXT.INC.
Although there is currently no detailed documentation available for all properties and methods in this class, the following information is provided as a quick primer in using some of the more important properties and methods.
The FrameExtension template derives a FrameExtension CLASS, which is initialized in the ThisWindow.Init WindowManager method.
After this method is initialized, you can use the SetAllowShutDown and SetAllowTrayIcon methods to control the support for Shutdown and the TrayIcon respectively. For example:
SetAllowShutDown(1) !Allow Windows shutdown while application is still active
Both methods use a BYTE value to set or disable the appropriate function.
The FrameExtension template also generates the following virtual methods for your use, through appropriate embed points:
TrayIconMouseLeft( )
Process the single click mouse event on the tray
TrayIconMouseRight( )
Process the single right-click mouse event on the tray
TrayIconMouseLeft2( )
Process the double click mouse event on the tray
TrayIconMouseRight2( )
!Process the double right-click mouse event on the tray
ProcessShutDown( )
Process the Window Shutdown while the application is active. If the return value of this method is TRUE (1), the shutdown will continue. If the return value of this method is FALSE (0) the shutdown will not continue (it will be stopped).
Finally, there are two other methods that you can use at any time after the class has been initialized:
RestoreFromTray( )
If the application is present on the system icon tray, a call to this method will remove the icon, unhide and show the active window.
SendToTray( )
If this method returns TRUE (1), the process of adding the icon to the tray and hiding the window was successful.