Article View: comp.windows.interviews
Article #1436Re: MOdal Dialogs
From: M.Rizzo
Date: Thu, 06 Jun 1991 10:22
Date: Thu, 06 Jun 1991 10:22
65 lines
2139 bytes
2139 bytes
In article <1991Jun5.141228@Pkg.Mcc.COM> steve@Pkg.Mcc.COM (Steve Madere) writes:
>
>What we had to do was to take over the run
>operation during display of the MD and refuse
>to pass on any events occurring outside the
>bounds of the local scene to their targets.
>
>Ours looks rather kludgey since it requires
>finding out what the boundary of the dialog box
>is and then checking every event to see if it
>occurred within this box.
I created a similar class for IV 2.6. The class re-defines
the Dialog Accept() member function to filter events
but instead of using the boundary, it checks
the event target field against each of the interactors
within the dialog box.
------------
/*
Accept() is the same as for Dialog class except that non-Dialog
events are filtered.
*/
boolean ExclusiveDialog::Accept() {
Event e;
int v;
state->SetValue(0);
v = 0;
do {
Read(e);
if (IsTargetInside(e.target, this)) {
e.target->Handle(e);
};
state->GetValue(v);
} while (v == 0 && e.target != nil);
return v == 1 || e.target == nil;
}
/*
IsTargetInside() determines whether a given target is the same
as the passed interactor i or is contained within i.
*/
boolean ExclusiveDialog::IsTargetInside(Interactor* target, Interactor* i) {
if (i == target) return true;
int num;
Interactor** intTable;
i->GetComponents(0, 0, intTable, num);
for(int j = 0; j < num; j++) {
if (IsTargetInside(target, intTable[j])) {
return true;
};
};
if (num) delete [num] intTable;
return false;
}
--------------
If anyone has found a better way, I'd like to hear from you please.
Michael Rizzo
Technical Details
Message-ID:
<7768@harrier.ukc.ac.uk>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!mcsun!ukc!harrier.ukc.ac.uk!mr3References:
<1991Jun5.141228@Pkg.Mcc.COM>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!mcsun!ukc!harrier.ukc.ac.uk!mr3 From: mr3@ukc.ac.uk (M.Rizzo) Newsgroups: comp.windows.interviews Subject: Re: MOdal Dialogs Message-ID: <7768@harrier.ukc.ac.uk> Date: 6 Jun 91 10:22:39 GMT References: <1991Jun5.141228@Pkg.Mcc.COM> Reply-To: mr3@ukc.ac.uk (M.Rizzo) Organization: Computing Lab, University of Kent at Canterbury, UK. Lines: 65