Most components that present a user interface have an item in the navigation tree. This item often presents a panel when the item is clicked but it can also simply fire an event that you handle in a custom manner.
Adding a tree item
The first thing that you typically do is add an item to the navigation tree.
NavItemHelpers in the sdk provides a much more convenient way of managing navigation items. However the examples in this section use the full low level APIs.
When creating your framework you have to wait until the ComponentUIAPI interface has been registered before you can use its functions. Your component will get a COMPONENT_NOTIFY_NEWINTERFACE message with a UUID of UIFRAMEWORK_INTERFACE_UUID when the host component framework is ready to be used.
The example below shows some code that creates an item in the navigation tree. Later on we show code to handle an activation event and create the window for the panel that is shown when the item is selected.
In the example above we have set treeItem.lParam to NULL. However this is a free form field and you may wish to set this to some object which is then used to process your events in a more object oriented fashion. e.g.
Getting notified of activation and deactivation
The pInterface member above points to an interface that will be used to handle events relating to your inserted item. The most common of these are NI_EVENT_ACTIVATE and NI_EVENT_DEACTIVATE which are called when the user selects your item in the tree and when they click away to another item.
Creating a custom panel
When the WMC needs you to create the window relating to your navigation tree item it calls the NavigationItemUIInterface interface function NavItemCreateWindow. In this function you need to return the HWND associated with your window.
Destroying your panel
When the WMC disconnects from a WinGate Engine, the entire window hierarchy is destroyed and all GUI components are unloaded. However, If you need to close your window under your control you can do so at any appropriate time such as in your component's Stop() function or when it receives a COMPONENT_NOTIFY_PREDISCONNECT message in it's Notify callback.