FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Uso Set Key
Posts: 199
Joined: Fri Apr 18, 2008 04:21 PM
Uso Set Key
Posted: Wed Sep 23, 2009 03:50 PM

Hola a todos .

Tengo un problema necesito controlar que con f3 f4, llame a dos funciones si a esas dos funciones las agrego en el action de un boton funcionan perfectamente me sale la pantalla que necesito que salga pero cuando presiono f3 o f4 me da error y estoy enviando los mismos datos que en los botones.

de esta forma declaro el set key

SET KEY VK_F3 TO ingresos( aGets, oLbx, oWnd, oSay, truefalse, oBrw, oBjeto )

y si en el btnbmp pongo en al Action ingresos( aGets, oLbx, oWnd, oSay, truefalse, oBrw, oBjeto )

Funciona correctamente.

Que puede estar mal?

Atentamente
Julio Ponce

Posts: 610
Joined: Wed Oct 19, 2005 08:20 PM
Re: Uso Set Key
Posted: Wed Sep 23, 2009 04:42 PM

Prueba as铆:

SetKey(VK_F3, {|nKey| ingresos( aGets, oLbx, oWnd, oSay, truefalse, oBrw, oBjeto )})

Un saludo,

Manuel



xH 1.2.3, FWH 23.07 32 bits, BC++ 7.4, xVerce CW 1.0, PellesC
Posts: 199
Joined: Fri Apr 18, 2008 04:21 PM
Re: Uso Set Key
Posted: Wed Sep 23, 2009 08:05 PM

Gracias pero no me funciono simpre me da error habra alguna otra manera de hacerlo

Posts: 610
Joined: Wed Oct 19, 2005 08:20 PM
Re: Uso Set Key
Posted: Thu Sep 24, 2009 06:18 AM

驴Qu茅 error es?

Un saludo,

Manuel



xH 1.2.3, FWH 23.07 32 bits, BC++ 7.4, xVerce CW 1.0, PellesC
Posts: 1380
Joined: Fri Oct 14, 2005 01:28 PM
Re: Uso Set Key
Posted: Thu Sep 24, 2009 12:06 PM

A ver si te sirve esta forma;
Tengo una barra de botones donde defino:
DEFINE SBUTTON aoBar[_BNewF] OF oBar ;
PROMPT "[F2] Nuevo"
ACTION ....

Activo bot贸n:
aFunKeys[_F2] := SetKey( VK_F2, {|| aoBar[_BNewF]:KeyDown( VK_RETURN ) })
....
Desactivo bot贸n (restauro a la accion anterio de la tecla):
SetKey( VK_F2, aFunKeys[_F2] )

Saludos

Resistencia - "Ciudad de las Esculturas"

Chaco - Argentina
Posts: 299
Joined: Mon Oct 22, 2007 03:03 PM
Re: Uso Set Key
Posted: Thu Sep 24, 2009 06:32 PM
YO TENGO DEFINIDA UNA CLASE:

Code (fw): Select all Collapse
****************************************************************************
CLASS TVKEY  // Clase para controlar teclas de funcion
****************************************************************************
      DATA OldKeys       INIT {SETKEY(VK_F1    ),;
                               SETKEY(VK_F2    ),;
                               SETKEY(VK_F3    ),;
                               SETKEY(VK_F4    ),;
                               SETKEY(VK_F5    ),;
                               SETKEY(VK_F6    ),;
                               SETKEY(VK_F7    ),;
                               SETKEY(VK_F8    ),;
                               SETKEY(VK_F9    ),;
                               SETKEY(VK_F10   ),;
                               SETKEY(VK_F11   ),;
                               SETKEY(VK_F12   ),;
                               SETKEY(VK_F13   ),;
                               SETKEY(VK_F14   ),;
                               SETKEY(VK_F15   ),;
                               SETKEY(VK_F16   ),;
                               SETKEY(VK_F17   ),;
                               SETKEY(VK_F18   ),;
                               SETKEY(VK_F19   ),;
                               SETKEY(VK_F20   ),;
                               SETKEY(VK_F21   ),;
                               SETKEY(VK_F22   ),;
                               SETKEY(VK_F23   ),;
                               SETKEY(VK_F24   ),;
                               SETKEY(VK_INSERT),;
                               SETKEY(VK_DELETE),;
                               SETKEY(VK_UP    ),;
                               SETKEY(VK_RIGHT ),;
                               SETKEY(VK_DOWN  ),;
                               SETKEY(VK_SELECT),;
                               SETKEY(VK_PRINT ),;
                               SETKEY(VK_ESCAPE),;
                               SETKEY(VK_RETURN),;
                               SETKEY(VK_PRIOR ),;
                               SETKEY(VK_NEXT  ),;
                               SETKEY(VK_HOME  ),;
                               SETKEY(VK_END   )}
      METHOD New() CONSTRUCTOR

      METHOD End()

  ENDCLASS

  METHOD New() CLASS TVKEY
    ::oldKeys[1] :=SETKEY(VK_F1    , NIL )
    ::oldKeys[2] :=SETKEY(VK_F2    , NIL )
    ::oldKeys[3] :=SETKEY(VK_F3    , NIL )
    ::oldKeys[4] :=SETKEY(VK_F4    , NIL )
    ::oldKeys[5] :=SETKEY(VK_F5    , NIL )
    ::oldKeys[6] :=SETKEY(VK_F6    , NIL )
    ::oldKeys[7] :=SETKEY(VK_F7    , NIL )
    ::oldKeys[8] :=SETKEY(VK_F8    , NIL )
    ::oldKeys[9] :=SETKEY(VK_F9    , NIL )
    ::oldKeys[10]:=SETKEY(VK_F10   , NIL )
    ::oldKeys[11]:=SETKEY(VK_F11   , NIL )
    ::oldKeys[12]:=SETKEY(VK_F12   , NIL )
    ::oldKeys[13]:=SETKEY(VK_F13   , NIL )
    ::oldKeys[14]:=SETKEY(VK_F14   , NIL )
    ::oldKeys[15]:=SETKEY(VK_F15   , NIL )
    ::oldKeys[16]:=SETKEY(VK_F16   , NIL )
    ::oldKeys[17]:=SETKEY(VK_F17   , NIL )
    ::oldKeys[18]:=SETKEY(VK_F18   , NIL )
    ::oldKeys[19]:=SETKEY(VK_F19   , NIL )
    ::oldKeys[20]:=SETKEY(VK_F20   , NIL )
    ::oldKeys[21]:=SETKEY(VK_F21   , NIL )
    ::oldKeys[22]:=SETKEY(VK_F22   , NIL )
    ::oldKeys[23]:=SETKEY(VK_F23   , NIL )
    ::oldKeys[24]:=SETKEY(VK_F24   , NIL )
    ::oldKeys[25]:=SETKEY(VK_INSERT, NIL )
    ::oldKeys[26]:=SETKEY(VK_DELETE, NIL )
    ::oldKeys[27]:=SETKEY(VK_UP    , NIL )
    ::oldKeys[28]:=SETKEY(VK_RIGHT , NIL )
    ::oldKeys[29]:=SETKEY(VK_DOWN  , NIL )
    ::oldKeys[30]:=SETKEY(VK_SELECT, NIL )
    ::oldKeys[31]:=SETKEY(VK_PRINT , NIL )
    ::oldKeys[32]:=SETKEY(VK_ESCAPE, NIL )
    ::oldKeys[33]:=SETKEY(VK_RETURN, NIL )
    ::oldKeys[34]:=SETKEY(VK_PRIOR , NIL )
    ::oldKeys[35]:=SETKEY(VK_NEXT  , NIL )
    ::oldKeys[36]:=SETKEY(VK_HOME  , NIL )
    ::oldKeys[37]:=SETKEY(VK_END   , NIL )
    Return self

  METHOD End() CLASS TVKEY
    SETKEY(VK_F1    ,::OldKeys[ 1])
    SETKEY(VK_F2    ,::OldKeys[ 2])
    SETKEY(VK_F3    ,::OldKeys[ 3])
    SETKEY(VK_F4    ,::OldKeys[ 4])
    SETKEY(VK_F5    ,::OldKeys[ 5])
    SETKEY(VK_F6    ,::OldKeys[ 6])
    SETKEY(VK_F7    ,::OldKeys[ 7])
    SETKEY(VK_F8    ,::OldKeys[ 8])
    SETKEY(VK_F9    ,::OldKeys[ 9])
    SETKEY(VK_F10   ,::OldKeys[10])
    SETKEY(VK_F11   ,::oldKeys[11])
    SETKEY(VK_F12   ,::oldKeys[12])
    SETKEY(VK_F13   ,::oldKeys[13])
    SETKEY(VK_F14   ,::oldKeys[14])
    SETKEY(VK_F15   ,::oldKeys[15])
    SETKEY(VK_F16   ,::oldKeys[16])
    SETKEY(VK_F17   ,::oldKeys[17])
    SETKEY(VK_F18   ,::oldKeys[18])
    SETKEY(VK_F19   ,::oldKeys[19])
    SETKEY(VK_F20   ,::oldKeys[20])
    SETKEY(VK_F21   ,::oldKeys[21])
    SETKEY(VK_F22   ,::oldKeys[22])
    SETKEY(VK_F23   ,::oldKeys[23])
    SETKEY(VK_F24   ,::oldKeys[24])
    SETKEY(VK_INSERT,::oldKeys[25])
    SETKEY(VK_DELETE,::oldKeys[26])
    SETKEY(VK_UP    ,::oldKeys[27])
    SETKEY(VK_RIGHT ,::oldKeys[28])
    SETKEY(VK_DOWN  ,::oldKeys[29])
    SETKEY(VK_SELECT,::oldKeys[30])
    SETKEY(VK_PRINT ,::oldKeys[31])
    SETKEY(VK_ESCAPE,::oldKeys[32])
    SETKEY(VK_RETURN,::oldKeys[33])
    SETKEY(VK_PRIOR ,::oldKeys[34])
    SETKEY(VK_NEXT  ,::oldKeys[35])
    SETKEY(VK_HOME  ,::oldKeys[36])
    SETKEY(VK_END   ,::oldKeys[37])

    Return nil


Y LA UTILIZO AS脥

Code (fw): Select all Collapse
FUNCTION PEPE(oDlgAnt)
LOCAL oFkey,bButEmit,oButEmit
DEFAULT oDlgAnt:=oWnd
oFKey:=tvkey():NEW   // CLASE TVKEY (control de teclas de funcion)
SETKEY(VK_F9,     { || EVAL(bButEmit)   } )
  bButEmit     := { || IIF(oButEmit:lActive,(EVAL(bButDisable),;
                         MSGRUN("Espere, Grabando los Registros",,{||graB_part(.T.)}),;
                          imp_licos()      ,;
                          EVAL(bButEnable) ,;
                          oButGuard:Disable()),)}
.
.
  DEFINE DIALOG oDlg RESOURCE "PEPE"  OF  oDlgAnt                       
.
.
.
          REDEFINE BUTTON  oButEmit   ID  109  OF oDlg;
               MESSAGE "Presione para Imprimir"   ;
               PROMPT  "[F9]-Imprimir"            ;
               ACTION  EVAL(bButEmit)
 ACTIVATE DIALOG oDlg CENTER    

  oFKey:End()
  RETURN lRet


ESPERO TE SIRVA DE ALGO
Saludos



Angel, Valencia, Venezuela



xH .997 - FW 7.9 - BCC55 - WorkShop - MySql
Posts: 299
Joined: Mon Oct 22, 2007 03:03 PM
Re: Uso Set Key
Posted: Thu Sep 24, 2009 06:40 PM

CON ESTA CLASE Y TRABAJANDO DE ESTA FORMA SI DESACTIVAS DEL BOTON DE UNA VEZ QUEDA DESACTIVADA LA TECLA DE FUNCION

A MI ME TRABAJA DE LAS MIL MARAVILLAS

SUERTE

POSDATA (DE PASO ACABO DE HACER UN APORTE AL GRUPO DE USUARIOS)

Saludos



Angel, Valencia, Venezuela



xH .997 - FW 7.9 - BCC55 - WorkShop - MySql
Posts: 299
Joined: Mon Oct 22, 2007 03:03 PM
Re: Uso Set Key
Posted: Thu Sep 24, 2009 06:55 PM

VERIFICA QUE TENGAS

INCLUDE "INKEY.CH"

Saludos



Angel, Valencia, Venezuela



xH .997 - FW 7.9 - BCC55 - WorkShop - MySql
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: Uso Set Key
Posted: Thu Sep 24, 2009 08:22 PM

Marabilloso! :wink:

Jo茫o Santos - S茫o Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 782
Joined: Wed Dec 19, 2007 07:50 AM
Re: Uso Set Key
Posted: Fri Sep 25, 2009 05:39 AM
Hola Angel:
ADBLANCO wrote:YO TENGO DEFINIDA UNA CLASE:

Me parece genial tu idea para simplificar el c贸digo en el manejo de bloques asociados a las teclas, gracias.

Me he tomado el atrevimiento de proponer algunos ajustes a tu clase (claro, respetando tu idea)

En mi propuesta estoy agregando el par谩metro "aSel" en la creaci贸n del objeto TVKey, con este par谩metro (que es un array) pretendo que se puedan manejar localmente solamente algunas de las acciones (o todas) asociados a las teclas.

Como ejemplo si quiero conservar las acciones asignadas a todas las teclas con excepci贸n de las teclas F2 y F5 que quiero manejar localmente:

oVKey := TVKey():New( { VK_F2, VK_F5 } )

Aqu铆 muestro un programa de ejemplo incluyendo mi propuesta de modificaci贸n a tu clase:
Code (fw): Select all Collapse
#include "FiveWin.ch"

Function Main()

聽 聽Local oWnd

聽 聽SetKey( VK_F9, { || MsgInfo( "Asignaci贸n original de VK_F9 desde oWnd", "Prueba" ), fLocalVkey() } )

聽 聽Define Window oWnd Title "Prueba de la clase TVKey de ADBLANCO"

聽 聽SET MESSAGE TO "Presiona la tecla F9" OF oWnd CLOCK DATE KEYBOARD NOINSET 2007

聽 聽Activate Window oWnd

Return Nil

Static Function fLocalVkey()

聽 聽Local oDlg, ;
聽 聽 聽 聽 聽oVKey := TVKey():New()

聽 聽SetKey( VK_F9, { || MsgInfo( "Asignaci贸n local de VK_F9 desde oDlg", "Prueba" ), oDlg:End() } )

聽 聽Define Dialog oDlg Title "Cambiando localmente la acci贸n con F9"

聽 聽@ 10, 10 Say "Presiona F9" Of oDlg Pixel

聽 聽Activate Dialog oDlg Centered

聽 聽oVKey:End()

Return Nil

****************************************************************************
CLASS TVKey 聽// Clase para controlar teclas de funcion
* Autor ADBLANCO
****************************************************************************
聽 聽DATA OldActions

聽 聽METHOD New( aSel ) CONSTRUCTOR

聽 聽METHOD End()

ENDCLASS

****************************************************************************

METHOD New( aSel ) CLASS TVKey

聽 聽Local nEle

聽 聽Default aSel := { VK_F1, VK_F2, VK_F3, VK_F4, VK_F5, VK_F6, VK_F7, VK_F8, VK_F9, VK_F10, VK_F11, VK_F12, ;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽VK_F13, VK_F14, VK_F15, VK_F16, VK_F17, VK_F18, VK_F19, VK_F20, VK_F21, VK_F22, VK_F23, ;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽VK_F24, VK_INSERT, VK_DELETE, VK_LEFT, VK_UP, VK_RIGHT, VK_DOWN, VK_SELECT, VK_PRINT, ;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽VK_ESCAPE, VK_RETURN, VK_PRIOR, VK_NEXT, VK_HOME, VK_END, VK_NUMLOCK, VK_SCROLL }

聽 聽::OldActions := Array( Len( aSel ) )

聽 聽For nEle := 1 To Len( aSel )
聽 聽 聽 ::OldActions[ nEle ] := { aSel[ nEle ], SetKey( aSel[ nEle ], Nil ) }
聽 聽Next

Return Self

****************************************************************************

METHOD End() CLASS TVKey

聽 聽Local nEle

聽 聽For nEle := 1 To Len( ::OldActions )
聽 聽 聽 SetKey( ::OldActions[ nEle, 1 ], ::OldActions[ nEle, 2 ] )
聽 聽Next

Return Nil

Gracias nuevamente y disculpa el atrevimiento.

Un abrazo.

Manuel Mercado G贸mez.
manuelmercado at prodigy dot net dot mx
Posts: 299
Joined: Mon Oct 22, 2007 03:03 PM
Re: Uso Set Key
Posted: Fri Sep 25, 2009 12:46 PM

Gracias!, Maestro. :lol:
Es todo un honor que te haya gustado mi humilde aporte :oops:
La mejora que tu propones ya la voy a implementar, porque Realmente le agrega Flexibilidad a la clase.

Nota:
Me gustar铆a Saber es si J.ponce consigui贸 resolver su problema.

Saludos



Angel, Valencia, Venezuela



xH .997 - FW 7.9 - BCC55 - WorkShop - MySql
Posts: 199
Joined: Fri Apr 18, 2008 04:21 PM
Re: Uso Set Key
Posted: Sat Sep 26, 2009 01:14 PM

Gracias ya esta solucionado mi problema con el aporte de todos ustedes.

muchas gracias

Continue the discussion