Page 1 of 1

Para Antonio - Combobox + bkeydown

PostPosted: Mon Apr 24, 2006 6:02 pm
by Rossine
Olá Antonio,

Veja no exemplo abaixo quando eu teclo "ESC" no GET ele me retorna a tecla pressionada. Já no COMBOBOX isto não está funcionando. Como fazer isto funcionar ?

Code: Select all  Expand view
#include "fivewin.ch"

function main()

   local oDlg, cCombo := "2", oCombo, oGet, cGet := space(10)
   local aItems := { "1", "2", "3" }

   DEFINE DIALOG oDlg FROM 2, 2 TO 18, 60 TITLE "Test" ;
      STYLE nOr( DS_MODALFRAME, WS_POPUP, WS_CAPTION, WS_SYSMENU, 4 )

   @ 1, 1 get      oGet   var cGet   SIZE 50, 12

   oGet:bkeydown := { |nKey| msgstop( nKey ) }

   @ 2, 2 COMBOBOX oCombo var cCombo ITEMS aItems SIZE 200, 100

   oCombo:bkeydown := { |nKey| msgstop( nKey ) }

   ACTIVATE DIALOG oDlg CENTERED

return nil



Obrigado,

Rossine.

PostPosted: Tue Apr 25, 2006 1:51 pm
by Rossine
Olá Antonio,

Eu fiz estas mudanças em COMBOBOX.PRG e funcionou :lol:

Code: Select all  Expand view
...
   METHOD KeyDown( nKey, nFlags )

   METHOD GetDlgCode( nLastKey )
...

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

METHOD KeyDown( nKey, nFlags ) CLASS TComboBox

   if ::bChange != nil
      Eval( ::bChange, nKey, nFlags, Self )
   endif

return Super:KeyDown( nKey, nFlags )

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

METHOD GetDlgCode( nLastKey ) CLASS TComboBox

   if Len( ::oWnd:aControls ) == 1
      return DLGC_WANTALLKEYS
   endif

  ::oWnd:nLastKey = nLastKey

return DLGC_WANTALLKEYS

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


Se isto estiver correto, seria possível incluir esta mudanças em FWH ? :D

Obrigado e abraços,

Rossine.

PostPosted: Wed Apr 26, 2006 9:10 am
by Antonio Linares
Rossine,

La tecla ESC se ruta al contenedor, es decir, a la caja de diálogo.

Si cambias GetDlgCode() entonces si se la das al control, pero no es un comportamiento estandard.

PostPosted: Wed Apr 26, 2006 11:25 am
by Rossine
OK Antonio :)

Gracias,

Rossine.