To start off, I'll give you some code... just in case you need it.
// The follow sets your insertion point to the field you want.
// It's called after the form is drawn
FrmSetFocus(frm_p, FrmGetObjectIndex(frm_p, FIELD_ID));
// This function gets the field pointer for an object... needed for later...
FieldPtr GetFocusObjectPtr()
{
FormPtr frm;
Word focus;
// Get a pointer to the active form and the index of the form object
with focus.
frm = FrmGetActiveForm();
focus = FrmGetFocus(frm);
// If no object has the focus return NULL pointer.
if(focus == noFocus)
return(NULL);
// Return a pointer to the object with focus.
return(FrmGetObjectPtr(frm, focus));
}
// This function is my menu event handler - modify to suit your needs
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;
}
return(handled);
}
This code should help you in your quest.
Regards,
--
Tim Astle
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/