FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour TListBox refinement
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
TListBox refinement
Posted: Mon Feb 06, 2006 08:44 AM
The following sample shows that the Return key is not trapped by bKeyDown codeblock:

#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oDlg

    LOCAL oLbx

    LOCAL cVar := ""

    DEFINE DIALOG oDlg

    @ 1, 1 LISTBOX oLbx VAR cVar ITEMS { "Bert", "Carl", "William" }

    oLbx:bKeyDown = { | nKey | MsgInfo( nKey ) }

    @ 3, 1 BUTTON "&Close" ACTION oDlg:End()

    ACTIVATE DIALOG oDlg;
             CENTER

    RETURN NIL


A possible solution is to add the following method to TListBox class:

METHOD HandleEvent( nMsg, nWParam, nLParam ) CLASS TListBox

   if nMsg == WM_GETDLGCODE .and. nWParam == VK_RETURN
      ::oWnd:nLastKey := VK_RETURN
      return Super:KeyDown( nWParam, nLParam )
   endif

return Super:HandleEvent( nMsg, nWParam, nLParam )


EMG
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
TListBox refinement
Posted: Mon Feb 06, 2006 09:27 PM

Enrico,

It is curious that if you put the listbox on a Window then the Enter key can be trapped with bKeydown. I have not figured out why this is.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
TListBox refinement
Posted: Mon Feb 06, 2006 10:42 PM
James Bott wrote:Enrico,

It is curious that if you put the listbox on a Window then the Enter key can be trapped with bKeydown. I have not figured out why this is.

James


I don't know either. :-)

By the way: you look great! :-)

EMG
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
TListBox refinement
Posted: Tue Feb 07, 2006 10:27 AM

Enrico,

WM_GETDLGCODE doesn't supply any parameters. Is it an undocumented feature that the keystroke is provided ? Thanks,

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
TListBox refinement
Posted: Tue Feb 07, 2006 10:42 AM

I don't know, sorry, but it works. :-)

EMG

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
TListBox refinement
Posted: Tue Feb 07, 2006 10:46 AM

Enrico,

ok, added :)

Thanks!

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM

Continue the discussion