Estoy haciendo una prueba con "DEFINE CONTROL CONTEXT MENU" pero no logro enviar el nombre de dicho control
hacia una determinada función.
Si oprimo el boton izquierdo en un control "LABEL" con "This.Name" si es correcto el nombre que recibe dicha función
pero al hacerlo con el boton derecho, en el Context Menu - MENUITEM "Edita" ACTION { || Mensaje( nR, nC, cCtrl1 ) }
me despliega siempre el nombre del control anterior.
Alguien tendrá idea de como resolverlo ??
Gracias.
---------------------------------------------------------------------------------------------------------------------------------------------------
Hello everyone
I'm doing a test with "DEFINE CONTROL CONTEXT MENU" but I can not send the name of that control
towards a certain function.
If I press the left button in a "LABEL" control with "This.Name" if the name that receives that function is correct
but when doing it with the right button, in the Context Menu - MENUITEM "Edit" ACTION {|| Mensaje(nR, nC, cCtrl1)}
I always display the name of the previous control.
Someone will have an idea how to solve it ??
Thank you.
Code: Select all
#include "hmg.ch"
FUNCTION Main
LOCAl i1, i2
PUBLIC cCtrlName, nR := 0, nC := 0
DEFINE WINDOW Form_1 AT 0 , 0 WIDTH 1024 HEIGHT 650 NOSIZE NOMAXIMIZE BACKCOLOR GRAY
nRen := 50 ; nCol := 10 ; nRenGridColor := 20
FOR i1 = 1 TO 5
FOR i2 = 1 TO 8
cCtrl1 := "LBL_" + STRZERO( i1, 2 ) + STRZERO( i2, 2 )
@ nRen , nCol LABEL &cCtrl1. OF Form_1 VALUE "" WIDTH 100 HEIGHT 22 FONT "Consolas" SIZE 9 FONTCOLOR BLACK BACKCOLOR CYAN ;
ACTION { || nR := VAL( SUBSTR( This.Name, 5, 2 ) ), nC := VAL( SUBSTR( This.Name, 7, 2 ) ), cCtrlName := This.Name, ;
Mensaje( nR, nC, This.Name ) } CENTERALIGN
SET CONTROL &cCtrl1. OF Form_1 STATICEDGE
nCol += 100
DEFINE CONTROL CONTEXT MENU &cCtrl1. OF Form_1
// COMO ENVIAR EL NOMBRE DE LOS CONTROLES LABEL A LA FUNCION MENSAJE() EN TIEMPO DE EJECUCION
// HOW TO SEND THE LABEL CONTROLS NAME TO THE MENSAJE() FUNCTION AT EXECUTION TIME
*MENUITEM "Edita" ACTION { || Mensaje( nR, nC, This.Name ) } TOOLTIP "cToolTipText" // ERROR !
*MENUITEM "Edita" ACTION { || Mensaje( nR, nC, &cCtrl1. ) } TOOLTIP "cToolTipText" // ERROR !
*MENUITEM "Edita" ACTION { || Mensaje( nR, nC, cCtrl1 ) } TOOLTIP "cToolTipText" // does not display ERROR but is the name of the previous CONTROL!
*MENUITEM "Edita" ACTION { || Mensaje( nR, nC, ( cCtrl1 ) ) } TOOLTIP "cToolTipText" // does not display ERROR but is the name of the previous CONTROL!
MENUITEM "Edita" ACTION { || Mensaje( nR, nC, cCtrlName ) } TOOLTIP "cToolTipText" // does not display ERROR but is the name of the previous CONTROL!
SEPARATOR
MENUITEM "Copia" ACTION Nil TOOLTIP "cToolTipText"
SEPARATOR
MENUITEM "Pega" ACTION Nil TOOLTIP "cToolTipText"
END MENU
NEXT
nCol := 10
nRen += 22
NEXT
END WINDOW
CENTER WINDOW Form_1
ACTIVATE WINDOW Form_1
RETURN
FUNCTION Mensaje( x, y, cCt )
msgdebug( x, y, cCt )
RETURN