Best Practice (as of 2013) for Accelerator Keys

Brahmanathswami brahma at hindu.org
Mon May 27 17:43:44 CDT 2013


I have an old app (build circa 2002) that still runs amazingly well. I 
have done a few small updates over time, but the basics remain the same.

It is a transcription program that requires quicktime and functions like 
the old pedal deals where you stop and start the tape. I added other 
bells and whistles, like downloading .mp3 file from our server, save XML 
transcripts to the server via Post to a CGI and some user 
authentication...  and a spell checker dynamically downloaded 
dictionaries etc.

But the basics are simple: use picks an audio file (with a button) a 
path is set on a player... click "Play"... must wait a few seconds 
(5-10) for quicktime to register the time codes so that i can get a 
currentTime and then we use this in stop, back, forward, resume buttons.

Now:  loooooong ago I set up these keys:

-->Accelerators for buttons <--
command setUpAcceleratorKeys

set the acceleratorKey of button "Stop" to "1"
set the acceleratorModifiers of button "Stop" to alt
set the acceleratorKey of button "Back up" to "2"
set the acceleratorModifiers of button "Back up" to alt
set the acceleratorKey of button "Forward" to "3"
set the acceleratorModifiers of button "Forward" to alt
set the acceleratorKey of button "Resume" to "4"
set the acceleratorModifiers of button "Resume" to alt

end setUpAcceleratorKeys

But now I'm getting reports from a Windows 8 user that

a) the alt key does not in fact work on his machine for this, but the 
control key does...and apparently this is what you use on Windows Media 
Player
b) occasionally he will get a failure of "control-1"  which will not 
stop the player as expected. instead he has to hit "control-4" to 
resume  and *then* control-1 will work

Button "Stop"

on mouseUp
    set the playrate of player "TheTape" to 0
   put fld "theMovieTime" into fld "saveTime"
   disable button "back up"
   disable button "Forward"
end mouseUp

Button Resume

on mouseUp
   enable button "Back Up"
   enable button "Forward"
   if the hilite of btn "resumeBack" then
   send mouseup to btn "Back Up"
   exit mouseUp
   end if
   if the currentTime of player "theTape" = 0 then
     send mouseUp to button "Pick up from last session"
   else
      set the playrate of player "theTape" to fld "speed"
      --starts player "theTape"
   end if
end mouseUp

Those were my very naive days... today I would put these commands into 
commands in the card or stack script and call them from the buttons.

Also I have a menu  with Stop | Back | Forward | Resume|   and these 
also just ""ping" the buttons to do their work.

but I was never able to successfully append the right key codes to the 
end of the menu items such that they would work on both Mac and Windows.

So, what I'm looking for is today's best practices for accelerator keys 
that run cross platform, as my current method are, literally, 11 years 
old in this app.




-- 
Aum Shanti,
Brahmanathaswami

Kauai's Hindu Monastery
www.HimalayanAcademy.com




More information about the use-livecode mailing list