Config Library: 2 Module Information Routine

Up: GEOS SDK TechDocs | Up | Prev: 1 Providing the UI | Next: 3 Important Messages

The Preferences application needs to know some information about each module to present the trigger which allows the user into said module. Preferences does this by calling the second routine exported by the module library. Preferences expects this routine to fill in a blank PrefModuleInfo structure.

By filling in this structure, the routine describes the button that Preferences will use to represent the module. Also, you may specify a User Level for the module, so it will be presented only to users with enough expertise to use it. You may also ask that only users with certain privileges be given access to the module; without the proper privileges, they won't see it.

The Routine should have the parameters

void _pascal (*PrefModuleInfo)

For an example of such a routine, see Module Information Routine .

Code Display 22-3 Module Information Routine

void _pascal MPMGetModuleInfo(PrefModuleInfo *info)
{	/* We'll set up this structure for both system and user information */
 	moduleInfo->PMI_requiredFeatures = 0;
 	moduleInfo->PMI_prohibitedFeatures = 0;
 	moduleInfo->PMI_minLevel = UIIL_ADVANCED;
 	moduleInfo->PMI_maxLevel = UIIL_MAX_LEVEL;
 	moduleInfo->PMI_monikerList = @MPMMonikerList;
 	moduleInfo->PMI_monikerToken = moduleToken;
}
const GeodeToken moduleToken = { "MyPf", MANUFACTURER_ID_MINE };

The following information about the PrefModuleInfo structure may prove useful when writing the routine:

PMI_requiredFeatures
This field allows you to restrict the display of your module so that it will only appear to users which have certain privileges.
PMF_HARDWARE
These settings are for a user who has permissions to actually change the configuration of the workstation. In a network environment where users log in to different machines at different times, normal users would be prevented from changing the mouse drivers, video drivers, etc.
PMF_SYSTEM
These changes are more complex and potentially more damaging than the basic "user" changes, therefore, some users may be prevented from using these settings.
PMF_NETWORK
These are network settings. Generally only the system administrator should see these settings, as they affect the entire network.
PMF_USER
These are basic user changes. These settings are the most basic and least dangerous, controlling user preferences such as background color and screen saver types.
PMI_prohibitedFeatures
This flag field allows you to restrict the display of your module so that it will only appear to users who don't have certain privileges. If you had two modules, advanced UI and simple UI, one might be for the sysop and the other for normal users--this would keep the sysop's Preferences from being "cluttered" by the plain user module. The flags available are the same as those for PMI_requiredFeatures .
PMI_minLevel
This field allows you to specify the minimum User UI Level in which your module should appear. If the module's UI is very complicated and will confuse novice users, use this field to hide it from them.
PMI_maxLevel ;
This field allows you to specify the maximum User UI Level in which your module should appear. If you have two versions of your module--one for advanced users and one for novice users--use this field to hide the novice module from the advanced users.
PMI_monikerList
Like the moniker list for an application, this will provide the icon shown on the main Preferences screen. Create this using the Icon editor. You should have icon formats 64x40 color, 64x40 monochrome, and 64x18 monochrome.
PMI_monikerToken
A four character token and manufacturer ID by which to recognize the module.

Up: GEOS SDK TechDocs | Up | Prev: 1 Providing the UI | Next: 3 Important Messages