Creating UI in a CPModuleWindow 
Most, if not all, of the applications that you build will extend the CPModuleWindow to 
create your application’s main window.  This is because the CPModuleWindow makes it 
easy to create menus, toolbars and a status bar.  In this section we will discuss what needs 
to be done to create these user interface controls in a CPModuleWindow. 
 
Menus 
Struct Name  Style  Signals 
PegMenuDescriptionML BF_SEPARATOR 
BF_CHECKABLE 
BF_CHECKED 
BF_DOTABLE 
BF_DOTTED 
N/A 
 
To create a menu we must first define a menu description.  This description will identify 
what items will appear in each drop down menu.  The first descriptor we define holds the 
names of the main menu headers that will appear across the top of the screen: 
 
PegMenuDescriptionML MainMenu[] =  
{ 
{“Menu2”, CMN_NO_ID, 0, AF_ENABLED, SubMenu1 },  
{“Menu1”, CMN_NO_ID, 0, AF_ENABLED, SubMenu2 },  
{“”, CMN_NO_ID, 0, 0, 0} 
}; 
 
You may notice right away that the order of the menu seems backwards – that Menu2 is 
listed before Menu1.  This is the way that PEG is designed.  When the menus appear on 
the ClassPad, Menu1 will be the left most menu.  It is also required that the last entry in a 
PegMenuDescriptorML be a blank menu item. 
 
 
59