I'm using a selector trigger to bring up a modal editing form (to edit 
the string in the trigger), but when the modal form goes away, the size 
of the selector trigger remains the same, even though the text has 
correctly changed. Going to another form then back again corrects the 
problem, so I know the selector trigger has "the right stuff." I just 
haven't figured out how to ensure that it resizes correctly.

I've tried endless combinations of Hiding/Showing the control, saving or 
not saving the bits behind the modal form, etc., and nothing seems to 
work. 

The code looks basically as below (names changed to protect the 
innocent): note that I have a globally allocated string for the selector 
trigger label, since it will change often. It's initially attached to the 
control when I initialize the form, then retrieved for modification here.

Again, the modified text shows up when the modal editor goes away, but 
the auto-sizing feature of the selector trigger isn't getting invoked 
(text is clipped if it's longer than before, etc.).

static void EditThang( ControlPtr controlPtr )
{
        FormPtr         previousForm, editorForm; 
        UInt16          hitButton = EditorCancelButton;
        char            *str; // pointer to the global string for the selector trigger
        
        // Get the current form, init and activate the editor form
        previousForm = FrmGetActiveForm();
        editorForm = FrmInitForm( EditorForm );
        FrmSetActiveForm( editorForm );
        
        // Get the global string we're dealing with
        str = (char *)CtlGetLabel( controlPtr );
        
        // Set the string in the editing field in the modal form
        if( SetFieldTextFromStr( EditorField, str) )
        {
                // Text successfully set, so do the dialog
                FrmEraseForm( previousForm ); // We're not saving bits, so erase 
underneath first
                hitButton = FrmDoDialog( editorForm );
        }
        
        // If OK is hit, change the label in the control
        if( hitButton == EditorOKButton )
        {
                GetStrFromFieldText( EditorField,  str);
                CtlSetLabel( controlPtr, str ); // necessary? It's the same string, 
but 
                                   // this should notify the control that 
it changed
        }
        
        // Restore previous form and delete the editor
        if( previousForm )
        {
                FrmSetActiveForm( previousForm );
                FrmDrawForm( previousForm );
        }
        FrmDeleteForm( editorForm );
}
 

Any help appreciated.

Dave Johnson

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palm.com/devzone/mailinglists.html

Reply via email to