[comp.sys.mac.programmer] Non-function Cmd Keys with DA

shane@chianti.cc.umich.edu (Shane Looker) (07/23/88)

I'm completely stumped on this one.  I've written a DA which puts up a menu
which has a number of items.  I can select the About box by hitting Cmd-A
or I can close the DA with Cmd-Q.  I also have Cmd-O to open a window.
(Up to 5 windows right now.)

As soon as I bring up a window (Cmd-O or mouse selection), my Cmd keys go
dead.  I can still use the mouse to select the menu items, and they work,
but no Cmd Keys.

Possibly relevant points.  I am not attaching the first window to the 
Device Control Entry filed for the DA Window.  I had stuffed a dummy window
in there but it made no difference.  (Possibly related bug, I could not make
that window invisible.  I created the window with NewWindow and explicitly  
made it invis.  I also called HideWindow as soon as it made the window.  
Something outside the DA is making the window visible!)

All this is being done in Lightspeed C 3.0.  When I try to debug the DA with
the debugger, it appears that SystemEvent is claiming that it handles the
event (which it should I think), but my DA never gets called with the
menu selection.

The DA behaves the same way if I open it with Suitcase (not under MF), or
if I build it into an application to use with the debugger.
 
Any help would be greatly appreciated.

Shane Looker
Looker@um.cc.umich.edu

spector@vx2.GBA.NYU.EDU (David HM Spector) (07/23/88)

What exactly is the code you are using the handle the keydown event?

You might take a look at (my) generic C DA for LightSpeedC which is
in the Info-Mac archives on Sumex-Aim... it handles command keys, et al.

David
-------------------------------------------------------------------------------
David HM Spector				New York University
Senior Systems Programmer			Graduate School of Business
Arpa: SPECTOR@GBA.NYU.EDU			Academic Computing Center
UUCP:...!{allegra,rocky,harvard}!cmcl2!spector	90 Trinity Place, Rm C-4
HamRadio: N2BCA      MCIMail: DSpector          New York, New York 10006
AppleLink: D1161     CompuServe: 71260,1410     (212) 285-6080
"What computer puts out work like this?"  "Hire us and we'll tell you."
XYZZYGLORP

spector@vx2.GBA.NYU.EDU (David HM Spector) (07/23/88)

What exactly is the code you are using the handle the keydown event?

You might take a look at (my) generic C DA for LightSpeedC which is
in the Info-Mac archives on Sumex-Aim... it handles command keys, et al.
Its DA-LSCGENERIC.HQX I think...

The window stuff _shouldn't be important, just make sure you put
(some one correct me if I'm wrong!) a nil WindowPtr there... otherwise
the window manager and its friends might get a bit upset.  Since you're
using THINKC (I've got to remeber to say that :-) you can keep the  window
stuff in an array and do all the updating work by hand...

David
-------------------------------------------------------------------------------
David HM Spector				New York University
Senior Systems Programmer			Graduate School of Business
Arpa: SPECTOR@GBA.NYU.EDU			Academic Computing Center
UUCP:...!{allegra,rocky,harvard}!cmcl2!spector	90 Trinity Place, Rm C-4
HamRadio: N2BCA      MCIMail: DSpector          New York, New York 10006
AppleLink: D1161     CompuServe: 71260,1410     (212) 285-6080
"What computer puts out work like this?"  "Hire us and we'll tell you."
XYZZYGLORP

shane@chianti.cc.umich.edu (Shane Looker) (07/26/88)

In article <6860009@vx2.GBA.NYU.EDU> spector@vx2.GBA.NYU.EDU (David HM Spector) writes:
>What exactly is the code you are using the handle the keydown event?
>
>You might take a look at (my) generic C DA for LightSpeedC which is
>in the Info-Mac archives on Sumex-Aim... it handles command keys, et al.
>Its DA-LSCGENERIC.HQX I think...
>
>The window stuff _shouldn't be important, just make sure you put
>(some one correct me if I'm wrong!) a nil WindowPtr there... otherwise
>the window manager and its friends might get a bit upset.  Since you're
>using THINKC (I've got to remeber to say that :-) you can keep the  window
>stuff in an array and do all the updating work by hand...
>
>David

Bad news, David.  Your code doesn't handle CMD-Keys either.  I just grabbed
it and put a command key into the About item.  Closer inspection indicates
that an Event, not a MenuSelection is being passed to the DA.  The event
is just the keydown of whatever key you are using with the Cmd key.

Now for some more information.  If I don't set the windowKind field, then 
Cmd-Keys continue to work just file.  I can't drag the window which is right.
If I set the windowKind field to dce->dCtlRefNum, the window drags, but
the Cmd is stripped off and I get just the keyDown event.

Has anybody else seen this?  Is it me?  Is it just my personality?  I'm
really starting to go crazy with this.

Shane Looker
Looker@um.cc.umich.edu 

shane@chianti.cc.umich.edu (Shane Looker) (07/26/88)

Well, I figured out the solution.  I just need to call MenuKey myself
when I get the keyDown event if the Cmd key is down.  I can not find 
this documented anywhere.  

So never mind.

Shane Looker
Looker@um.cc.umich.edu

spector@vx2.GBA.NYU.EDU (David HM Spector) (07/26/88)

Yikes!!!   You're right about generic DA.  I had forgotten all about
menuKey .vs. plain command keys.   Thanks for pointing that out!
...now I must off to the other side of the monitor.....!  :-)

			David
-------------------------------------------------------------------------------
David HM Spector				New York University
Senior Systems Programmer			Graduate School of Business
Arpa: SPECTOR@GBA.NYU.EDU			Academic Computing Center
UUCP:...!{allegra,rocky,harvard}!cmcl2!spector	90 Trinity Place, Rm C-4
HamRadio: N2BCA      MCIMail: DSpector          New York, New York 10006
AppleLink: D1161     CompuServe: 71260,1410     (212) 285-6080
"What computer puts out work like this?"  "Hire us and we'll tell you."
XYZZYGLORP