Sure.
In this sample the user can execute the button "Write" on the button bar with a mouse click or pressing the F2 key. I simply added a SetKey(VK_F2.. to make the same action.
Full executable available at
www.softwarexp.co.uk/beta/test.zipObviously I would like to use a "Alt-W" key in this case but - as I know - I can't assign an Alt-<nKey> to the SetKey function so I used a function key.
*****************
#include "fivewin.ch"
function main()
local oWnd
local nClrText
local oBar2
local oFont
DEFINE FONT oFont NAME "Ms Sans Serif" SIZE 0, -10
DEFINE WINDOW oWnd TITLE "Test"
SetKey( VK_F2, { || ExecFunc(2) } )
oBar2 := TC5StBar():New( 46,10, 400, 35, oWnd, rgb(227,239,255), RGB(171,207,255), .f., oFont, nClrText )
oBar2:lRightToLeft := .f.
oWnd:oTop := oBar2
oBar2:lBorder := .t.
oBar2:AddItem( "", "bmpsmall\cambios.bmp" , {||ExecFunc(1)}, {||.t.}, .f., "accesos" )
oBar2:AddItem( "Write (F2)", "bmpsmall\capital.bmp", {||ExecFunc(2)}, {||.t.}, .f., "write" )
oBar2:AddItem( "", "bmpsmall\crossref.bmp", {||ExecFunc(3)}, {||.t.}, .f., "tareas" )
oBar2:AddItem( "", "bmpsmall\datetime.bmp", {||ExecFunc(4)}, {||.t.}, .f., "diario" )
ACTIVATE WINDOW oWnd ;
ON INIT WndCenter( oWnd:hWnd )
return nil
function ExecFunc(nMode)
if nMode=2
msginfo("Write")
endif
return nil