Try

FormPtr form_ptr;
UInt16 objectID;

form_ptr = FrmGetActiveForm();
objectID = SomeFormSomeControlObjectID; /* example: MainFormExitButton */
CtrlSetUsable(FrmGetObjectPtr(form_ptr, FrmGetObjectIndex(form_ptr,
objectID)), true /* or false */ );

There's no need to explicitly declare the variables, you can just stick the
functions inside the "CtlSetUsable()", but it makes the code more readable.
Also, "FrmGetObjectPtr()" can be used to write another function (CW R6 has
an example of it as well):

void* GetObjectPointer(UInt16 objectID)
{
 FormPtr form_ptr  = FrmGetActiveForm();

 return FrmGetObjectPtr(form_ptr, FrmGetObjectIndex(form_ptr, objectID));
}

this way, you don't need to worry about the form_ptr outside this function
(unless you need to for some other reason!),
so the code becomes:

CtrlSetUsable(GetObjectPointer(MainFormExitButton), true /* or false */ );

hope this helps...

sasha


Charlie Grant <[EMAIL PROTECTED]> wrote in message
news:32497@palm-dev-forum...
>
> Thanks Russell.
>
> The CtlSetUsable() function uses a pointer to a ControlType.  How do I
find
> out what the ControlType is for my form (and also the ControlAttrType attr
> within the ControlType structure) ?
>
>
>
> -----Original Message-----
> From: Bulmer, Russell <[EMAIL PROTECTED]>
> To: Palm Developer Forum <[EMAIL PROTECTED]>
> Date: 07 December 2000 17:50
> Subject: RE: Set button to usable
>
>
> >> -----Original Message-----
> >> From: Charlie Grant [mailto:[EMAIL PROTECTED]]
> >>
> >> I am developing applications on a Symbol SPT1700 using Palm OS 3.2.
> >>
> >> I am using CodeWarrior V4.01
> >>
> >> How do you programmatically set a button on a form to USABLE ?
> >>
> >
> >Try CtlSetUsable().  Buttons are controls, so you mainly use the 'Ctl'
> >functions to manipulate them.
> >
> >
> >Cheers
> >Russell
> >
> >
> >NOBLE(STAR
> >Russell K Bulmer
> >Mobile Computing Consultant
> >Switch: +44 (0) 20 7629 4888
> >Mobile: +44 (0) 797 082 3259
> >[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
> >http://noblestar.com <http://noblestar.com/>
> >
> >
> >--
> >For information on using the Palm Developer Forums, or to unsubscribe,
> please see http://www.palmos.com/dev/tech/support/forums/
>
>
>



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