Of course you can.

Use this code.

void setLabelText(Word labelID, char *newLabel)
{
        FormPtr frm = FrmGetActiveForm();
        Word    labelObjectIndex = FrmGetObjectIndex(frm, labelID);

        FrmHideObject(frm, labelObjectIndex);
        FrmCopyLabel(frm, labelID, newLabel);
        FrmShowObject(frm, labelObjectIndex);

} // end setLabelText

You need to hide the label before changing the text, because if you don't
then the new label will appear on top of the old one, and if it's shorter,
then you'll have display issues.

Also, here's some notes from the reference guide about the FrmCopyLabel
function:
The size of the new label must not exceed the size of the label defined
in the resource. When defining the label in the resource, specify
an initial size at least as big as any of the strings that will be assigned
dynamically. [The function will] Redraw the label if the form�s usable
attribute
and the label�s visible attribute are set.

> -----Original Message-----
> From: Charles Rezsonya [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, December 02, 1999 9:59 AM
> To: [EMAIL PROTECTED]
> Subject: Labels
>
>
> hello,  i would like to know if i use a label on a form,.... can i changed
> it while the program is running?  ie,  a label says "the light is
> green" and
> a certain action is taken (ie, tap on button or specific event occours),
> can i change that label to say "the light is red"??
>
> thx
>

Reply via email to