Estoy Haciendo una clase y me genera el error.
Esta bien ejecuar la clase asi .. { || ::Autoper("M0") }
Path and name: K:\proy_harb\plastwin.Exe (32 bits)
Size: 1,608,704 bytes
Time from start: 0 hours 0 mins 58 secs
Error occurred at: 05/06/2011, 15:32:06
Error description: Error BASE/1003 Variable does not exist: SELF
este es el codigo.
Esta bien ejecuar la clase asi .. { || ::Autoper("M0") }
Path and name: K:\proy_harb\plastwin.Exe (32 bits)
Size: 1,608,704 bytes
Time from start: 0 hours 0 mins 58 secs
Error occurred at: 05/06/2011, 15:32:06
Error description: Error BASE/1003 Variable does not exist: SELF
este es el codigo.
CLASS TBarDLG
/*------------------------------------------------------------------------------*/
DATA oWdlcx // Objeto Dialog/Window
DATA oGrid // Objeto del xBrowse
DATA cPos // Situacion de la barra
DATA acBitmap // Array para los Bitmaps de los botones
DATA acTooTip // Array para los tooltip de los botones
DATA abAction // Array para los ACTION de los botones
DATA aGroup // Array para los GROUP de los botones
DATA oCursor // Objeto para el cursor en los botones
DATA oBar // Objeto de la barra
DATA aBmp // Array para los objetos de los botones
DATA aMenAdc // Array para los Menu Adicionales
DATA aActivate // Array de botones
DATA aTper // Condicion
DATA itperm // Objeto Tipo de persimos registro
DATA itmotor // Objeto tipo de motor
DATA iAdo // Objeto si es Ado
DATA itabla // Objeto la tabla actual
DATA iaContl // Array
METHOD New( oWdlcx, oGrid, cPos, acBitmap, acToolTip, abAction, aGroup, l2007, l3D ,aMenAdc,itperm,;
itmotor,iAdo,itabla )
METHOD Autoper1(aTper)
METHOD Boto_anubus()
METHOD Boto_adimod()
METHOD Boto_cancela()
METHOD Controls( aActivate )
METHOD BottomDown()
METHOD End()
ENDCLASS
/*------------------------------------------------------------------------------*/
METHOD New( oWdlcx, oGrid, cPos, acBitmap, acToolTip, abAction, aGroup, l2007, l3D,aMenAdc,itperm,;
itmotor,iAdo,itabla,iaContl ) CLASS TBarDLG
/*------------------------------------------------------------------------------*/
LOCAL nFor := 0, nLen := 0, aBmp := {}, nMHeight := 0, nPox := 0
LOCAL oPop11,oPop12
// Local aTypes := { "TOP", "LEFT", "RIGHT", "DOWN", "FLOAT", "BOTTOM" }
// Local xpos
DEFAULT cPos := "TOP",;
acBitmap := { "reg_nue" ,;
"reg_edit" ,;
"reg_del" ,;
"reg_grab" ,;
"reg_find" ,;
"reg_canc" ,;
"reg_brow" ,;
"reg_prim" ,;
"reg_sig" ,;
"reg_ant" ,;
"reg_ult" ,;
"reg_refr" ,;
"reg_calc" ,;
"reg_help" ,;
"reg_printer",;
"reg_cons" ,;
"reg_salir" },;
acToolTip := { "Nuevo" ,;
"Modificar" ,;
"Anular" ,;
"Grabar" ,;
"Buscar" ,;
"Cancelar" ,;
"Consulta" ,;
"Primero" ,;
"Siguiente" ,;
"Anterior" ,;
"Ultimo" ,;
"Refrescar" ,;
"Calculadora" ,;
"Ayuda" ,;
"Imprimir" ,;
"Consultas" ,;
"Salir" },;
abAction := { { || ::Autoper("A0") },; // ACTION para el 1 boton */
{ || ::Autoper("M0") },; // ACTION para el 2 boton */
{ || ::Autoper("E0") },; // ACTION para el 3 boton */
{ || ::Autoper("G0") },; // ACTION para el 4 boton */
{ || ::Autoper("B0") },; // ACTION para el 5 boton */
{ || ::Autoper("X0") },; // ACTION para el 6 boton */
{ || ::Autoper("C0") },; // ACTION para el 7 boton */
{ || ::Autoper("P0") },; // ACTION para el 8 boton */
{ || ::Autoper("S0") },; // ACTION para el 9 boton */
{ || ::Autoper("Q0") },; // ACTION para el 10 boton */
{ || ::Autoper("U0") },; // ACTION para el 11 boton */
{ || ::Autoper("F0") },; // ACTION para el 12 boton */
{ || ::Autoper1("CA") },; // ACTION para el 13 boton */
{ || ::Autoper1("HO") },; // ACTION para el 14 boton */
{ || ::Autoper("R0") },; // ACTION para el 15 boton */
{ || ::Autoper("R0") },; // ACTION para el 16 boton */
{ || ::Autoper("Z0") }},; // ACTION para el 17 boton */
aGroup := { .F., .F., .F., .F., .F., .F., .F., .F., .F., .F., .F., .F., .F., .F., .F., .F.,.F. },;
l2007 := .F.,;
l3D := .T.,;
aMenAdc := { 0, 0, 0 },;
itperm :=" ",;
itmotor:=" ",;
iAdo:=.f.,;
itabla:=" ",;
iaContl := {0,0," "," "," ",0,1,385,35,.t.,0,0,0,0,0," ",0,4,3,.f.," "}
::aActivate := { .T., .T., .T., .F., .T., .F., .T., .T., .T., .T., .T., .T., .T., .T., .T., .T.,.T. }
nLen := Len( acBitmap )
::aBmp := Array( nLen )
::oWdlcx := oWdlcx
::oGrid := oGrid
::cPos := cPos
::acBitmap := acBitmap
::acTooTip := acToolTip
::abAction := abAction
::aGroup := aGroup
// nPox := ASCAN( aTypes, UPPER(cPos) )
// xPos := If( nPox > 0, aTypes[ nPox ], "" )
/* Creamos el Cursor */
DEFINE CURSOR ::oCursor HAND
/* Creamos la barra en funcion del estilo */
DO CASE
/* Situa la barra en la parte superior del xBrowse */
CASE Upper( cPos ) == "TOP"
DEFINE BUTTONBAR ::oBar _3D SIZE 28, 28 OF ::oWdlcx TOP
/* Situa la barra en la parte inferior del xBrowse */
CASE Upper( cPos ) == "BOTTOM"
DEFINE BUTTONBAR ::oBar _3D SIZE 28, 28 OF ::oWdlcx BOTTOM
/* Situa la barra en la parte izquierda del xBrowse */
CASE Upper( cPos ) == "LEFT"
DEFINE BUTTONBAR ::oBar _3D SIZE 28, 28 OF ::oWdlcx LEFT
/* Situa la barra en la parte derecha del xBrowse */
CASE Upper( cPos ) == "RIGHT"
DEFINE BUTTONBAR ::oBar _3D SIZE 28, 28 OF ::oWdlcx RIGHT
OTHERWISE
DEFINE BUTTONBAR ::oBar _3D SIZE 28, 28 OF ::oWdlcx
ENDCASE
MENU oPop11 POPUP
if aMenAdc[1]=1 // if aContl[18]=1
MENUITEM "&Imprimir.." NAME "reg_printer" ACTION (::Autoper("R1"))
elseif aMenAdc[1]=2 //aContl[18]=2
MENUITEM "&Imprimir.." NAME "reg_printer" ACTION (::Autoper("R1"))
MENUITEM "&Formato.." NAME "FOR" ACTION (::Autoper("R5"))
elseif aMenAdc[1]=3 //aContl[18]=3
MENUITEM "&Imprimir.." NAME "reg_printer" ACTION (::Autoper("R1"))
MENUITEM "&Formato.." NAME "FOR" ACTION (::Autoper("R5"))
elseif aMenAdc[1]=4 //aContl[18]=4
MENUITEM "&Imprimir.." NAME "reg_printer" ACTION (::Autoper("R1"))
endif
ENDMENU
MENU oPop12 POPUP
if aMenAdc[2]=1 //if aContl[19]=1
MENUITEM "&Datos Terceros.." NAME "reg_form" ACTION (::Autoper("J1"))
elseif aMenAdc[2]=2 //aContl[19]=2
MENUITEM "&Datos Terceros.." NAME "reg_form" ACTION (::Autoper("J1"))
elseif aMenAdc[2]=3 // aContl[19]=3
MENUITEM "&Datos Terceros.." NAME "reg_form" ACTION (::Autoper("J1"))
MENUITEM "&Datos Cliente..." NAME "reg_form" ACTION (::Autoper("J2"))
elseif aMenAdc[2]=4 //aContl[19]=4
endif
ENDMENU
/* Comrpobamos si tenemos que crear la barra en 3D */
If( !l3D, ::oBar:l3D := .F., ::oBar:l3D := .T. )
/* Comrpobamos si tenemos que crear la barra Offices 2007 */
If( !l2007, ::oBar:l2007 := .F., ::oBar:l2007 := .T. )
IF x_brodesv;barbwodegra(::oBar,0);endif
/* Creamos tanto botones en la barra como acciones tenemos que hacer */
FOR nFor := 1 TO nLen
if nFor=15 .and. aMenAdc[1]>0
DEFINE BUTTON ::aBmp[nFor] RESOURCE acBitmap[nFor],acBitmap[nFor];
GROUP MENU oPop11 ;
NOBORDER OF ::oBar ;
ACTION ::aBmp[nFor]:ShowPopup() ;
TOOLTIP acToolTip[nFor]
::aBMP[nFor]:lGroup := aGroup[ nFor ]
elseif nFor=16 .and. aMenAdc[2]>0
DEFINE BUTTON ::aBmp[nFor] RESOURCE acBitmap[nFor],acBitmap[nFor];
GROUP MENU oPop12 ;
NOBORDER OF ::oBar ;
ACTION ::aBmp[nFor]:ShowPopup() ;
TOOLTIP acToolTip[nFor]
::aBMP[nFor]:lGroup := aGroup[ nFor ]
else
DEFINE BUTTON ::aBmp[nFor] RESOURCE acBitmap[nFor],acBitmap[nFor];
GROUP;
OF ::oBar FLAT;
TOOLTIP acToolTip[nFor]
::aBMP[nFor]:bAction := abAction[ nFor ]
if nFor=16 .and. aMenAdc[2]=0
::aBMP[nFor]:lGroup := .F.
else
::aBMP[nFor]:lGroup := aGroup[ nFor ]
endif
endif
?
SysRefresh()
NEXT
/* Desactivamos la accion del boton derecho a la barra */
::oBar:bRClicked := {|| NIL }
/* Asignamos el cursor a todos los botones */
AEval( ::oBar:aControls, { | o | o:oCursor := ::oCursor } )
::Controls( ::aActivate )
Return Self
/*------------------------------------------------------------------------------*/
METHOD Controls( aActivate ) CLASS TBarDLG
/*------------------------------------------------------------------------------*/
/* Activamos o Desactivamos el boton en funcion del array recibido */
AEval( ::oBar:aControls, { | o, elem | If( aActivate[elem], o:Enable(), o:Disable() ) } )
Return NIL
/*------------------------------------------------------------------------------*/
METHOD BottomDown() CLASS TBarDLG
/*------------------------------------------------------------------------------*/
/* Deja como efecto de boton hundido el boton que ha sido presionado */
/* Este metodo solo se ejecuta si el programador llama a este metodo */
/* en el paso de paramtros al crear la clase. */
AEval( ::oBar:aControls, { | o, elem | If( o:lFocused, o:Toggle(), o:GoUp() ) } )
Return NIL
/*------------------------------------------------------------------------------*/
METHOD End() CLASS TBarDLG
/*------------------------------------------------------------------------------*/
/* Borramos los objetos creados en la clase */
DeleteObject( ::oCursor )
DeleteObject( ::oBar )
Return NIL
METHOD Autoper1(Tper) CLASS TBarDLG
Local aEjec,nProg,x_pxivel
if Tper=="H0" //adiciona
brohelp(" ")
elseif Tper=="CA" //adiciona
ShowCalcula(::oWdlcx)
..........
.......