watch out!  because this sample function uses FrmCopyLabel, if the new label
is longer than the original label, you will corrupt memory by overwriting
past the end of the buffer!  it is pretty dangerous to use FrmCopyLabel
inside such a general function.


-----Original Message-----
From: Robert Baglin <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date: Wednesday, March 31, 1999 2:20 PM
Subject: Re: Changing Text on Button: How Programatically


>Michael,
>This works in my app. Just send it the ID of the Button and the text you
>wish to have displayed.
>
>/***********************************************************************
> * FUNCTION: LblChangeText
> * DESCRIPTION: Changes Label Text
> * PARAMETERS: wID: ID of Label, s: Text String for Label
> * RETURNED: nil
> ***********************************************************************/
>
>void LblChangeText (Word wID, char *s)
> {
> FormPtr pForm;
> Word wIndex;
>
> if (s == NULL) // Bad arg, do nothing
> return;
>
> pForm = FrmGetActiveForm();
> wIndex = FrmGetObjectIndex (pForm, wID);
> FrmHideObject (pForm, wIndex);
> FrmCopyLabel (pForm, wID, s);
> FrmShowObject (pForm, wIndex);
> }


Reply via email to