Application Class Reference

Commence Application object. More...

#include <application.h>

Inherited by Application.

List of all members.

Public Slots

void activate ()
 Activate the application.
QString applicationName () const
 Return the Application Name.
int currentScriptLevel (int level=-1)
 Contains the script level set by the script.
QString databaseDirectory () const
 DOS path of active Commence Database.
QString databaseName () const
 Name of the active Commence database.
int defaultScriptLevel () const
 Maximum script level.
QString getVersion () const
 Return the current Version of Commence.
bool isScriptLevelSupported (int level) const
 Is Script Level Supported.
QString name () const
 Application name.
QString programDirectory () const
 Commence program directory.
QString programName () const
 Commence .exe file name.
bool sameDatabase () const
 TRUE if database name hasn't changed.
QString title () const
 Application Title.
QString version () const
 Return the current Version of Commence.

Public Member Functions

Database database () const
 Access the Database API.

Detailed Description

Commence Application object.

This object represents the Commence Application wrapper object. This is the primary reference to the Commence database, when accessing anything from an external script or program. When the user registers his Commence database with the DumontROT, it is this object that actually gets registered. When the user then, later, requests a handle to one of the registered databases, he receives a pointer to this object.

All of the basic Commence Application object functions are supported transparently for software compatibility.

The following is a demonstration of using the Commence.Application object to access various properties of the Commence database, and also demonstrates how the Running Object Table (ROT) can be used to gain access to various registered databases. For detail on using the Running Object Table, refer to the cmcRot object. and also refer to the ROT function call.

vbScript Example ~ Accessing the Dumont ROT
 ' A vbScript example program to access more than one database.  In order for this
 '  script to run, the application must be registered in the cmcRot table.
 dim dexe: set dexe = createObject("Dumont.EXE")      ' hook dumont
 dim dapp: set dapp = dexe.application("dumont_test") ' request a database by name
 ' Print everything if possible
 if( not dapp is nothing ) then
   dexe.debug "dapp.currentScriptLevel: " & dapp.currentScriptLevel
   dexe.debug "dapp.databaseDirectory:  " & dapp.databaseDirectory
   dexe.debug "dapp.databaseName:       " & dapp.databaseName
   dexe.debug "dapp.defaultScriptLevel: " & dapp.defaultScriptLevel
   dexe.debug "               " &
   dexe.debug "dapp.programDirectory:   " & dapp.programDirectory
   dexe.debug "dapp.programName:        " & dapp.programName
   dexe.debug "dapp.sameDatabase:       " & dapp.sameDatabase
 end if

Definition at line 113 of file application.h.

Member Function Documentation

void activate (  )  [slot]

Activate the application.

This brings the application to the foreground.

Definition at line 522 of file application.cpp.

QString applicationName (  )  const [slot]

Return the Application Name.

The Application Name is slightly different than the databaseName() function call, or the cmcApplication::name() function call. The application name is a generic name that can be assigned to this instance of this application that is universal across the entire workgroup.

When requesting an application instance from the ROT, the specific database name in the databaseName() list can be used, the databasePath() can be used, or the applicationName() function call can be used. This allows external scripts to be written to call upon a database by this generic name rather a database name that might be unique for each client installation.

See also:

Definition at line 324 of file application.cpp.

int currentScriptLevel ( int  level = -1  )  [slot]

Contains the script level set by the script.

To change the script level (which controls the VBScript objects supported by Commence), assign the desired level to this property. The level must be greater than 0 and less than or equal to DefaultScriptLevel

 dim dexe: set dexe = createObject("Dumont.EXE") ' fetch Dumont
 dim dapp: set dapp =      ' wrap the Application Object
 dexe.debug "Level: " & dapp.currentScriptLevel  ' show the current level
 dapp.currentScript Level = 5                    ' change the level
 dexe.debug "Level: " & dapp.currentScriptLevel  ' show the new level
See also:
isScriptLevelSupported, defaultScriptLevel

Definition at line 350 of file application.cpp.

Database database (  )  const

Access the Database API.

This returns a wrapped commence database object.

See also:

Definition at line 509 of file application.cpp.

QString databaseDirectory (  )  const [slot]

DOS path of active Commence Database.

ie., c:\commence\data\

Definition at line 363 of file application.cpp.

QString databaseName (  )  const [slot]

Name of the active Commence database.

This returns the name of the database. This is the same name that is registered in the Commence 'Open/Manage Database' dialog window. Given the example image shown, the following code will produce these results:

Definition at line 379 of file application.cpp.

int defaultScriptLevel (  )  const [slot]

Maximum script level.

contains the maximum script level supported by this version of Commence

Definition at line 392 of file application.cpp.

QString getVersion (  )  const [slot]

Return the current Version of Commence.

This function is provided for support for the Commence documentation. Note that the actual function call is wrong, according to the documentation and the actual call should be "Version" not "GetVersion". Making this call dispatches automatically to the correct "Version" call.

Definition at line 447 of file application.cpp.

bool isScriptLevelSupported ( int  level  )  const [slot]

Is Script Level Supported.

Definition at line 473 of file application.cpp.

QString name (  )  const [slot]

Application name.

usually Commence

Definition at line 405 of file application.cpp.

QString programDirectory (  )  const [slot]

Commence program directory.

often c:\commence, but more likely C:\Program Files\Commence

Definition at line 418 of file application.cpp.

QString programName (  )  const [slot]

Commence .exe file name.

often c:\commence\commence.exe

Definition at line 431 of file application.cpp.

bool sameDatabase (  )  const [slot]

TRUE if database name hasn't changed.

After Commence has opened, and registered itself with Dumont, it is possible for the user to open another database. That basically invalidates the Application object that initially got registered with Dumont. This function checks the name of the open database against the name of the database when the item was first registered. If it is the same, then this function returns true.

This function is used in the cmcRot::application() routines when fetching a handle to a Commence application from the running object table. If the database relative to that ROT entry has changed then the handle will be removed from the table, and an empty object pointer will be returned back to the caller.

Definition at line 495 of file application.cpp.

QString title (  )  const [slot]

Application Title.

This indicates the application title. This is the title that is shown in the main Commence window. This value depends on the name of the database, plus the Server/Client profile.

Title Examples
 Commence/SERVER - KES.sv3
 Commence/CLIENT - KES.mwp
 Commence/SERVER - Contact Manager
 Commence - My Standalone Database

Definition at line 545 of file application.cpp.

QString version (  )  const [slot]

Return the current Version of Commence.

This returns the current version of Commence.

Definition at line 460 of file application.cpp.

The documentation for this class was generated from the following files:

~ ~ ~ ~ ~ ~
Source Code without Comments is like a Cranberry Garland
without the berries. Comment your Code!
Commence Database Support User Group Forum
~ ~ ~ ~ ~ ~
Author: Mark Petryk
Lorimark Solutions, LLC