At 9:46 AM -0700 4/26/99, Elia J. Freedman wrote:
> // set the object's text label
> ctlP = GetObjectPtr(ctlID);
> infoP = CtlGetLabel(ctlP);
> StrCopy(infoP, string);
You shouldn't just replace the text of the label in a control. If you do
this, the OS has no way of knowing the text is different! Use CtlSetLabel
instead. CtlSetLabel will do the right thing to make sure the selector
trigger size changes.
As an added bonus, you can get rid of the hide/show stuff. CtlSetLable
will redraw the control for you.
The only slightly odd thing is that CtlSetLabel just saves the pointer you
pass in, it does not copy the text, so if the string is dynamic you need to
be a little bit careful about the memory management. In this case, it's
probably OK to re-use the buffer that's returned from CtlGetLabel, assuming
you've previously set the control's label to dynamic memory that you manage.
(Some control label text may actually be in ROM or protected memory, in
which case you won't be able to just jam the new characters in the same
buffer.)
--Bob