> From: S Santoso
>
> How do I change button label dynamicaly (using code warrior)?  Suppose I
> have a button label :
> test, then later on in the program I'd like to change this "test"
> to "print"
> label button.  Is there any function to change this button label.
>

First, create a global var to hold the new label, e.g.,

        Char gNewLabel[] = "print";

Then, when you want to change the label, use CtlSetLabel, e.g.,

        CtlSetLabel(FrmGetObjectPtr(frmP, FrmGetObjectIndex(frmP, MainTestButton)),
gNewLabel);

(This assumes the object ID of your button is MainTestButton and frmP is a
pointer to your form.)

The reason I suggest a global var for the label is that CtlSetLabel doesn't
make a copy of label -- it just points to the label you set.  So you have to
keep the label in memory for as long as the button label might be displayed.


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