On Sunday 25 July 2004 10:18 pm, druid wrote:

> I call a popup from main with a menu selection
> from the popup I have another menu
> WHen I select an Item form the Popup's menu I want the
> current popup to close and open the new popup

What I like to do is use frmUpdateEvent as a popup dispatcher.  In my main 
form's event handler, I'll do something like this:

case frmUpdateEvent:
    switch (e->data.frmUpdate.updateCode) {
    case frmRedrawUpdateCode:
        FrmDrawForm(FrmGetActiveForm());
        break;
    case UC_POPUP1_START:
        FrmPopupForm(POPUP1);
        break;
    case UC_POPUP1_STOP:
        /* maybe I want to do something whenever POPUP1 is dismissed */
        break;
    case UC_POPUP2_START:
        FrmPopupForm(POPUP2);
        break;
    case UC_POPUP2_STOP:
        break;
    }
    return true;

When I want to fire off a popup, I'll use FrmUpdateForm().  Likewise, from 
the popup's handler, I'll use FrmUpdateForm() to indicate to the "caller" 
that the popup has been dismissed.

For example, to start popup from anywhere:

FrmUpdateForm(MainForm, UC_POPUP1_START);

And inside the popup's handler, when I want to dismiss:

FrmUpdateForm(MainForm, UC_POPUP1_STOP);
FrmReturnToForm(MainForm);

And, as per your example, if I wanted to cause a transition from POPUP1 to 
POPUP2, I would do it one of two ways.

>From POPUP1:

FrmUpdateForm(MainForm, UC_POPUP1_STOP);
FrmUpdateForm(MainForm, UC_POPUP2_START);
FrmReturnToForm(MainForm);

Or I would put some logic in "case UC_POPUP1_STOP" to do it in the caller.  
That is more likely since I would want to snarf some stuff prior to the 
secondary popup.

To be honest, I don't really use UC_POPUP1_START.. I just FrmPopupForm() 
wherever I need it.  And I use multiple update codes depending on what type 
of popup dismissal (OK, Cancel, etc).  My point is, that using 
FrmUpdateForm() from your popup's handler is a way to notify the calling 
form what it should do next.

-- 
/* Chris Faherty <[EMAIL PROTECTED]> */

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to