Help Balloons for Movable Modal Dialogs
Help Balloons for Movable Modal Dialogs
Although the Help Manager handles displaying balloon help for
modal dialog boxes, when it comes to movable modal dialogs a great deal
of the implementation is left to the application. The application must
call the EnableItem, DisableItem, and HMSetMenuResID
routines. HMSetMenuResID is used before and after enabling or
disabling the menus, and maps an alternative 'hmnu' resource to your
menus.
Listed below are two sample 'hmnu' resources. The first one uses the
same strings that the Help Manager shows when a Modal Dialog Box
is on the screen. KHMHelpID selects a STR# resource in the System
and the constants 31 and 32 refer to the string index within that
resource.
resource 'hmnu' (256,"System Movable Modal Dialog hmnu") {
HelpMgrVersion,
hmDefaultOptions, // options
0, // balloon definition function
0, // variation code
// missing items information
HMStringResItem {
0, 0,
kHMHelpID, 31,
0, 0,
0, 0,
},
{
// menu title
HMStringResItem {
0, 0,
kHMHelpID, 32,
0, 0,
0, 0,
},
}
};
If you want to display your own strings instead, you can map in your
own alternate 'hmnu' resource such as the following:
resource 'hmnu' (256,"Application Movable Modal Dialog hmnu") {
HelpMgrVersion,
hmDefaultOptions, // options
0, // balloon definition function
0, // variation code
// missing items information
HMStringItem {
"",
"This item is not available because it cannot be used with
"the About box on your screen.",
"",
"",
},
{
// menu title
HMStringItem {
"",
"This menu is not available because it cannot be used with
"the About box on your screen.",
"",
"",
},
}
};
After displaying the movable modal dialog box on the screen, the
application should disable inappropriate menus and items and map in
the alternate 'hmnu' resources:
menu = GetMHandle(mApple);
DisableItem(menu, 0);
HMSetMenuResID(mApple, 256);
menu = GetMHandle(mFile);
DisableItem(menu, 0);
HMSetMenuResID(mFile, 256);
menu = GetMHandle(mEdit);
DisableItem(menu, 0);
HMSetMenuResID(mEdit, 256);
After removing the movable modal dialog box from the screen, the
application must enable appropriate menus and items and unmap the
alternate 'hmnu' resources:
menu = GetMHandle(mApple);
EnableItem(menu, 0);
HMSetMenuResID(mApple, -1);
menu = GetMHandle(mFile);
EnableItem(menu, 0);
HMSetMenuResID(mFile, -1);
menu = GetMHandle(mEdit);
EnableItem(menu, 0);
HMSetMenuResID(mEdit, -1);
Note: The code fragments above do not provide any error
checking. You will want to check for a nil menu handle in each
case before calling DisableItem and EnableItem.