🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.mac.oop.powerplant
Article #62

Re: Closing an LGADialog programmatically

#62
From: Joey Gray
Date: Sun, 29 Oct 2000 17:17
62 lines
3143 bytes
In article <ejalbert-3C7D94.05135229102000@nntp.stanford.edu>, Eric
Albert <ejalbert@stanford.edu> wrote:

> In my application, I have an StDialogHandler that opens an LGADialog.  
> That dialog contains a button that, when clicked, creates another 
> StDialogHandler that opens another LGADialog (yes, I know that nested 
> dialogs are a poor UI).  When that second dialog closes, I want the 
> first dialog to close as well, but I can't get that to happen.  I've 
> tried all kinds of things:
> 
> -calling BroadcastMessage(msg_OK, nil);
> -calling mOKButton->SimulateHotSpotClick();
> -calling DoClose();
> -calling ((StDialogHandler *) 
> GetSuperCommander())->ListenToMessage(msg_OK, NULL)
> 
> among others, and not one of them closes that first dialog (OK, DoClose 
> does, but not correctly).  How do I get this code block to work?
> 
> ---
> StDialogHandler handler(kSecondDialogID, this);
> MyDialog *dialog = dynamic_cast<MyDialog *>(handler.GetDialog());
> ThrowIfNil_(dialog);
> 
> MessageT message;
> dialog->Show();
> do {
>    handler.DoDialog();
> } while(message != msg_OK && message != msg_Cancel);
> 
> if (message == msg_OK) {
>    // Close the current dialog as well, but how?
>    ...???...
> }

eric,

it's been a while since i've done this, but wouldn't your code look
something like this:

{
  StDialogHandler outerHandler( whatever... );

  do {
    message = outerHandler.DoDialog();
    if (message == msg_OpenOtherDialog) {
      StDialogHandler innerHandler( whatever... );

      // deal with the inner dialog here...
      message = msg_OK; // or msg_Cancel...whatever...
    }
  } while (message != msg_OK && message != msg_Cancel);
}

you could deal with the inner dialog in an entirely different method
(which is what i would do) but still set the "message" variable for the
outer dialog, after having dealt with the inner dialog, such that you
exit your while loop cleanly.

is that what you're looking for? HTH...

-joey
Technical Details
Message-ID: <291020001117102847%mjg@mac.com>
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!sn-xit-03!supernews.com!cyclone-sjo1.usenetserver.com!news-out.usenetserver.com!newsxfer.interpacket.net!news-hog.berkeley.edu!ucberkeley!newsfeed.acns.nwu.edu!news.acns.nwu.edu!mjg
References: <ejalbert-3C7D94.05135229102000@nntp.stanford.edu>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f7f77,b84d30989c34ff62
X-Google-Attributes: gidf7f77,public
X-Google-Thread: 10bcce,b84d30989c34ff62
X-Google-Attributes: gid10bcce,public
X-Google-Thread: f635e,b84d30989c34ff62
X-Google-Attributes: gidf635e,public
X-Google-ArrivalTime: 2000-10-29 09:25:20 PST
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!sn-xit-03!supernews.com!cyclone-sjo1.usenetserver.com!news-out.usenetserver.com!newsxfer.interpacket.net!news-hog.berkeley.edu!ucberkeley!newsfeed.acns.nwu.edu!news.acns.nwu.edu!mjg
From: Joey Gray <mjg@mac.com>
Newsgroups: comp.sys.mac.oop.powerplant,codewarrior.mac,comp.sys.mac.programmer.codewarrior
Subject: Re: Closing an LGADialog programmatically
Date: Sun, 29 Oct 2000 11:17:10 -0600
Organization: Northwestern University, Evanston, IL, US
Lines: 62
Message-ID: <291020001117102847%mjg@mac.com>
References: <ejalbert-3C7D94.05135229102000@nntp.stanford.edu>
NNTP-Posting-Host: c1148017-a.mntp1.il.home.com
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
User-Agent: YA-NewsWatcher/5.0.1