Here are the screen shots of what I want to produce.
We should be familiar with the Main form and Menu bar from the Starter app created by CodeWarrior. Remember, this looks like:
From here, we want to create a new form and the menu items that go along with that form.
Some shortcuts:
1) Ctl k creates a new resource such as a Form, Alert, Menu Bar, ...
2) Ctl m while in the Menu Bar creates a new menu such as View, Edit, ...
3) Ctl - creates a separator between menu items
4) Tabbing on a particular menu item allows the creation of a shortcut
Once you have created the resources and changed the App Icons to match the above example, we want to test to see that all pieces of the UI are working correctly. For that, we need to add some functionality as follows:
1) Each form will need an Event-handler, so for the Pad form, let's start with a basic event-handler as follows:
static Boolean PadFormHandleEvent (EventPtr eventP) { Boolean handled = false; FormPtr frmP; switch (eventP->eType) { case frmOpenEvent: frmP = FrmGetActiveForm (); FrmDrawForm (frmP); handled = true; break; default: break; } return handled; }This basic event-handler will allow us to gain access to the Pad form and test the menus associated with this form.
We also need to add a ctlSelectEvent to the Main form so that if the user presses the New button, the Pad form is opened. This will look something like:
case ctlSelectEvent: switch (eventP->data.ctlSelect.controlID) { case MainNewButton: FrmGotoForm (PadForm); handled = true; break; default: break; } break;Finally, we need to add some code to the AppHandleEvent so that when control passes to the Pad Form, the event-handler for this form is set up. The code will look something like this:
case PadForm: FrmSetEventHandler (frmP, PadFormHandleEvent); break;