Return to DK Summary

Scripting

HappyCommander

Derived from: none

Declared in: HappyCommander.h

HappyCommander is an example class to show how to command BeHappy from an application, to use it to display the documentation and help files.

The source is free, you can modify it as you want, and include it in your application. This is just an example, you'll probably have to change a few things.


Constructor and Destructor

HappyCommander()

                                                         
  

HappyCommander(const char *addOnName, const char *addOnFileName, const char *htmlIndex)

The constructor does nothing. It just copies the different names.


~HappyCommander()

                                                         
  

~HappyCommander()

Destroys the HappyCommander.


Member Functions

InstallAddOn()

                                                         
  

int InstallAddOn()

Checks if the add-on is installed in BeHappy's add-on folder. If it isn't, an alert box will open, asking if the user wants the add-on automaticaly installed. If he says yes, the add-on is installed. For this function to work, the add-on must be at first in the application's folder. Its name must be addOnFileName, as given to the HappyCommander() constructor. If the user wants it to be installed, it will simply be moved in BeHappy's add-on folder.

It can return one of the following values:

This function should be called when your application starts. (In BApplication::ReadyToRun(), as an example). This function doesn't launch BeHappy.


Show()

                                                         
  

int Show(const char *index = NULL, const char * topic = NULL)
int Show(const char *index, const char * fathertopic, const char * childtopic)

Select a particular index and/or topic to show in BeHappy. The following actions are performed:

  • If BeHappy isn't running, launch it
  • If BeHappy hasn't any window opened, open one
  • If the BeHappy window used by previous calls to Show() is still there, select it. And if it isn't there anymore, open a new one
  • Sets the selected BeHappy window to the correct book ( addOnName, as given to the HappyCommander() constructor).
  • Sets the window to the correct index (if index isn't NULL)
  • Sets the window to the correct topic (if topic isn't NULL)

    The second version can be used with indexes that have two lists. You can select the topic in the upper list with fathertopic and the one in the lower list with childtopic.

    It can return one of the following values:


    OpenHTMLIndex()

                                                             
      

    void OpenHTMLIndex()

    Open the file htmlIndex, as given to the HappyCommander() constructor. This function is called by Show() when BeHappy isn't found.


    Return to DK Summary