--- Pablo Chemes <[EMAIL PROTECTED]> wrote: > Hi, I need to change dinamically the label of a Push Button. > > Does someone have a sample of how to do it ?
Use CtlSetLabel(). > And How can I change the size or position of a button in the form? Use FrmGetObjectIndex() to get the current size and position. Use FrmSetObjectIndex() to change size or position. > And how to show or hide an object or button ? Use FrmShowObject() and FrmHideObject(); Here's an example of how to use these functions: frmP = FrmGetActiveForm(); ctrlP = (ControlType *)GetObjectPtr( YourButton ); indx = FrmGetObjectIndex( frmP, YourButton ); // get the object size FrmGetObjectBounds( frmP, indx, &bounds ); // we will move it 10px to the right and 30px down bounds.extent.x += 10; bounds.topLeft.y += 30; // hide the control before changing stuff FrmHideObject ( frmP, indx ); // set the new size and location FrmSetObjectBounds( frmP, indx, &bounds ); // set the new label CtlSetLabel( ctrlP, NewLabel ); // show it FrmShowObject ( frmP, indx ); The only thing you need to be careful of is when you change the label. You give it a pointer to a string (Char *) and it uses that string -- it does not make a copy of the string and use the copy. Therefore, the pointer to the string must remain valid as long as the control is displayed. Use a global var, or allocate the memory for the string when the form is initialized and free the memory when the form is removed. __________________________________________________ Do You Yahoo!? Yahoo! - Official partner of 2002 FIFA World Cup http://fifaworldcup.yahoo.com -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
