| United States-English |
|
|
|
![]() |
HP Help System Developer's Guide > Chapter 5 Creating and Managing Help DialogsCreating a Dialog Cache |
|
Because authors can create hyperlinks that request a new window, your application must be able to create an arbitrary number of help windows. But, creating and destroying widgets as they are needed can cause your application to run slower. So, to optimize performance and make efficient use of resources, caching help dialogs is recommended. A dialog cache is a list of the help dialogs that your application has already created. When the user dismisses a dialog, the widget stays in the cache instead of being destroyed. The next time the user requests help that would otherwise require a new widget, your application can scan the cache list looking for a dialog that isn't currently being used.
Example. The following type definition demonstrates a simple structure that you could use to build a dialog cache. Instances of this structure would be connected (via the next element) to form a linked list.
Example. The following FetchHelpDialog() function scans a dialog cache for a help dialog of the specified type and returns a Widget ID. If an unused dialog is not found, one is created, added to the cache and returned. (If you are viewing this example online, you can copy and paste this example directly into your source code to save the trouble of typing it.)
The example above assumes the following:
Example. The following function is called when a help dialog is closed (via the close callback):
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||