Casio ClassPad 300 Programming Manual page 60

Sdk programming guide
Hide thumbs Also See for ClassPad 300:
Table of Contents

Advertisement

Now let's take a closer look at the parameters in each PegMenuDescriptionML. The first
two parameters decide the text that will appear as the title of the menu. If the first value
is defined, then the second value should be CMN_NO_ID. However, if the first value is
NULL, then the second value must be a valid ID into a language database (see the section
Multiple Language Support in the ClassPad).
In the above example, the values "Menu1" and "Menu2" are hard coded into the menu,
so there is no need for an ID into a language array. This means that regardless of the
current language of the ClassPad these menus will always have the values "Menu1" and
"Menu2". To make a menu that allows for multiple languages you would define your
menus as:
static PegMenuDescriptionML MainMenu[] =
{
{ NULL, MENU_2, 0, AF_ENABLED, SubMenu1 },
{ NULL, MENU_1, 0, AF_ENABLED, SubMenu2 },
{ NULL, CMN_NO_ID, 0, 0, NULL }
};
In this case MENU_1 and MENU_2 would have to be defined in a language enumeration
that corresponds to an entry in a language array.
The third parameter of the descriptor is the object ID of the menu. This ID is what is
used to create a signal. Since this is the top-level menu, we can leave these IDs as 0 to
prevent a signal from being sent. The fourth ID is a style flag, and the fifth parameter is
the name of the sub menu that will be opened by clicking on this menu.
Submenus are created the same way as main menus. When creating a submenu, be sure
to give it a signal ID or else you will not be able to respond to a user selection.
PegMenuDescriptionML SubMenu1[] = {
{"I'm fine.",
{"How are you?",
{"Hello",
{"", CMN_NO_ID, 0, 0, 0}
};
PegMenuDescriptionML SubMenu2[] = {
{"3", CMN_NO_ID, SUB2_3, AF_ENABLED, NULL },
{"2", CMN_NO_ID, SUB2_2, AF_ENABLED, NULL },
{"1", CMN_NO_ID, SUB2_1, AF_ENABLED, NULL },
{"", CMN_NO_ID, 0, 0, 0}
};
Once you have created all of your menus and submenus, you must override the virtual
function GetMenuDescriptionML() in your module. This function simply returns a
pointer to your main menu descriptor:
PegMenuDescriptionML* YourModuleWindow::GetMenuDescriptionML()
{
return MainMenu;
}
CMN_NO_ID, SUB1_3, AF_ENABLED, NULL },
CMN_NO_ID, SUB1_2, AF_ENABLED, NULL },
CMN_NO_ID, SUB1_1, AF_ENABLED, NULL },
60

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents