Hey all,

I have a selector trigger question (selector triggers are those with the
dotted border around it).  Supposedly, this trigger is supposed to resize to
match the text string size, but the one I am working with doesn't do that.

Here is what I do in the handling routine:

case EditDateSelTrigger:
        DateSecondsToDate(TimGetSeconds(), (&gPrefs.date));
        DateToDOWDMFormat(gPrefs.date.month, gPrefs.date.day,
                                gPrefs.date.year+firstYear, gDateFormat, dateStr);
        SetObjectText(EditDateSelTrigger, dateStr, true);
        handled = true;
                break;

The set object text routine is as follows:

void SetObjectText      (Word ctlID, CharPtr string, Boolean visible)
{
        ControlPtr      ctlP = NULL;
        CharPtr         infoP = NULL;

        // hide the object if it is not visible
        if ( visible )
                ShowHideObject(ctlID, false);

        // set the object's text label
        ctlP = GetObjectPtr(ctlID);
        infoP = CtlGetLabel(ctlP);
        StrCopy(infoP, string);

        // show the object again if it was originally visible
        if ( visible )
                ShowHideObject(ctlID, true);
}

ShowHideObject text just hides the passed control or shows the passed
control.  The resource is set to account for the maximum length of one of
these items (dow mm/dd/yy).  The selector always stays this size, even
though the new information is displayed correctly.

Is the problem because it is pre-defined to xxx xx/xx/xx?  And if so, does
that mean I have to take care of setting and freeing memory every time I
want to attach a new date using MemPtrNew and MemPtrFree?

Thanks for the help.
Elia

Reply via email to