At 03:48 PM 3/29/2004, you wrote:
Do I have to keep the ControlPtr returned by CtlNewControl or can I
forget about it and leave it up to the form to free the allocated memory
upon deletion? If I don't keep this ControlPtr, can I recover it later
in the usual way with FrmGetObjectPtrFromID?

You can forget the pointer -- the actual control is stored in the form's block of memory. Remember, anytime you add a control to a form, you may have invalidated all the pointers to the form and its controls that you've retrieved in the past.


I don't understand the API Reference explanation for the formPP argument
of CtlNewControl. Can't I just pass the results of FrmGetActiveForm()?

Nope. This is the way for CtlNewControl to pass you back the new form pointer, since adding the control may have caused the form to be moved in memory.


-- Ben Combee, senior DTS engineer, PalmSource, Inc.
   Read "Combee on Palm OS" at http://palmos.combee.net/



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

Reply via email to