You can use the same menu for each form.  It's quite simple actually.

In each form you create, just put the menu ID number in the field which
requests it.  Then in each of your form's event handlers, just use this:

// This is located in your form event handler
case menuEvent:
     return(EditViewDoCommand(event->data.menu.itemID));

I create a Event Handler function to for the Menu, which is more efficent
that typing it out in every form event handler you need to use it in.  I
just cut and pasted one of my Menu Event handlers for you to take a look at.
I figured this might help you out some.

Boolean EditViewDoCommand(Word command)
{
 FormPtr frm;
 FieldPtr fld;
 Boolean handled = false;

 switch (command)
 {
  case EditCut:     // Cut the text to the clipboard
   fld = GetFocusObjectPtr();
   if(fld)
    FldCut(fld);
   handled = true;
   break;

  case EditCopy:     // Copy the text to the clipboard
   fld = GetFocusObjectPtr();
   if(fld)
    FldCopy(fld);
   handled = true;
   break;

  case EditPaste:     // Do a paste from the clipboard
   fld = GetFocusObjectPtr();
   if(fld)
    FldPaste(fld);
   handled = true;
   break;

  case EditUndo:     // Undo the last text change
   fld = GetFocusObjectPtr();
   if(fld)
    FldUndo(fld);
   handled = true;
   break;

  case EditSelectAll:    // Select all of the text
   fld = GetFocusObjectPtr();
   if(fld)
    FldSetSelection(fld, 0, FldGetTextLength(fld));
   handled = true;
   break;

  case EditKeyboard:    // Display the on screen Keyboard
   SysKeyboardDialog(kbdAlpha);
   handled = true;
   break;

  case EditGraffiti:    // Display the Graffiti reference screen
   SysGraffitiReferenceDialog(referenceDefault);
   handled = true;
   break;

  case GoToSelectTrip:
   // The Select Trip Menu Go To Option was selected, so move to the next
form!
   CurrentView = SelectForm;
   FrmGotoForm(CurrentView);
   handled = true;
   break;

  case GoToTripInformation:
   // The Select Trip Menu Go To Option was selected, so move to the next
form!
   CurrentView = NfoForm;
   FrmGotoForm(CurrentView);
   handled = true;
   break;

  case GoToDistances:
   // The Select Trip Menu Go To Option was selected, so move to the next
form!
   CurrentView = StartForm;
   FrmGotoForm(CurrentView);
   handled = true;
   break;

  case GoToFuelPurchases:
   // The Select Trip Menu Go To Option was selected, so move to the next
form!
   CurrentView = StartForm;
   FrmGotoForm(CurrentView);
   handled = true;
   break;

  case AboutAboutFuelFasTax:   // Display About Screen
   frm = FrmInitForm(AboutForm);
   FrmDoDialog(frm);
   FrmDeleteForm(frm);
   handled = true;
   break;
 }
 return(handled);
}

Regards,

--

Tim Astle



-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to