[EMAIL PROTECTED] wrote:

> I've got 2 fields that the users can cut and paste from in the same form, but by 
>bringing up the menu to select cut/paste etc. the application loses track of which 
>field had the insertion point. This means it really difficult to know which field to 
>get the FldCut etc. to operate on.
>
> Does anyone have any sample code/hints of how to get this working?

There may be an easier way to do this (something about fudging the menuids into the 
10000 range, but
I don't know the details), but here's how I generally do it...

  case MainEditUndo:
  case MainEditCut:
  case MainEditCopy:
  case MainEditPaste:
  case MainEditSelectAll:
       fld = GetFocusedField();
       if (!fld)
          return false;

       FldGetAttributes(fld, &attr);
       if (command == MainEditUndo)
          FldUndo(fld);
       else if (command == MainEditCut && attr.editable)
         FldCut(fld);
       else if (command == MainEditCopy)
          FldCopy(fld);
       else if (command == MainEditPaste && attr.editable)
          FldPaste(fld);
       else if (command == MainEditSelectAll)
          FldSetSelection (fld, 0,
            FldGetTextLength (fld));
       return true;


--
Adam Wozniak                     Senior Software Design Engineer
                                 Surveyor Corporation
[EMAIL PROTECTED]                4548 Broad Street
[EMAIL PROTECTED]          San Luis Obispo, CA 93401



-- 
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