Uso Set Key
Uso Set Key
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
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
- Manuel Aranda
- Posts: 605
- Joined: Wed Oct 19, 2005 8:20 pm
- Location: España
Re: Uso Set Key
Prueba así:
SetKey(VK_F3, {|nKey| ingresos( aGets, oLbx, oWnd, oSay, truefalse, oBrw, oBjeto )})
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
Manuel
xH 1.2.3, FWH 23.07 32 bits, BC++ 7.4, xVerce CW 1.0, PellesC
- Manuel Aranda
- Posts: 605
- Joined: Wed Oct 19, 2005 8:20 pm
- Location: España
Re: Uso Set Key
¿Qué error es?
Un saludo,
Manuel
xH 1.2.3, FWH 23.07 32 bits, BC++ 7.4, xVerce CW 1.0, PellesC
Manuel
xH 1.2.3, FWH 23.07 32 bits, BC++ 7.4, xVerce CW 1.0, PellesC
- MarioG
- Posts: 1380
- Joined: Fri Oct 14, 2005 1:28 pm
- Location: Resistencia - Chaco - AR
- Been thanked: 2 times
Re: Uso Set Key
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
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
Chaco - Argentina
Re: Uso Set Key
YO TENGO DEFINIDA UNA CLASE:
Y LA UTILIZO ASÍ
ESPERO TE SIRVA DE ALGO
Code: Select all | Expand
****************************************************************************
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: Select all | Expand
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
Angel, Valencia, Venezuela
xH .997 - FW 7.9 - BCC55 - WorkShop - MySql
Re: Uso Set Key
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)
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
Angel, Valencia, Venezuela
xH .997 - FW 7.9 - BCC55 - WorkShop - MySql
Re: Uso Set Key
VERIFICA QUE TENGAS
#INCLUDE "INKEY.CH"
#INCLUDE "INKEY.CH"
Saludos
Angel, Valencia, Venezuela
xH .997 - FW 7.9 - BCC55 - WorkShop - MySql
Angel, Valencia, Venezuela
xH .997 - FW 7.9 - BCC55 - WorkShop - MySql
Re: Uso Set Key
Hola Angel:
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:
Gracias nuevamente y disculpa el atrevimiento.
Un abrazo.
Manuel Mercado Gómez.
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: Select all | Expand
#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
Re: Uso Set Key
Gracias!, Maestro.
Es todo un honor que te haya gustado mi humilde aporte![Embarassed :oops:](./images/smilies/icon_redface.gif)
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.
![Laughing :lol:](./images/smilies/icon_lol.gif)
Es todo un honor que te haya gustado mi humilde aporte
![Embarassed :oops:](./images/smilies/icon_redface.gif)
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
Angel, Valencia, Venezuela
xH .997 - FW 7.9 - BCC55 - WorkShop - MySql
Re: Uso Set Key
Gracias ya esta solucionado mi problema con el aporte de todos ustedes.
muchas gracias
muchas gracias