Thanks again for your help. This works perfectly. Doug Stemen On Jan 24, 2012, at 2:39 PM, Robert Purves wrote: > > Bernie wrote: > >> Douglas Stemen wrote: >>> I am finishing conversion of one of my programs to FB5. >>> TEKEY tells me that an F key was pressed. Can some tell me how to get find out what F key is pressed? The old code no longer works, vKeyCode% returns a 0. > >>> char$=TEKEY$ >>> long if ASC(char$)=16 >>> vKeyCode%=PEEK(EVENT+_evtMessage+2)'F key was pressed >>> select case vKeyCode% >>> CASE 122 : key$ = "F1" >>> CASE 120 : key$ = "F2" >>> CASE 99 : key$ = "F3" >>> CASE 118 : key$ = "F4" >>> CASE 96 : key$ = "F5" >>> CASE 97 : key$ = "F6" >>> CASE 98 : key$ = "F7" >>> CASE 100 : key$ = "F8" >>> CASE 101 : key$ = "F9" >>> CASE 109 : key$ = "F10" >>> end select >>> end if >> >> Maybe install _kEventClassKeyboard/_kEventRawKeyDown handler on either the window or application and get F key code with: >> fn GetEventParameter( theEvent, _kEventParamKeyCode, _typeUInt32, NULL, sizeof( UInt32 ), NULL, @keyCode ) > > > > local fn DoEdit > '~'1 > dim as Str255 s > dim as ^EventRecord ev > s = tekey$ > if ( asc( s ) == 16 ) // FKey was pressed > ev = event > select switch (ev.message and _keyCodeMask) >> 8 > case 122 : s = "F1 " > case 120 : s = "F2 " > case 99 : s = "F3 " > case 118 : s = "F4 " > //... > end select > end if > tekey$ = s > end fn > > window 1 > on edit fn DoEdit > text , 13 > edit field 1,, (20, 20)-(300, 36) > HandleEvents > > > Robert P. > > > -- > To unsubscribe, send ANY message to: futurebasic-unsubscribe@... > To access the list archives, go to: http://freegroups.net/groups/futurebasic/ >