Interface HelpContext
- All Known Implementing Classes:
NFHelpContext
To provide context sensitive help:
The following is some example code which sets up context sensitive help:
1. (Optional) Set the name of each component for which help will be provided to its help topic id.
2. (Mandatory) Construct an instance of HelpContext in the component initialization method after all
3. (Optional) For any component who's name does not match its help topic id code the following:
>>>> helpContext.addHelpComponent( component, "topicId" );
4. (Optional) Supply a TextComponent to display the tool descriptions:
>>>> helpContext.setToolDescriptionDisplay( yourTextComponent );
public void addNotify() {
// Call parents addNotify method.
super.addNotify();
// This code is automatically generated by Visual Cafe when you add
// components to the visual environment. It instantiates and initializes
// the components. To modify the code, only use code syntax that matches
// what Visual Cafe can generate, or Visual Cafe may be unable to back
// parse your Java file into its visual environment.
//{{INIT_CONTROLS
setLayout(null);
setVisible(false);
...
showContentsButton = new java.awt.Button();
showContentsButton.setLabel("Show Contents");
showContentsButton.setBounds(insets().left + 216,insets().top + 108,96,24);
add(showContentsButton);
display = new java.awt.TextField();
display.setBounds(insets().left + 180,insets().top + 36,168,36);
add(display);
...
//}}
// Give the components a name that the help system recoginizes.
showButton.setName("TopicId_ShowContents");
// Create the HelpDeskContext. It will scan through and default a topic for each component.
helpContext = new HelpContextImpl( this, helpSystem, "YourContextId" );
// Since the component "display" name doesn't match its topic id re-add it to the HelpContext.
helpContext.addComponentHelp( display, "TopidId_Display" );
// Supply a TextComponent which will be used to display the tool descriptions.
helpContext.setToolDescriptionDisplay( statusField );
// Show help contents when showContens button is pressed.
showContentsButton.addActionListener(
// Anonymous inner class
new java.awt.event.ActionListener() {
public void actionPerformed( java.awt.event.ActionEvent event ) {
helpContext.showContents();
}
}
);
} // addNotify()
Supported API: true
Extendable: false