Clear Typehead

Clear Typehead

Postby Patricio Avalos Aguirre » Thu Aug 02, 2007 2: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...

Code: Select all  Expand view
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
User avatar
Patricio Avalos Aguirre
 
Posts: 1060
Joined: Fri Oct 07, 2005 1:56 pm
Location: La Serena, Chile

Postby jrestojeda » Thu Aug 02, 2007 2:46 pm

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

Prueba lo siguiente.
Saludos, Esteban.
User avatar
jrestojeda
 
Posts: 598
Joined: Wed Jul 04, 2007 3:51 pm
Location: Buenos Aires - Argentina

Postby Patricio Avalos Aguirre » Thu Aug 02, 2007 3: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
User avatar
Patricio Avalos Aguirre
 
Posts: 1060
Joined: Fri Oct 07, 2005 1:56 pm
Location: La Serena, Chile

Postby jrestojeda » Thu Aug 02, 2007 3: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
//
User avatar
jrestojeda
 
Posts: 598
Joined: Wed Jul 04, 2007 3:51 pm
Location: Buenos Aires - Argentina

Postby Francisco Horta » Thu Aug 02, 2007 4: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
Francisco Horta
 
Posts: 845
Joined: Sun Oct 09, 2005 5:36 pm
Location: la laguna, mexico.

Postby Patricio Avalos Aguirre » Thu Aug 02, 2007 4:02 pm

Asi tengo el final del la funcion ABM, igual el problem..! :-(

Code: Select all  Expand view
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
User avatar
Patricio Avalos Aguirre
 
Posts: 1060
Joined: Fri Oct 07, 2005 1:56 pm
Location: La Serena, Chile

Postby jrestojeda » Thu Aug 02, 2007 4:11 pm

Una pregunta:

Como estás defiendo el Boton para salir?
User avatar
jrestojeda
 
Posts: 598
Joined: Wed Jul 04, 2007 3:51 pm
Location: Buenos Aires - Argentina

Postby Patricio Avalos Aguirre » Thu Aug 02, 2007 4:48 pm

Code: Select all  Expand view
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
User avatar
Patricio Avalos Aguirre
 
Posts: 1060
Joined: Fri Oct 07, 2005 1:56 pm
Location: La Serena, Chile

Postby jrestojeda » Thu Aug 02, 2007 5: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
User avatar
jrestojeda
 
Posts: 598
Joined: Wed Jul 04, 2007 3:51 pm
Location: Buenos Aires - Argentina

Postby Patricio Avalos Aguirre » Thu Aug 02, 2007 8:00 pm

Encontre el problema

Mirando el metodo keydown() de la clase twbrowse

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

Code: Select all  Expand view
/*
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
User avatar
Patricio Avalos Aguirre
 
Posts: 1060
Joined: Fri Oct 07, 2005 1:56 pm
Location: La Serena, Chile

Postby Francisco Horta » Thu Aug 02, 2007 8: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
Francisco Horta
 
Posts: 845
Joined: Sun Oct 09, 2005 5:36 pm
Location: la laguna, mexico.


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 127 guests