FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Bug in navigation key VK_ENTER
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Bug in navigation key VK_ENTER
Posted: Tue Jan 31, 2012 06:06 PM
In the following sample, please click on the checkbox and then hit Enter on the keyboard. The focus doesn't go to the button. It works fine without a TFolder. I'm using FWH 11.11 and have the manifest file in the resources.

Code (fw): Select all Collapse
#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oDlg, oFld, oBtn

    LOCAL lVar := .F.

    DEFINE DIALOG oDlg;
           RESOURCE "FOLDER"

    REDEFINE FOLDER oFld;
             ID 101 OF oDlg;
             PROMPTS "Test";
             DIALOGS "TEST"

    REDEFINE BTNBMP;
             ID 101 OF oFld:aDialogs[ 1 ];
             FILE "\fwh\bitmaps\open.bmp";
             NOBORDER

    REDEFINE CHECKBOX lVar;
             ID 102 OF oFld:aDialogs[ 1 ]

    REDEFINE BUTTON oBtn PROMPT "&Close";
             ID 201 OF oFld:aDialogs[ 1 ];
             ACTION oDlg:End()

    REDEFINE BTNBMP;
             ID 102 OF oDlg;
             FILE "\fwh\bitmaps\open.bmp";
             NOBORDER

    REDEFINE BUTTON;
             ID 201 OF oDlg;
             ACTION oDlg:End()

    ACTIVATE DIALOG oDlg;
             CENTER

    RETURN NIL


Code (fw): Select all Collapse
FOLDER DIALOG 49, 52, 365, 295
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Folder test"
FONT 8, "MS Sans Serif"
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
{
 CONTROL "", 101, "SysTabControl32", 0 | WS_CHILD | WS_VISIBLE, 5, 5, 265, 195
 PUSHBUTTON "&Close", 201, 5, 275, 40, 15
 CONTROL "", 102, "TBtnBmp", 0 | WS_CHILD | WS_VISIBLE, 280, 5, 30, 25
}

TEST DIALOG 49, 52, 365, 295
STYLE WS_CHILD
FONT 8, "MS Sans Serif"
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
{
 CONTROL "", 101, "TBtnBmp", 0 | WS_CHILD | WS_VISIBLE, 10, 10, 30, 25
 AUTOCHECKBOX "Checkbox", 102, 97, 74, 60, 12
 PUSHBUTTON "Button", 201, 103, 134, 50, 14
}


EMG
Posts: 1789
Joined: Tue Oct 11, 2005 05:01 PM
Re: Bug in navigation key VK_ENTER
Posted: Tue Jan 31, 2012 07:00 PM

enrico
11.12
it work ok.
click in the checkbox and press enter, the button Close have the focus.

the only bad thing is what press tab many time, and only controls out of folder have focus,
only press a control inside the folder and the chckbox have focus.

salu2

Salu2

Carlos Vargas

Desde Managua, Nicaragua (CA)
Posts: 1789
Joined: Tue Oct 11, 2005 05:01 PM
Re: Bug in navigation key VK_ENTER
Posted: Tue Jan 31, 2012 07:02 PM
hi have this mod in tcheckbox
Code (fw): Select all Collapse
METHOD KeyChar( nKey, nFlags ) CLASS TCheckbox

   IF nKey == VK_RETURN
      ::oWnd:GoNextCtrl( ::hWnd )
   ENDIF

RETURN Super:KeyChar( nKey, nFlags )

//----------------------------------------------------------------------------//

METHOD KeyDown( nKey, nFlags ) CLASS TCheckbox

   DO CASE
   CASE nKey == VK_UP
      IF Len( ::oWnd:aControls ) > 1
         ::oWnd:GoPrevCtrl( ::hWnd )
      ENDIF
   CASE nKey == VK_DOWN
      IF Len( ::oWnd:aControls ) > 1
         ::oWnd:GoNextCtrl( ::hWnd )
      ENDIF
   ENDCASE

RETURN Super:KeyDown( nKey, nFlags )


and in tbutton
Code (fw): Select all Collapse
METHOD GetDlgCode( nLastKey ) CLASS TButton

   ::oWnd:nLastKey := nLastKey

   IF ::oWnd:oWnd != nil .and. ( ::oWnd:oWnd:IsKindOf( "TFOLDER" ) .or. ;
                                 ::oWnd:oWnd:IsKindOf( "TFOLDEREX" ) )
      RETURN DLGC_WANTALLKEYS
   ENDIF

RETURN NIL
Salu2

Carlos Vargas

Desde Managua, Nicaragua (CA)
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: Bug in navigation key VK_ENTER
Posted: Tue Jan 31, 2012 09:48 PM

Thank you Carlos! :-)

EMG

Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Bug in navigation key VK_ENTER
Posted: Thu Feb 02, 2012 11:46 PM

Carlos,

METHOD KeyDown( nKey, nFlags ) CLASS TCheckbox added for 12.02, thanks! :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1789
Joined: Tue Oct 11, 2005 05:01 PM
Re: Bug in navigation key VK_ENTER
Posted: Fri Feb 03, 2012 03:51 AM

gracias antonio por considerar mis fix. :-)

estoy realizando una validacion del correcto movimiento de foco en radiobuttons en folders, los cuales de momento me estan
fallando, preparare un demo de esto pronto.

salu2
carlos vargas

Salu2

Carlos Vargas

Desde Managua, Nicaragua (CA)
Posts: 1789
Joined: Tue Oct 11, 2005 05:01 PM
Re: Bug in navigation key VK_ENTER
Posted: Fri Feb 03, 2012 04:00 AM
antonio, look this fix.
Code (fw): Select all Collapse
CLASS TRadioFROM TControl
    ....
   METHOD KeyChar( nKey, nFlags )
   ....
endclass

//----------------------------------------------------------------------------//

METHOD KeyChar( nKey, nFlags ) CLASS TRadio

   IF nKey == VK_RETURN
      ::oWnd:GoNextCtrl( ::hWnd )
   ENDIF

RETURN Super:KeyChar( nKey, nFlags )

//----------------------------------------------------------------------------//
Salu2

Carlos Vargas

Desde Managua, Nicaragua (CA)
Posts: 1789
Joined: Tue Oct 11, 2005 05:01 PM
Re: Bug in navigation key VK_ENTER
Posted: Fri Feb 03, 2012 04:01 AM
Antonio, please run this code, the second page in folder, look the jump of focus in radioitems.
in first radioitem if you use the left or right keys the focus junmp in radioitem is is corrects.
but if you use up or down key jump to first gets.

salu2


Code (fw): Select all Collapse
        #include "FiveWin.ch"

        function Main()

           local oDlg, oFnt, oFld, lVal := .T., cVar := space(25), cVar2 := space(25), nNivel:=1, lVar1:=.f., lVar2:=.t., lVar3:=.f.

           DEFINE FONT oFnt NAME "Tahoma" SIZE 0, -12
           
           DEFINE DIALOG oDlg SIZE 400, 300 FONT oFnt

           @ 0.5, 1 FOLDER oFld PROMPTS "One", "Two", "Three" SIZE 190, 120

           @ 1, 1  SAY "Hola1" SIZE 25, 12 OF oFld:aDialogs[ 1 ]
           
           @ 1, 10 GET      cVar                SIZE 80, 12 OF oFld:aDialogs[ 1 ]
           
           @ 3, 10 CHECKBOX lVal PROMPT "&Test" SIZE 80, 12 OF oFld:aDialogs[ 1 ]

           @ 5, 1  SAY "Hola2" SIZE 25, 12 OF oFld:aDialogs[ 1 ]
           @ 5, 10 GET      cVar2               SIZE 80, 12 OF oFld:aDialogs[ 1 ]      

          @ 1,  1 SAY "&Name:" OF oFld:aDialogs[ 2 ]
          @ 1,  6 GET cVar OF oFld:aDialogs[ 2 ]
          @ 2,  1 SAY "&Address:" OF oFld:aDialogs[ 2 ]
          @ 2,  6 GET cVar2 OF oFld:aDialogs[ 2 ]  

          @ 4,  1 CHECKBOX lVar1 PROMPT "&FivePro" OF oFld:aDialogs[ 2 ] SIZE 70, 11
          @ 5,  1 CHECKBOX lVar2  PROMPT "&Dialog"  OF oFld:aDialogs[ 2 ] SIZE 70, 11
          @ 6,  1 CHECKBOX lVar3 PROMPT "&Objects" OF oFld:aDialogs[ 2 ] SIZE 70, 11

          @ 4,  9 RADIO nNivel PROMPT "&Novice", "A&vanced", "&Expert" OF oFld:aDialogs[ 2 ]
       
           @ 7.3, 14 BUTTON "&Ok" ACTION oDlg:End()

           ACTIVATE DIALOG oDlg CENTERED

        return nil
Salu2

Carlos Vargas

Desde Managua, Nicaragua (CA)
Posts: 1789
Joined: Tue Oct 11, 2005 05:01 PM
Re: Bug in navigation key VK_ENTER
Posted: Fri Feb 03, 2012 04:13 AM
umm the code is the same, but the efect is diferent. :-)

Code (fw): Select all Collapse
METHOD KeyDown( nKey, nFlags ) CLASS TRadio

   do case
      case nKey == VK_DOWN .or. nKey == VK_RIGHT
           ::oRadMenu:GoNext()
           ::oRadMenu:aItems[ ::oRadMenu:nOption ]:SetFocus()
           return 0

      case nKey == VK_UP .or. nKey == VK_LEFT
           ::oRadMenu:GoPrev()
           ::oRadMenu:aItems[ ::oRadMenu:nOption ]:SetFocus()
           return 0
   endcase

return Super:KeyDown( nKey, nFlags )
Salu2

Carlos Vargas

Desde Managua, Nicaragua (CA)
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Bug in navigation key VK_ENTER
Posted: Sat Feb 11, 2012 08:07 AM
carlos vargas wrote:antonio, look this fix.
Code (fw): Select all Collapse
CLASS TRadioFROM TControl
    ....
   METHOD KeyChar( nKey, nFlags )
   ....
endclass

//----------------------------------------------------------------------------//

METHOD KeyChar( nKey, nFlags ) CLASS TRadio

   IF nKey == VK_RETURN
      ::oWnd:GoNextCtrl( ::hWnd )
   ENDIF

RETURN Super:KeyChar( nKey, nFlags )

//----------------------------------------------------------------------------//


Carlos,

Implementado, gracias :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Bug in navigation key VK_ENTER
Posted: Sat Feb 11, 2012 09:49 AM

Carlos,

Tu ejemplo aqui va bien con FWH 12.01. No hay diferencia entre flecha izq, der, arr, aba y luego pulsar enter

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1789
Joined: Tue Oct 11, 2005 05:01 PM
Re: Bug in navigation key VK_ENTER
Posted: Sun Feb 12, 2012 04:31 AM

aca me falla, el movimiento entre items de un radio group, funciona bien con las teclas izq y der, hacen el ciclo entre los items,
pero usando arriba o abajo, al llegar al ultimo item, el foco salta hacia el primer get del dialogo contenedor.
esto en folder.

salu2
carlos vargas

Salu2

Carlos Vargas

Desde Managua, Nicaragua (CA)
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Bug in navigation key VK_ENTER
Posted: Sun Feb 12, 2012 11:10 AM

Carlos,

Con que versión de FWH estás probando ?

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1789
Joined: Tue Oct 11, 2005 05:01 PM
Re: Bug in navigation key VK_ENTER
Posted: Sun Feb 12, 2012 05:29 PM

11.12

salu2
carlos vargas

Salu2

Carlos Vargas

Desde Managua, Nicaragua (CA)
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Bug in navigation key VK_ENTER
Posted: Sun Feb 12, 2012 11:58 PM
Carlos,

Aqui tienes tu ejemplo construido con las librerias más recientes:

http://code.google.com/p/fivewin-contributions/downloads/detail?name=carlos2.zip&can=2&q=

por favor pruébalo y me comentas, gracias :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com