- Code: Select all Expand view RUN
********************
*Catalogo de Medidas
********************
PROC pMedida()
vgraba:=.f.
oCuadro:="oMedida"
oM1vc1:="Código"
oM1lc1:={"Código","Nombre"}
vOrden:="m_Medida"
oC1vg1:=space(100)
oTbMed := oLamcla:oServer:Query("SELECT * from "+oLamcla:tMedi+" ORDER BY "+alltrim(vOrden), .f. )
DEFINE DIALOG oCuadro RESOURCE "orCiudad" OF oWinp ICON "#8001"
REDEFINE BTNBMP Btn_Agre ID 4007 OF oCuadro RESOURCE "Bagre" TOOLTIP oLamcla:mTagr NOBORDER ACTION (vgraba:=.t.,oLamcla:autoriza(29))
REDEFINE BTNBMP Btn_Modi ID 4001 OF oCuadro RESOURCE "Bmodi" TOOLTIP oLamcla:mTmod NOBORDER ACTION (vgraba:=.f.,oLamcla:autoriza(30))
REDEFINE BTNBMP Btn_Borr ID 4002 OF oCuadro RESOURCE "Bborr" TOOLTIP oLamcla:mTbor NOBORDER ACTION oLamcla:autoriza(31)
REDEFINE BTNBMP Btn_Imor ID 4004 OF oCuadro RESOURCE "Bimpr" TOOLTIP oLamcla:mTimp NOBORDER ACTION oLamcla:autoriza(32)
REDEFINE BTNBMP Btn_Sali ID 4006 OF oCuadro RESOURCE "Bsalid" TOOLTIP oLamcla:mTsal NOBORDER ACTION oCuadro:end()
REDEFINE BTNBMP Btn_Limp ID 4010 OF oCuadro RESOURCE "BLimpi" TOOLTIP oLamcla:mTfil NOBORDER ACTION (oC1vg1:=space(100),pArMedi())
REDEFINE COMBOBOX oM1oc1 VAR oM1vc1 PROMPTS oM1lc1 ID 4003 OF oCuadro UPDATE ;
ON CHANGE(IF(oM1vc1="Código",vOrden:="m_Medida",vOrden:="m_Nombre"),(pArMedi()))
REDEFINE GET oC1og1 VAR oC1vg1 ID 4009 OF oCuadro UPDATE VALID(pBusMed(),.T.)
TXBrowse():lHeaders := .T.
oTbMed:GoTop()
oBrw := TXBrowse():New( oCuadro )
WITH OBJECT oBrw
:CreateHeader()
MySetbrowse( oBrw,oTbMed )
:nMarqueeStyle := MARQSTYLE_HIGHLROW
:nColDividerStyle := LINESTYLE_RAISED
:bClrSelFocus := {|| { CLR_WHITE, RGB(24, 116, 205) } }
oBrw:blDblClick := {|| vgraba:=.f.,oLamcla:autoriza(30)}
oBrw:bKeyDown := {|nKey|iif(nKey == 13,(vgraba:=.f.,oLamcla:autoriza(30)),(" "))}
:nHeaderLines := 1
:lColDividerComplete := .t.
:lRecordSelector := .t.
:SetColor(CLR_BLACK, RGB(255,255,235))
:bClrStd := {|| IF( (oTbMed:Recno()%2)==0,{CLR_BLACK,oLamcla:cClr2},{CLR_BLACK,oLamcla:cClr1} ) }
WITH OBJECT :AddCol()
:cHeader := "Código"
:bStrData := GenCB(oTbMed,1)
:nHeadStrAlign := AL_LEFT
:nDataStrAlign := AL_LEFT
:nWidth := 80
END
WITH OBJECT :AddCol()
:cHeader := "Nombre"
:bStrData := GenCB(oTbMed,2)
:nHeadStrAlign := AL_LEFT
:nDataStrAlign := AL_LEFT
:nWidth := 225
END
WITH OBJECT :AddCol()
:cHeader := "Sigla"
:bStrData := GenCB(oTbMed,3)
:nHeadStrAlign := AL_LEFT
:nDataStrAlign := AL_LEFT
:nWidth := 65
END
:CreateFromResource( 102 )
END
oCuadro:cTitle := "Tabla de Medidas"
ACTIVATE DIALOG oCuadro CENTERED
oTbMed:End()
En entorno MDI
- Code: Select all Expand view RUN
********************
*Catalogo de Medidas
********************
PROC pMedida()
vgraba:=.f.
oM1vc1:="Código"
oM1lc1:={"Código","Nombre"}
vOrden:="m_Medida"
oC1vg1:=space(100)
oLamcla:oTbMed := oLamcla:oServer:Query("SELECT * from "+oLamcla:tMedi+" ORDER BY "+alltrim(vOrden), .f. )
DEFINE WINDOW oWndChild MDICHILD OF oWnd FROM 3,3 TO 6,6 COLOR "N/W" nomaximize border none ICON "#8009"
//oWndChild:bGotFocus = { || oCuadro:SetFocus() }
DEFINE DIALOG oCuadro RESOURCE "orCiudad" OF oWndChild
REDEFINE BTNBMP Btn_Agre ID 4007 OF oCuadro RESOURCE "Bagre" TOOLTIP oLamcla:mTagr NOBORDER ACTION (vgraba:=.t.,oLamcla:autoriza(29))
REDEFINE BTNBMP Btn_Modi ID 4001 OF oCuadro RESOURCE "Bmodi" TOOLTIP oLamcla:mTmod NOBORDER ACTION (vgraba:=.f.,oLamcla:autoriza(30))
REDEFINE BTNBMP Btn_Borr ID 4002 OF oCuadro RESOURCE "Bborr" TOOLTIP oLamcla:mTbor NOBORDER ACTION oLamcla:autoriza(31)
REDEFINE BTNBMP Btn_Imor ID 4004 OF oCuadro RESOURCE "Bimpr" TOOLTIP oLamcla:mTimp NOBORDER ACTION oLamcla:autoriza(32)
REDEFINE BTNBMP Btn_Sali ID 4006 OF oCuadro RESOURCE "Bsalid" TOOLTIP oLamcla:mTsal NOBORDER ACTION oCuadro:end()
REDEFINE BTNBMP Btn_Limp ID 4010 OF oCuadro RESOURCE "BLimpi" TOOLTIP oLamcla:mTfil NOBORDER ACTION (oC1vg1:=space(100),pArMedi())
REDEFINE COMBOBOX oM1oc1 VAR oM1vc1 PROMPTS oM1lc1 ID 4003 OF oCuadro UPDATE ;
ON CHANGE(IF(oM1vc1="Código",vOrden:="m_Medida",vOrden:="m_Nombre"),(pArMedi()))
REDEFINE GET oC1og1 VAR oC1vg1 ID 4009 OF oCuadro UPDATE VALID(pBusMed(),.T.)
TXBrowse():lHeaders := .T.
oLamcla:oTbMed:GoTop()
oBrw := TXBrowse():New( oCuadro )
WITH OBJECT oBrw
:CreateHeader()
MySetbrowse( oBrw,oLamcla:oTbMed )
:nMarqueeStyle := MARQSTYLE_HIGHLROW
:nColDividerStyle := LINESTYLE_RAISED
:bClrSelFocus := {|| { CLR_WHITE, RGB(24, 116, 205) } }
oBrw:blDblClick := {|| vgraba:=.f.,oLamcla:autoriza(30)}
oBrw:bKeyDown := {|nKey|iif(nKey == 13,(vgraba:=.f.,oLamcla:autoriza(30)),(" "))}
:nHeaderLines := 1
:lColDividerComplete := .t.
:lRecordSelector := .t.
:SetColor(CLR_BLACK, RGB(255,255,235))
:bClrStd := {|| IF( (oLamcla:oTbMed:Recno()%2)==0,{CLR_BLACK,oLamcla:cClr2},{CLR_BLACK,oLamcla:cClr1} ) }
WITH OBJECT :AddCol()
:cHeader := "Código"
:bStrData := GenCB(oLamcla:oTbMed,1)
:nHeadStrAlign := AL_LEFT
:nDataStrAlign := AL_LEFT
:nWidth := 80
END
WITH OBJECT :AddCol()
:cHeader := "Nombre"
:bStrData := GenCB(oLamcla:oTbMed,2)
:nHeadStrAlign := AL_LEFT
:nDataStrAlign := AL_LEFT
:nWidth := 225
END
WITH OBJECT :AddCol()
:cHeader := "Sigla"
:bStrData := GenCB(oLamcla:oTbMed,3)
:nHeadStrAlign := AL_LEFT
:nDataStrAlign := AL_LEFT
:nWidth := 65
END
:CreateFromResource( 102 )
END
ACTIVATE DIALOG oCuadro NOWAIT CENTERED ON INIT oCuadro:Move( 0, 0 ) VALID (oWndChild:End(), .t. )
oWndChild:nWidth := oCuadro:nWidth+7
oWndChild:nHeight := oCuadro:nHeight+32
oWndChild:cTitle:="Tabla de Medidas"
ACTIVATE WINDOW oWndChild ON INIT oWnd:paint()
oLamcla:oTbMed:End()
La "ventana" se dibuja perfectamente para los dos casos, pero al momento que el GET (oC1og1) toma el foco me sale el ERROR variable oC1vg1 no existe, aun estando definida al inicio de la funcion.
Alguien me puede ayudar..