At 8:28 PM -0400 6/4/01, Brian Smith wrote:
>Aha! Well, that being the case, I don't need to mess with storing a pointer,
>I'll just store the data itself - it's just a Boolean:
>
>FrmSetGadgetData(pForm, nGadgetIndex, &boolValue);
If you're storing the boolean *in* the pointer (i.e. the pointer *is* the boolean)
then I think you mean:
FrmSetGadgetData(pForm, nGadgetIndex, (void *)boolValue);
>Then, when I want to get the value, since FrmGetGadgetData( ) returns a
>pointer, I still have to do this:
>
>Boolean *pBoolVal = FrmGetGadgetData(pForm, nGadgetIndex);
>
>if (*pBoolVal == true) {
> //do something
>}
In your case, you won't be getting a pointer *to* a Boolean, you'll be getting a
pointer which *is* a Boolean:
if (pBoolVal) {
// do something
}
>Is that enough? Or do I have to first use MemPtrNew( ) to allocate memory
>for pBooVal, and when I'm done, use MemPtrFree to free it up?
You could, but that would be very wasteful for a Boolean, since the overhead of
allocating dynamic memory for 1 byte far exceeds 1 byte.
Regards,
Jim Schram
Palm Incorporated
Partner Engineering
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/