Documentation Archive Developer
Search

ADC Home > Reference Library > Technical Notes > Legacy Documents > Apple Applications >

Legacy Documentclose button

Important: This document is part of the Legacy section of the ADC Reference Library. This information should not be used for new development.

Current information on this Reference Library topic can be found here:

Control Panel Q&As

CONTENTS

This Technical Note contains a collection of archived Q&As relating to a specific topic--questions sent the Developer Support Center (DSC) along with answers from the DSC engineers. Current Q&A's can be found on the Macintosh Technical Q&A's web site.

[Sep 01 1993]






System 7 Finder filters Command-key messages from cdevs

Date Written: 9/25/91

Last reviewed: 6/14/93

Our cdevs no longer receive key-down messages with the Command key held down in System 7. Why is this?

This is true under System 7.0. Under System 6.0.x, when a cdev is brought up with the Control Panel active, the cdev is the only possible recipient of key-down or auto-key events. Under System 7.0, the Finder has become the event-switching center and now handles the passing of events to the cdev(s). You'll note that you can now have multiple cdevs open simultaneously. This design raised the potential problem that, with the Finder and other cdevs active at once, which one would be the target of the any command-key sequence.

If you use Command-F while a cdev is open, the Find dialog box appears under System 7.0. If a cdev is designed to respond to Command-F, should the Finder handle the command sequence as a command to Find, or send the sequence to the cdev?

To maintain the Finder user interface, engineering decided to translate all Command-key events to their respective cdev equivalents for those sequences which were published in Inside Macintosh Volume V. This means that instead of having to process Command-Z, V, C, or X, the cdev receives the appropriate undoDev, pasteDev, copyDev, or cutDev message. The Finder knows to send these messages to the cdev with the currently active window. Otherwise, the Finder filters Command-key messages from the cdev(s).

You can still determine whether the command key is held down by using the GetKeys function at the cdev's entry point, as shown in the following code sample:

pascal Handle
CDEVEntry(short message, short item, short numItems, short CPanelID,
    EventRecord *theEvent, Handle cdevValue, DialogPtr CPDialog)
{
   #pragma unused (CPanelID)   /* unused formal parameters */

   KeyMap  myKeys;
   CDEVHdl cdevStorage;
 ...

   cdevStorage = (CDEVHdl) cdevValue;
   if (message == macDev) {
   return( (Handle) 1); /*  run on all systems */
   }

   else if (cdevStorage != nil) {
   GetKeys(myKeys);
   if (myKeys[1] & 0x00008000)
   {
     /* Command key presently down */
   }
   ...

After determining whether the command key is held down, you need to determine the complete command key sequence by checking for other keys currently pressed in the KeyMap variable.

This solution doesn't resolve problems such as responding to Command-F or Command-G. Also, it's not clear what new keys might be grabbed by the Finder team for use in future system versions.

Back to top

'fwst' is window-position resource for cdevs

Date Written:: 8/25/91

Last reviewed: 6/14/93

What's the 'fwst' resource found in several System 7 cdevs as well as on the System 7 Golden Master CD? We want to make sure it's not a virus.

The 'fwst' resource is the window position resource for cdevs. Under System 7.0, each cdev now appears in its own window. This is unlike previous systems where they appeared in the Control Panel window. Well, since each cdev now has its own window, it is expected that the user will want to place the window in a location that is suited to the user and the cdev. To keep this information for the next time the cdev is called up, the Finder now keeps an 'fwst' resource in the cdev, whether or not you placed one in there yourself.

Back to top

7.0 Finder intercepts Control Panel command key menu events

Date Written: 3/14/91

Last reviewed: 6/17/91

Under System 7, Macintosh command key menu events no longer are passed to a Control Panel's main window and instead intercepted as Finder command key menu equivalents. Can I get around this?

Under System 7, all command-key equivalents refer to the menu bar. The problem lies in the fact that, if the Control Panel handles a command-keystroke, there is no way for the Finder to realize it. Although it's not really recommended, you could conceivably patch KeyTrans and, upon finding that your Control Panel is up and that a command-keystroke is being pressed, queue those in your own private queue that the Control Panel could then search in addition to the normal event queue. This is probably much more trouble than it is worth.

Back to top

Downloadables

Acrobat gif

Acrobat version of this Note (44K).

Download