Consulta sobre GET

Consulta sobre GET

Postby juan_arroyo_t » Wed Oct 27, 2010 4:41 pm

Amigos del foro :

Si alguien pudiera ayudarme

Esto es un fragmento de mi código :

Code: Select all  Expand view
REDEFINE GET oGet1 VAR cCodIni ID 101 OF oDlg update ;
        PICTURE "@!" ;
        ON CHANGE Self:Assign() ;
        VALID OkCodIni( cCodIni )
        oGet1:bGotFocus := {||SetKey( VK_F2, { || VerCodIni( oGet1, @cCodIni, oDlg ) })}
        oGet1:bGotFocus := { | oSelf | oSelf:SelectAll()}
        oGet1:bLostFocus := {||SetKey( VK_F2, nil )}


La intención es que al mismo tiempo que yo asigno la tecla F2 a VerCodIni, tambien me aparezca seleccionado el Get.

Hay alguna forma de que con una sola instrucción oGet1:bGotFocus() pueda hacer las dos cosas ?

De antemano muchas gracias

Saludos
Juan Arroyo
México
FWH 7.12 VERCE 5.3 xHarbour 1.1.0
juan_arroyo_t@hotmail.com
User avatar
juan_arroyo_t
 
Posts: 196
Joined: Fri May 15, 2009 1:25 am
Location: Cuautitlán, Mexico

Re: Consulta sobre GET

Postby Patricio Avalos Aguirre » Wed Oct 27, 2010 6:50 pm

Hola

Puedes usarlo asi.

Code: Select all  Expand view
bSetKey := SetKey( VK_F2, { |x,y,z| iif( z:classname = "TGET" .and. Z:nId = 101, VerCodIni(..), nil ) } )

REDEFINE GET oGet1 VAR cCodIni ID 101 OF oDlg update ;
        PICTURE "@!" ;
        ON CHANGE Self:Assign() ;
        VALID OkCodIni( cCodIni )

oGet1:bGotFocus := { | oSelf | oSelf:SelectAll()}

ACTIVATE DIALOG oDlg

SetKey( VK_F2, bSetKey )


 
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: 1059
Joined: Fri Oct 07, 2005 1:56 pm
Location: La Serena, Chile

Re: Consulta sobre GET

Postby juan_arroyo_t » Thu Oct 28, 2010 3:56 am

Patricio

Gracias por tus atenciones :

Probé tu codigo y funcionó perfecto, pero lo que yo no comenté es que quiero hacerlo para tres Gets y asignar la tecla F2 para los tres

Es posible hacerlo ?

Aqui está mi código :



Code: Select all  Expand view
STATIC FUNCTION PoneFil( oLbx )
    LOCAL oDlg, oBAce, bSetKey1, bSetkey2, bSetKey3
    LOCAL oGet1, oGet2, oGet3
    LOCAL cCodIni, cCodFin, cFamil
   
    cat->(DBGOTOP())
    cCodIni := cat->modelo
    cat->(DBGOBOTTOM())
    cCodFin := cat->modelo
    cat->(DBGOTOP())
    cFamil := "?????"
   
    bSetKey1 := SetKey( VK_F2, { |x,y,z| iif( z:classname = "TGET" .and. ;
                          Z:nId = 101, VerCodIni( oGet1, @cCodIni, oDlg ), nil ) } )
    bSetKey2 := SetKey( VK_F2, { |x,y,z| iif( z:classname = "TGET" .and. ;
                              Z:nId = 103, VerCodFin( oGet2, @cCodFin, oDlg ), nil ) } )
    bSetKey3 := SetKey( VK_F2, { |x,y,z| iif( z:classname = "TGET" .and. ;
                              Z:nId = 105, VerFamil( oGet3, @cFamil, oDlg ), nil ) } )
                             
    DEFINE DIALOG oDlg RESOURCE "CamPre"
      oDlg:lHelpIcon := .F.
   
    REDEFINE GET oGet1 VAR cCodIni ID 101 OF oDlg update ;
        PICTURE "@!" ;
        ON CHANGE Self:Assign() ;
        VALID OkCodIni( cCodIni )
        oGet1:bGotFocus := { | oSelf | oSelf:SelectAll()}
       
    REDEFINE GET oGet2 VAR cCodFin ID 103 OF oDlg update ;
        PICTURE "@!" ;
        ON CHANGE Self:Assign() ;
        VALID OkCodFin( cCodFin )
        oGet2:bGotFocus := { | oSelf | oSelf:SelectAll()}
       
    REDEFINE GET oGet3 VAR cFamil  ID 105 OF oDlg update ;
        PICTURE "@!" ;
        ON CHANGE Self:Assign()
       
    REDEFINE BUTTON oBAce ID 107 OF oDlg ;
        ACTION Filtro( cCodIni, cCodFin, cFamil ), oDlg:End()
   
    ACTIVATE DIALOG oDlg CENTERED
        SetKey( VK_F2, bSetKey1 )
        SetKey( VK_F2, bSetKey2 )
        SetKey( VK_F2, bSetKey3 )
      oLbx:refresh()
      oLbx:SetFocus()
   
RETURN NIL



Saludos
Juan Arroyo
México
FWH 7.12 VERCE 5.3 xHarbour 1.1.0
juan_arroyo_t@hotmail.com
User avatar
juan_arroyo_t
 
Posts: 196
Joined: Fri May 15, 2009 1:25 am
Location: Cuautitlán, Mexico

Re: Consulta sobre GET

Postby Patricio Avalos Aguirre » Thu Oct 28, 2010 12:37 pm

Hola


Si es posible, debes hacerlo en un solo Setkey, ya que si asignas en otro eliminas el anterior

Code: Select all  Expand view
bSetKey := SetKey( VK_F2, { |x,y,z| iif( z:classname = "TGET" .and. Z:nId = 101, VerCodIni(..), nil ),;
                                      iif( z:classname = "TGET" .and. Z:nId = 103, VerCodIni(..), nil ),;
                                      iif( z:classname = "TGET" .and. Z:nId = 105, VerCodIni(..), nil ) } )

 
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: 1059
Joined: Fri Oct 07, 2005 1:56 pm
Location: La Serena, Chile

Re: Consulta sobre GET

Postby juan_arroyo_t » Fri Oct 29, 2010 1:10 am

Patricio

Muchas gracias por tu ayuda te estoy muy agradecido, funcionó tal como yo deseaba

Sólo una cosa mas :

La linea SetKey( VK_F2, bSetkey) que va despues del ACTIVATE DIALOG cuál es su función porque si no la incluyo tambien funciona mi código

ACTIVATE DIALOG oDlg CENTERED
//SetKey( VK_F2, bSetKey )
oLbx:refresh()
oLbx:SetFocus()

Saludos
Juan Arroyo
México
FWH 7.12 VERCE 5.3 xHarbour 1.1.0
juan_arroyo_t@hotmail.com
User avatar
juan_arroyo_t
 
Posts: 196
Joined: Fri May 15, 2009 1:25 am
Location: Cuautitlán, Mexico

Re: Consulta sobre GET

Postby Patricio Avalos Aguirre » Fri Oct 29, 2010 12:22 pm

Hola

que bien que te haya resultado, debes cerrar tu post (SOLUCIONADO )

Code: Select all  Expand view
SetKey()
Associates a code block with a key.

SetKey( <nInkeyCode>    , ;
       [<bNewCodeblock>], ;
       [<bCondition>]     ) --> bOldCodeblock
 


Como vez retorna la ultima tecla asociada

estará activo mientras no asignes un nuevo codeblock a la tecla

si ya no quieres asignar mas la tecla F2, solo le asignas NIL

Code: Select all  Expand view
Setkey( VK_F2, NIL )
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: 1059
Joined: Fri Oct 07, 2005 1:56 pm
Location: La Serena, Chile


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 6 guests