by xhbcoder » Fri Oct 27, 2006 4:05 pm
Antonio,
Thanks for the quick reply.
>Check that the listbox has the focus:
>oListBox:SetFocus()
The list box has focused. But somehow fivewin cannot process the up/down arrow keys.
Here's fragment of the code:
@ 0,0 listbox aObject[AO_JOURNALLIST] fields headers 'Journal xx' alias 'ARRAY' pixel
#define LINES_NONE 0
aObject[AO_JOURNALLIST]:nLineStyle := LINES_NONE
// aObject[AO_JOURNALLIST]:AdjClient()
// Below statement does same as above and handles resize
aObject[AO_JOURNALWINDOW]:SetControl(aObject[AO_JOURNALLIST])
aObject[AO_JOURNALLIST]:bKeyChar := GetWndFrame():bKeyChar
// Apply font and color after journal list box is created 03/17/2004 11:42AM
activate window aObject[AO_JOURNALWINDOW] on init ( oRect:Apply( self ), ClickEvent( aObject[AO_JOURNALLIST], 'Journal' ) ) ;
valid oRect:Save( aObject[AO_JOURNALWINDOW] ) .and. lChildEnd()
// logmsg( 'res.txt','Font ' +'aObject[AO_JOURNALWINDOW]:oFont:hFont' +' handle: ' +char( aObject[AO_JOURNALWINDOW]:oFont:hFont ) )
aObject[AO_JOURNALWINDOW]:Refresh()
aObject[AO_JOURNALWINDOW]:SetFocus() // FW recommendation - jdd
aObject[AO_JOURNALLIST]:bKeyDown:={||msgInfo("KeyCode: "+str(LS_getKeyPressed())+ " lastkey:" +str(lastkey()) )}
Observation:
The b:KeyDown is invoked by FW when Up/down Arrow keys is pressed.
The value of nKeyPressed is 255 in both up/down Arrow keys.
*************************
function LS_getKeyPressed
*************************
local i:=0,nKeyPressed:=0
for i=0 to 255
//if getKeyStat(i)
if getAsyncKey(i)
nKeyPressed=i
exit
endif
next i
return nKeyPressed
***************
Gracias,