[futurebasic] Re: Key Down at Startup

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : September 1998 : Group Archive : Group : All Groups

From: MattBeedle@...
Date: Tue, 29 Sep 1998 23:25:09 EDT
I have the solution, try FN GETKEY BUDDY source, see if any key is down,
dowload it at:
http://www.geocities.com/SiliconValley/Heights/1125/FB/getkey.sit
read a little about it at 
http://www.geocities.com/SiliconValley/Heights/1125/FB/getkey.sit

> I'm trying to do something that should be trivial but must have (yet 
>  another) mental block (and, truth be told, it's been too long since I 
>  wrote any FB code). I'm building a faceless app that normally gets 
>  launched at system startup, does it's thing and quits. However, I want 
>  the user to be able to press the command key while manually launching to 
>  display/set the app's preferences. A previous version of the app allowed 
>  the user to press any alpha or number key as the app was being launched 
>  and I could catch it with INKEY, but as Macs get faster, it is getting 
>  nearly impossible to launch the app and get the key pressed in time for 
>  the app to catch it before it does it's voodoo facelessly (and you can't 
>  press an alpha or numeric key in the Finder anymore without the selected 
>  file being changed by the Finder). INKEY as you are aware, doesn't trap 
>  Control, Option, Command, etc. How do I set up event trapping to catch 
>  the keydown event on startup if there is one and display my preferences 
>  dialog (FN initialize), or drop on through and execute a function (FN 
>  doDeletes) then quit if there's not a keydown event in the queue on 
>  startup. Here's the original code that handled it using INKEY:
>  
>  LONG IF LEN(INKEY$)                    'is a key down at launch?
>    FN initialize                        'yes, open the prefs dialog
>    ON DIALOG FN doDialog                'handle prefs dialog events
>    DO
>      HANDLEEVENTS
>    UNTIL gQuit%                         'okay button sets gQuit%
>  XELSE                                  'no, just do the deletes
>    FN doDeletes
>  END IF        
>  IF gBeepPref% = _markedBtn THEN BEEP   'beep if beep pref is marked
>  END
>  
>  TIA for any helpful suggestions.
>  
>  Jeff