> Regards,
> I must confess that knowing to program in Palm has been a really tough
> experience for me mostly because of the fact that there aren't much
> examples available to learn from (and adding to it that I come from a
> Java programming environment where in a matter of seconds you find
> tons of examples for everything). I am experimenting with hiding
> controls and I am getting an error, I have no idea where to call these
> methods from, I have the following code and I am getting a memory
> error (The lines of interest are the invoke of CtlHideControl and
> FrmHideObject):
>
> static Boolean CapurroFormHandleEvent(EventType* pEvent)
> {
> Boolean handled = false;
> FormType* pForm;
>
> switch (pEvent->eType) {
>
> case frmOpenEvent:
> pForm = FrmGetActiveForm();
> // CapurroFormInit(pForm);
> FrmDrawForm(pForm);
> CtlHideControl(GetObjectPtr(PuntajeField));
> FrmHideObject(GetObjectPtr(PuntajeLabel),
> FrmGetObjectIndex (pForm,
> PuntajeLabel));
> handled = true;
> break;
> case ctlSelectEvent:
> switch(pEvent->data.ctlSelect.controlID) {
> case CalcularBoton:
> handled = true;
> break;
> case RegresarBoton:
> FrmGotoForm(MainForm);
> handled = true;
> break;
> default:
> break;
> }
> break;
> default:
> break;
> }
>
> return handled;
> }
According to the Palm OS Reference section on CtlHideControl, "Don't
call this function directly; instead, use FrmHideObject which performs
the same function and works for all user interface objects." So, I'd
suggest not using CtlHideControl.
The error you're getting on FrmHideObject is probably because the
first parameter to FrmHideObject is a pointer to the form; you've got
a pointer to the label there instead. If you replace the
"GetObjectPtr(PuntajeLabel)" with "pForm" on the FrmHideObject, and
replace the CtlHideControl with another call to FrmHideObject, it
should do what you want (you may need to put these before the call to
FrmDrawForm(), however.)
--
For information on using the PalmSource Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/