FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Clear Typehead
Posts: 1074
Joined: Fri Oct 07, 2005 01:56 PM
Clear Typehead
Posted: Thu Aug 02, 2007 02:35 PM
Estimados

tengo un browse el cual al presionar la tecla ENTER entra a un dialogo
pero resulta que dentro del dialogo si se presiona el boton salir vuelve a ejecutarse nuevamente, como si hubiera presionado enter nuevamente

mi pregunta es como limpiar el buffer del teclado...

lo estoy haciendo asi...

oBrw:bKeyDown  := { |nKey| iif( nKey = 13, (ABM( aDbf, .F., oBrw, lSoloLectura ), SysRefresh() ), NIL ) }


desde ya gracias
Saludos
Patricio

__________________________________________________________________
Version: Harbour 3.2.0dev (r1307082134),Compiler: Borland C++ 5.8.2 (32-bit)
PCode version: 0.3, FWH 13.2
http://www.sialm.cl
Posts: 601
Joined: Wed Jul 04, 2007 03:51 PM
Clear Typehead
Posted: Thu Aug 02, 2007 02:46 PM

oBrw:bKeyDown :={|nkey,nFlag| IF(nKey=13, ABMBancos(oDbf,oBrw,oDlg,nKey,oWnd), )}

Prueba lo siguiente.
Saludos, Esteban.

Ojeda Esteban Eduardo.

Buenos Aires - Argentina.

FWH - PellesC - DBF/CDX - ADS - Gloriosos .Bat - MySql - C# .net - FastReport

Skype: jreduojeda
Posts: 1074
Joined: Fri Oct 07, 2005 01:56 PM
Clear Typehead
Posted: Thu Aug 02, 2007 03:06 PM

gracias por responder pero igual sigue el problema

por ahora lo he dejado en comentario, solo con el dblclick del mouse

viendo post antiguo creo que no existe una solucion...

saludos..

Saludos
Patricio

__________________________________________________________________
Version: Harbour 3.2.0dev (r1307082134),Compiler: Borland C++ 5.8.2 (32-bit)
PCode version: 0.3, FWH 13.2
http://www.sialm.cl
Posts: 601
Joined: Wed Jul 04, 2007 03:51 PM
Clear Typehead
Posted: Thu Aug 02, 2007 03:18 PM

No te olvides de que dentro de tu funcion ABM debes refrescar el oBrw y ponerle el foco justo antes de terminar.

Es decir:

oBrw:bKeyDown :={|nkey,nFlag| IF(nKey=13, ABMBancos(oDbf,oBrw,oDlg,nKey,oWnd), )}

...
...

//
Function ABMBancos(oDbf,oBrw,oDlg,nKey,oWnd)

...
...

oBrw:Refresh()
oBrw:SetFocus()
Return nil
//

Ojeda Esteban Eduardo.

Buenos Aires - Argentina.

FWH - PellesC - DBF/CDX - ADS - Gloriosos .Bat - MySql - C# .net - FastReport

Skype: jreduojeda
Posts: 845
Joined: Sun Oct 09, 2005 05:36 PM
Clear Typehead
Posted: Thu Aug 02, 2007 04:00 PM

a mi me va bien,
prueba a usar:
nKey==VK_RETURN
en lugar de:
nKey=13
y no olvides cuando cierras el dialogo poner el foco en el browse
salu2
paco

____________________

Paco
Posts: 1074
Joined: Fri Oct 07, 2005 01:56 PM
Clear Typehead
Posted: Thu Aug 02, 2007 04:02 PM
Asi tengo el final del la funcion ABM, igual el problem..! :-)

ACTIVATE DIALOG oDlg CENTERED ON PAINT iif( valtype( oBrw ) = "O", oBrw:SetFocus(),)

dbART:OrdSetFocus( cOldkey )
dbART:GoTo( aRegi[1] )
dbFAM:Goto( aRegi[2] )
dbCLA:Goto( aRegi[3] )
aEval( aDbf, { |x| x:Load() } )
if Valtype( oBrw ) = "O"
	oBrw:Refresh()
	oBrw:SetFocus()
endif

RETURN( .T. )
//----------------------------------------------------------------------------//
Saludos
Patricio

__________________________________________________________________
Version: Harbour 3.2.0dev (r1307082134),Compiler: Borland C++ 5.8.2 (32-bit)
PCode version: 0.3, FWH 13.2
http://www.sialm.cl
Posts: 601
Joined: Wed Jul 04, 2007 03:51 PM
Clear Typehead
Posted: Thu Aug 02, 2007 04:11 PM

Una pregunta:

Como estĂĄs defiendo el Boton para salir?

Ojeda Esteban Eduardo.

Buenos Aires - Argentina.

FWH - PellesC - DBF/CDX - ADS - Gloriosos .Bat - MySql - C# .net - FastReport

Skype: jreduojeda
Posts: 1074
Joined: Fri Oct 07, 2005 01:56 PM
Clear Typehead
Posted: Thu Aug 02, 2007 04:48 PM
REDEFINE BUTTON ID 716 OF oDlg	;
				ACTION oDlg:End()    ;
			CANCEL


adjunto un pequeño video,..

http://www.bigupload.com/d=77487AC1

saludos
Saludos
Patricio

__________________________________________________________________
Version: Harbour 3.2.0dev (r1307082134),Compiler: Borland C++ 5.8.2 (32-bit)
PCode version: 0.3, FWH 13.2
http://www.sialm.cl
Posts: 601
Joined: Wed Jul 04, 2007 03:51 PM
Clear Typehead
Posted: Thu Aug 02, 2007 05:07 PM

Mira aparentemente estĂĄ todo bien.
A mi me funciona perfecto y lo Ășnico que se me ocurre es que tu proceso no estĂ© ingresando nunca al if que utilizas para poner el foco al salir de la funcion.

if Valtype( oBrw ) = "O"
oBrw:Refresh()
oBrw:SetFocus()
endif

Prueba poniendo un MsgInfo() dentro del If para ver si estĂĄ ingresando.
La verdad es lo Ășnico que se me ocurre. DeberĂ­a funcionar sin ningĂșn problema.
Saludos, Esteban

Ojeda Esteban Eduardo.

Buenos Aires - Argentina.

FWH - PellesC - DBF/CDX - ADS - Gloriosos .Bat - MySql - C# .net - FastReport

Skype: jreduojeda
Posts: 1074
Joined: Fri Oct 07, 2005 01:56 PM
Clear Typehead
Posted: Thu Aug 02, 2007 08:00 PM
Encontre el problema

Mirando el metodo keydown() de la clase twbrowse

METHOD KeyDown( nKey, nFlags ) CLASS TWBrowse

   local lRefresh

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

do case
   case nKey == VK_UP
       ::cBuffer:= ""
       ::GoUp()
bla...bla...


si que comente

/*
if ::bKeyDown != nil
    Eval( ::bKeyDown, nKey, nFlags, Self )
endif
*/


o bien podria dejarlo al final, bueno vere cual seria la mejor opcion

muchas gracias a todos los que respondieron

Saludos...
Saludos
Patricio

__________________________________________________________________
Version: Harbour 3.2.0dev (r1307082134),Compiler: Borland C++ 5.8.2 (32-bit)
PCode version: 0.3, FWH 13.2
http://www.sialm.cl
Posts: 845
Joined: Sun Oct 09, 2005 05:36 PM
Clear Typehead
Posted: Thu Aug 02, 2007 08:27 PM

patricio este el metodo keydown que tengo en la clase, probablemente tienes la ver no mas actual de la 17
METHOD KeyDown( nKey, nFlags ) CLASS TWBrowse

local lRefresh

do case
case nKey == VK_UP
::cBuffer:= ""
::GoUp()

  case nKey == VK_DOWN
       ::cBuffer:= ""
       ::GoDown()

  case nKey == VK_LEFT
       ::cBuffer:= ""
       If ::GoLeft()
          ::Refresh()
       EndIf

  case nKey == VK_RIGHT
       ::cBuffer:= ""
       If ::GoRight()
          ::Refresh()
       EndIf

  case nKey == VK_HOME
       ::cBuffer:= ""
       ::GoTop()

  case nKey == VK_END
       ::cBuffer:= ""
       ::GoBottom()

  case nKey == VK_PRIOR
       ::cBuffer:= ""
       if GetKeyState( VK_CONTROL )
          ::GoTop()
       else
          ::PageUp()
       endif

  case nKey == VK_NEXT
       ::cBuffer:= ""
       if GetKeyState( VK_CONTROL )
          ::GoBottom()
       else
          ::PageDown()
       endif

  case ::bSeek != Nil .and. !::lWorking .and. nKey == VK_BACK
       ::lWorking:= .T.
       ::cBuffer := SubStr( ::cBuffer, 1, Len(::cBuffer) - 1 )
       if "L" $ ValType( lRefresh:= Eval( ::bSeek ) ) .and. lRefresh
          ::nRowPos:= Max( Min( ::nLen, ::nRowCount ), 1 )
          ::Refresh()
       endif
       ::lWorking:= .F.

  case ::bSeek != Nil .and. ( nKey == VK_SHIFT .or. nKey >= 32 )
       // No Hacer nada !!!, pero respetar el Super.
       Super:KeyDown( nKey, nFlags )

  otherwise
       ::cBuffer:= ""
       If( ::bSeek != Nil .and. ::bUpdateBuffer != Nil, Eval( ::bUpdateBuffer ), )

       // Posibilidad de efectuar acciones con TABs 13/05/04
       if nKey == VK_TAB .and. ::bKeyDown != nil
          Eval( ::bKeyDown, nKey, nFlags )
       endif

       return Super:KeyDown( nKey, nFlags )

endcase

If( ::bSeek != Nil .and. ::bUpdateBuffer != Nil, Eval( ::bUpdateBuffer ), )

return 0
salu2
paco

____________________

Paco

Continue the discussion