🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Closing an LGADialog programmatically

#64
From: Joey Gray
Date: Wed, 01 Nov 2000 01:30
76 lines
3746 bytes
In article <ejalbert-AE5652.14240329102000@nntp.stanford.edu>, Eric
Albert <ejalbert@stanford.edu> wrote:

> In article <291020001117102847%mjg@mac.com>, Joey Gray <mjg@mac.com> 
> wrote:
> 
> > 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.
> 
> That's not all that ideal, because it requires the class that includes 
> the StDialogHandler for the first dialog to know about the second, and 
> I'd rather not do that -- it makes that part of the code a good bit 
> harder to maintain.  It would work, but I'm hoping there's a better 
> solution.

okay, so your objection is that the first dialog handler must know
about the second dialog. doesn't it have to? how else do you open the
second dialog from within the first dialog?

obviously there's more to the code than in the example that i
presented, but the general idea is there. in the outer dialog, when you
click on the button which is supposed to trigger the open of the inner
dialog you call the method(s) which deal with the inner dialog. don't
you have to do at least something like that in your current code?

perhaps something like this:

void COuterDialog::DoDialog( ... )
{
  StDialogHandler outerHandler( ... );

  do {
    message = outerHandler.DoDialog();
    if (message == msg_OpenOtherDialog) {
      CInnerDialog::DoDialog( ... );
      message = msg_OK; // or msg_Cancel
    }
  } while (message != msg_OK && message != msg_Cancel);
}

void CInnerDialog::DoDialog( ... )
{
  StDialogHandler innerHandler( ... );

  do {
    message = innerHandler.DoDialog();
    // ...
  } while (message != msg_OK && message != msg_Cancel);
}

perhaps you can have the inner dialog handler return some kind of
indicator as to how to deal with the outer dialog.

how does the code you have now pass control from the outer dialog to
the inner dialog?

-joey
Technical Details
Message-ID: <311020001930265668%mjg@mac.com>
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!sn-xit-03!supernews.com!logbridge.uoregon.edu!uchinews!news1.wiu.edu!newsfeed.acns.nwu.edu!news.acns.nwu.edu!mjg
References: <ejalbert-3C7D94.05135229102000@nntp.stanford.edu> <291020001117102847%mjg@mac.com> <ejalbert-AE5652.14240329102000@nntp.stanford.edu>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10bcce,b84d30989c34ff62
X-Google-Attributes: gid10bcce,public
X-Google-Thread: f635e,b84d30989c34ff62
X-Google-Attributes: gidf635e,public
X-Google-Thread: f7f77,b84d30989c34ff62
X-Google-Attributes: gidf7f77,public
X-Google-ArrivalTime: 2000-10-31 18:01:16 PST
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!sn-xit-03!supernews.com!logbridge.uoregon.edu!uchinews!news1.wiu.edu!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: Tue, 31 Oct 2000 19:30:26 -0600
Organization: Northwestern University, Evanston, IL, US
Lines: 76
Message-ID: <311020001930265668%mjg@mac.com>
References: <ejalbert-3C7D94.05135229102000@nntp.stanford.edu> <291020001117102847%mjg@mac.com> <ejalbert-AE5652.14240329102000@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