Bug in navigation key VK_ENTER

Bug in navigation key VK_ENTER

Postby Enrico Maria Giordano » Tue Jan 31, 2012 6: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: Select all  Expand view
#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: Select all  Expand view
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
User avatar
Enrico Maria Giordano
 
Posts: 8315
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Bug in navigation key VK_ENTER

Postby carlos vargas » Tue Jan 31, 2012 7: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)
User avatar
carlos vargas
 
Posts: 1683
Joined: Tue Oct 11, 2005 5:01 pm
Location: Nicaragua

Re: Bug in navigation key VK_ENTER

Postby carlos vargas » Tue Jan 31, 2012 7:02 pm

hi have this mod in tcheckbox
Code: Select all  Expand view

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: Select all  Expand view


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)
User avatar
carlos vargas
 
Posts: 1683
Joined: Tue Oct 11, 2005 5:01 pm
Location: Nicaragua


Re: Bug in navigation key VK_ENTER

Postby Antonio Linares » 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
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Bug in navigation key VK_ENTER

Postby carlos vargas » Fri Feb 03, 2012 3: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)
User avatar
carlos vargas
 
Posts: 1683
Joined: Tue Oct 11, 2005 5:01 pm
Location: Nicaragua

Re: Bug in navigation key VK_ENTER

Postby carlos vargas » Fri Feb 03, 2012 4:00 am

antonio, look this fix.
Code: Select all  Expand view


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)
User avatar
carlos vargas
 
Posts: 1683
Joined: Tue Oct 11, 2005 5:01 pm
Location: Nicaragua

Re: Bug in navigation key VK_ENTER

Postby carlos vargas » Fri Feb 03, 2012 4: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: Select all  Expand view


        #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)
User avatar
carlos vargas
 
Posts: 1683
Joined: Tue Oct 11, 2005 5:01 pm
Location: Nicaragua

Re: Bug in navigation key VK_ENTER

Postby carlos vargas » Fri Feb 03, 2012 4:13 am

umm the code is the same, but the efect is diferent. :-o

Code: Select all  Expand view

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)
User avatar
carlos vargas
 
Posts: 1683
Joined: Tue Oct 11, 2005 5:01 pm
Location: Nicaragua

Re: Bug in navigation key VK_ENTER

Postby Antonio Linares » Sat Feb 11, 2012 8:07 am

carlos vargas wrote:antonio, look this fix.
Code: Select all  Expand view


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
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Bug in navigation key VK_ENTER

Postby Antonio Linares » Sat Feb 11, 2012 9: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
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Bug in navigation key VK_ENTER

Postby carlos vargas » Sun Feb 12, 2012 4: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)
User avatar
carlos vargas
 
Posts: 1683
Joined: Tue Oct 11, 2005 5:01 pm
Location: Nicaragua

Re: Bug in navigation key VK_ENTER

Postby Antonio Linares » Sun Feb 12, 2012 11:10 am

Carlos,

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

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Bug in navigation key VK_ENTER

Postby carlos vargas » Sun Feb 12, 2012 5:29 pm

11.12

salu2
carlos vargas
Salu2
Carlos Vargas
Desde Managua, Nicaragua (CA)
User avatar
carlos vargas
 
Posts: 1683
Joined: Tue Oct 11, 2005 5:01 pm
Location: Nicaragua

Re: Bug in navigation key VK_ENTER

Postby Antonio Linares » 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
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 71 guests