Article View: comp.sys.mac.oop.powerplant
Article #27Re: KHICommandZoomWindow and PowerPlant
From: David Dunham
Date: Fri, 01 Mar 2002 23:47
Date: Fri, 01 Mar 2002 23:47
68 lines
3384 bytes
3384 bytes
In article <B8A50CE7.CA6%jgagnon@nospam.com>, jgagnon
<jgagnon@nospam.com> wrote:
> I have an Lapplication and I added the standard OS X Window Menu.
>
> The problem is that PowerPlant don't handle correctly the Zoom command in
> the window menu. I think I must handle the command kHICommandZoomWindow,
> but i don't know how? Do you have hints about this problem?
You can register for the Carbon Event without switching the entire
application to Carbon Events:
// Since we're using a Carbon style command for Help, install a
Carbon Event handler for it
EventHandlerUPP upp = ::NewEventHandlerUPP(EventProc);
EventTypeSpec events[] = { kEventClassCommand,
kEventCommandProcess,
kEventClassCommand,
kEventCommandUpdateStatus };
ThrowIfOSStatus_(InstallApplicationEventHandler(upp, 2, events,
this, nil));
...
OSStatus ClayApp::HandleCarbonEvent(
EventHandlerCallRef inHandlerCallRef,
EventRef inEvent)
{
UInt32 eClass = ::GetEventClass(inEvent);
UInt32 kind = ::GetEventKind(inEvent);
OSStatus s;
HICommand hiCmd;
UInt32 actualSize;
s = ::GetEventParameter(inEvent, kEventParamDirectObject,
typeHICommand, nil,
sizeof(hiCmd), &actualSize, &hiCmd);
if (hiCmd.commandID == cmd_Help) {
if (kind == kEventCommandProcess) {
this->DoHelp();
} else { // kEventCommandUpdateStatus
if (UDesktop::FrontWindowIsModal()) {
// A modal window is in front, so don't allow the Help
window
::DisableMenuCommand(nil, cmd_Help);
} else {
::EnableMenuCommand(nil, cmd_Help);
}
}
return noErr;
}
s = ::CallNextEventHandler(inHandlerCallRef, inEvent);
return s;
} // HandleCarbonEvent
(though I think the zooming would be a window handler)
BTW, my app zooms just fine when I use that menu item. Or do you mean
that you don't get the chance to intercept it?
--
David Dunham A Sharp david@SPAM_B_GONE.a-sharp.com
http://www.pensee.com/dunham/
"I say we should listen to the customers and give them what they want."
"What they want is better products for free." --Scott Adams
Technical Details
Message-ID:
<010320021547094945%dunham@SPAM_B_GONE.pensee.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-post-01!supernews.com!corp.supernews.com!dunhamReferences:
<B8A50CE7.CA6%jgagnon@nospam.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10bcce,744ba315da92b299 X-Google-Attributes: gid10bcce,public X-Google-Thread: f635e,744ba315da92b299 X-Google-Attributes: gidf635e,public X-Google-Thread: f7f77,744ba315da92b299 X-Google-Attributes: gidf7f77,public X-Google-ArrivalTime: 2002-03-01 15:45:36 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-post-01!supernews.com!corp.supernews.com!dunham From: David Dunham <dunham@SPAM_B_GONE.pensee.com> Newsgroups: comp.sys.mac.oop.powerplant,codewarrior.mac,comp.sys.mac.programmer.codewarrior Subject: Re: KHICommandZoomWindow and PowerPlant Date: Fri, 01 Mar 2002 15:47:09 -0800 Organization: A Sharp, LLC Message-ID: <010320021547094945%dunham@SPAM_B_GONE.pensee.com> References: <B8A50CE7.CA6%jgagnon@nospam.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-transfer-encoding: 8bit Mail-Copies-To: nobody User-Agent: YA-NewsWatcher/4.0.3 X-Complaints-To: newsabuse@supernews.com Lines: 68