ESC na TxBrowse

Post Reply
User avatar
Ari
Posts: 128
Joined: Fri Feb 03, 2006 4:21 pm
Location: Brazil
Contact:

ESC na TxBrowse

Post by Ari »

estou usando o oBrw:bkeyDown na TxBrowse e não tá pegando a Tecla ESC

Ari
User avatar
Maurilio Viana
Posts: 252
Joined: Tue Oct 25, 2005 2:48 pm
Location: Garça/Garza/Heron City - Brazil
Contact:

Re: ESC na TxBrowse

Post by Maurilio Viana »

Ari, como é seu código pra testar isso?

Maurilio
User avatar
Ari
Posts: 128
Joined: Fri Feb 03, 2006 4:21 pm
Location: Brazil
Contact:

Post by Ari »

::oBrw:bKeyDown := {| nKey | ::Key( nKey ) }


method key( nKey ) CLASS myCLASS

if nKey == 27
... aqui nao passa
Elseif nKey == 32
... aqui ok
Elseif nKey == 12
... aqui ok
Endif

return nil
User avatar
Maurilio Viana
Posts: 252
Joined: Tue Oct 25, 2005 2:48 pm
Location: Garça/Garza/Heron City - Brazil
Contact:

Post by Maurilio Viana »

Deveria funcionar, troque o 27 por VK_ESC (ou VK_ESCAPE, não me recordo direito...)

Ou inclua uma msgalert para mostrar qual tecla ele esta pegando quando vc tecla ESC:

method key( nKey ) CLASS myCLASS
msgalert( nKey ) <======
if nKey == 27
...

[ ]'s
Maurilio
User avatar
Ari
Posts: 128
Joined: Fri Feb 03, 2006 4:21 pm
Location: Brazil
Contact:

Post by Ari »

eu coloquei o alert, o bkeyDown não captura o ESC, nem passa no ::Key()


:roll:
Ari
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Try bKeyChar
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
carlos vargas
Posts: 1421
Joined: Tue Oct 11, 2005 5:01 pm
Location: Nicaragua

Ayuda con bkeychar en txbrowse

Post by carlos vargas »

Amigos, me urge una ayuda con el bKeyChar de TxBrowse, estoy pasando de usar twbrowse a txbrowse, pero el bKeyChar no me funciona.

aca el codigo, si funciona sin problemas el bKeyDown

antes con el twbrose sin problemas..

esta funcion permite que estando en un browse el usuario presione una tecla en inmediatamente le aparece un cado capturando las siguientes pulsaciones para efectos de busqueda.

Code: Select all

    WITH OBJECT ( oBrw := TXBrowse():new( oDlg ) )
        :CreateFromResource( 101 )
        :cAlias                 := "CONT"
        :nColDividerStyle       := LINESTYLE_DARKGRAY
        :lColDividerComplete    := TRUE
        :nMarqueeStyle          := MARQSTYLE_HIGHLROW
        :lAllowRowSizing        := FALSE
        :lRecordSelector        := TRUE
        :nHeaderHeight          := 30
        :bClrHeader             := { || { CLR_BLUE, GetSysColor( COLOR_BTNFACE ) } }
        :bLDblClick             := { || Contratos_Editar(FALSE) }
        :bKeyChar               := { |nKey| Msginfo(nKey),Browse_OnKeyCharPress(nKey,TRUE,oBrw) }
        :bKeyDown               := { |nKey| Msginfo(nKey),Contratos_ProcesarTecla(nKey)}
        :nFreeze                := 3
        :lFooter                := TRUE

        /*redefine columnas del browse*/
        WITH OBJECT ( oCol := :AddCol() )
            :cHeader       := "Contrato No."
            :bStrData      := {|| CONT->MC_CODCON }
            :nWidth        := 90
        END

Code: Select all

PROCEDURE Browse_OnKeyCharPress(nKey,lUpperSeek,oBrw)
    LOCAL oGet
    LOCAL cGet
    LOCAL oDlgS
    LOCAL cChar
    LOCAL lOldSeek := SET( _SET_SOFTSEEK, TRUE )

    DEFAULT lUpperSeek := TRUE

    IF nKey < 32
        RETURN
    ENDIF

    IF lUpperSeek
        cGet := PadR( Upper( Chr(nKey) ),30 )
    ELSE
        cGet := PadR( Chr(nKey), 30 )
    ENDIF

    DEFINE DIALOG oDlgS NAME "DLG_BUSCAR" OF oDlg

    REDEFINE GET oGet VAR cGet ID 101 OF oDlgS
    REDEFINE BUTTONBMP         ID 201 OF oDlgS BITMAP "SBOK" ACTION Browse_Buscar( cGet, oDlgS, oBrw )

    oGet:cPicture := iif( lUpperSeek, "@!", NIL )

    ACTIVATE DIALOG oDlgS ON INIT oGet:SetPos(2)

    SET( _SET_SOFTSEEK, lOldSeek )

RETURN

Code: Select all

PROCEDURE Browse_Buscar( cGet, oDlgS, oBrw )
    LOCAL nRecno := (oBrw:cAlias)->( RecNo() )

    cGet := RTrim( cGet )

    IF !Empty( cGet )
        IF !(oBrw:cAlias)->( DBSeek( cGet ) )
            (oBrw:cAlias)->( DBGoTo( nRecno ) )
        ENDIF
        oBrw:refresh()
        Tone( 600, 3 )
    ENDIF

   oDlgS:end()

RETURN
Salu2
Carlos Vargas
Desde Managua, Nicaragua (CA)
Post Reply