*--------------------------------------------------------------------------------------------------------------------------------------------------------
* (EN) AUTOGENERATED - ATTENTION!! - NOT INTENDED FOR EXECUTION!! USE ONLY FOR MERGING CHANGES AND STORING WITH SCM TOOLS!!
*--------------------------------------------------------------------------------------------------------------------------------------------------------
*< FOXBIN2PRG: Version="1.21" SourceFile="_ct_base.vcx" CPID="1252" /> (Solo para binarios VFP 9 / Only for VFP 9 binaries)
*
*
DEFINE CLASS _ct_controller_keypress AS custom 
 	*< CLASSDATA: Baseclass="custom" Timestamp="" Scale="Pixels" Uniqueid="" />

	*<DefinedPropArrayMethod>
		*m: do_bind
		*m: do_keypressed
		*m: do_unbind
		*p: oobiect
	*</DefinedPropArrayMethod>

	*<PropValue>
		Height = 19
		Name = "_ct_controller_keypress"
		oobiect = 
		Width = 23
	*</PropValue>
	
	PROCEDURE do_bind
		Local loObiect
		llBound = .F.
		loObiect = This.Parent
		Do While !llBound
			loObiect = loObiect.Parent
			If Pemstatus(loObiect,"KeyPress",5)
				Bindevent(loObiect,"KeyPress",This,"do_keypressed",2)
				This.oobiect = loObiect
				llBound = .T.
			Endif
		Enddo
		
		*!*	If Pemstatus(This.Parent.Parent,"KeyPress",5)
		*!*		Bindevent(This.Parent.Parent,"KeyPress",This,"do_keypressed",2)
		*!*		This.oobiect=This.Parent.Parent
		*!*	Else
		*!*		If Pemstatus(This.Parent.Parent.Parent,"KeyPress",5)
		*!*			Bindevent(This.Parent.Parent.Parent,"KeyPress",This,"do_keypressed",2)
		*!*			This.oobiect=This.Parent.Parent.Parent
		*!*		Else
		*!*			If Pemstatus(This.Parent.Parent.Parent.Parent,"KeyPress",5)
		*!*				Bindevent(This.Parent.Parent.Parent.Parent,"KeyPress",This,"do_keypressed",2)
		*!*				This.oobiect=This.Parent.Parent.Parent.Parent
		*!*			Else
		*!*				If Pemstatus(This.Parent.Parent.Parent.Parent.Parent,"KeyPress",5)
		*!*					Bindevent(This.Parent.Parent.Parent.Parent.Parent,"KeyPress",This,"do_keypressed",2)
		*!*					This.oobiect=This.Parent.Parent.Parent.Parent.Parent
		*!*				Endif
		*!*			Endif
		*!*		Endif
		*!*	Endif
	ENDPROC

	PROCEDURE do_keypressed
		Lparameters nKeyCode, nShiftAltCtrl
		Do Case
		Case nKeyCode=14 And nShiftAltCtrl=2
			If Pemstatus(This.Parent,"do_adauga",5)
				This.Parent.do_adauga()
			Endif
		Case nKeyCode=13 And nShiftAltCtrl=2
			If Pemstatus(This.Parent,"inainte_de_do_modifica",5)
				This.Parent.inainte_de_do_modifica()
			Endif
		Case nKeyCode=4 And nShiftAltCtrl=2
			If Pemstatus(This.Parent,"inainte_de_do_sterge",5)
				This.Parent.inainte_de_do_sterge()
			Endif
		Case nKeyCode=16 And nShiftAltCtrl=2
			Nodefault
			If Pemstatus(This.Parent,"inainte_de_do_listare",5)
				This.Parent.inainte_de_do_listare()
			Endif
		Case nKeyCode=3 And nShiftAltCtrl=2
			If Pemstatus(This.Parent,"do_cauta",5)
				This.Parent.do_copiaza()
			Endif
		Otherwise
			This.oObiect.KeyPress(nKeyCode,nShiftAltCtrl)
		Endcase
		
	ENDPROC

	PROCEDURE do_unbind
		Unbindevents(This)
		*!*		Unbindevents(This.oobiect,"KeyPress",This,"do_keypressed")
	ENDPROC

ENDDEFINE

DEFINE CLASS _ctfrmbase AS container 
 	*< CLASSDATA: Baseclass="container" Timestamp="" Scale="Pixels" Uniqueid="" />

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="Gridsort1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_ct_controller_keypress1" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*m: actualizeaza_cursoare
		*m: actualizeaza_drepturi
		*m: actualizeaza_grid1
		*m: actualizeaza_grid2
		*m: creeaza_cursoare
		*m: do_activeaza_container
		*m: do_adauga
		*m: do_cauta
		*m: do_copiaza
		*m: do_dezactiveaza_container
		*m: do_excel
		*m: do_executa
		*m: do_listare
		*m: do_modifica
		*m: do_precedent
		*m: do_reface
		*m: do_reset
		*m: do_selectall
		*m: do_sterge
		*m: do_urmator
		*m: grid_sort
		*m: grid_sort_bind
		*m: inainte_de_do_excel
		*m: inainte_de_do_listare
		*m: inainte_de_do_modifica
		*m: inainte_de_do_reface
		*m: inainte_de_do_sterge
		*p: cbuton1
		*p: cbuton2
		*p: cbuton3
		*p: cbuton4
		*p: cbuton5
		*p: cbuton6
		*p: cbuton7
		*p: cgridsortlist
		*p: cschema		&& Numele schemei pentru care au fost create cursoarele
		*p: ctraducere		&& Traducerea filtrului de cautare.
		*p: filtru_pretty
		*p: filtru_pretty_ro
		*p: filtru_pretty_ro_full
		*p: lactiv1
		*p: lactiv2
		*p: lactiv3
		*p: lactiv4
		*p: lactiv5
		*p: lactiv6
		*p: lactiv7
		*p: lshowrezultate		&& Afiseaza 'Nu exista rezultate' la do_cauta()
		*p: nselectate
		*p: _memberdata		&& XML Metadata for customizable properties
	*</DefinedPropArrayMethod>

	*<PropValue>
		BorderWidth = 0
		cbuton1 = but_excel1
		cbuton2 = but_listare1
		cbuton3 = but_modifica1
		cbuton4 = but_sterge1;but_reface1
		cbuton5 = 
		cbuton6 = 
		cbuton7 = 
		cgridsortlist = 
		cschema = 
		ctraducere = 
		filtru_pretty = .F.
		filtru_pretty_ro = .F.
		filtru_pretty_ro_full = .F.
		Height = 200
		lactiv1 = .F.
		lactiv2 = .F.
		lactiv3 = .F.
		lactiv4 = .F.
		lactiv5 = .F.
		lactiv6 = .F.
		lactiv7 = .F.
		lshowrezultate = .T.
		Name = "_ctfrmbase"
		nselectate = 0
		Width = 200
		_memberdata = <VFPData>
			<memberdata name="actualizeaza_drepturi" type="Method" favorites="True"/>
			<memberdata name="actualizeaza_grid1" type="Method" favorites="True"/>
			<memberdata name="actualizeaza_grid2" type="Method" favorites="True"/>
			<memberdata name="cbuton1" type="Property" favorites="True"/>
			<memberdata name="cbuton2" type="Property" favorites="True"/>
			<memberdata name="cbuton3" type="Property" favorites="True"/>
			<memberdata name="cbuton4" type="Property" favorites="True"/>
			<memberdata name="cbuton5" type="Property" favorites="True"/>
			<memberdata name="cbuton6" type="Property" favorites="True"/>
			<memberdata name="cbuton7" type="Property" favorites="True"/>
			<memberdata name="do_adauga" type="Method" favorites="True"/>
			<memberdata name="do_cauta" type="Method" favorites="True"/>
			<memberdata name="do_excel" type="Method" favorites="True"/>
			<memberdata name="do_executa" type="Method" favorites="True"/>
			<memberdata name="do_listare" type="Method" favorites="True"/>
			<memberdata name="do_modifica" type="Method" favorites="True"/>
			<memberdata name="do_reface" type="Method" favorites="True"/>
			<memberdata name="do_reset" type="Method" favorites="True"/>
			<memberdata name="do_sterge" type="Method" favorites="True"/>
			<memberdata name="grid_sort" type="Method" favorites="True"/>
			<memberdata name="grid_sort_bind" type="Method" favorites="True"/>
			<memberdata name="lactiv1" type="Property" favorites="True"/>
			<memberdata name="lactiv2" type="Property" favorites="True"/>
			<memberdata name="lactiv3" type="Property" favorites="True"/>
			<memberdata name="lactiv4" type="Property" favorites="True"/>
			<memberdata name="lactiv5" type="Property" favorites="True"/>
			<memberdata name="lactiv6" type="Property" favorites="True"/>
			<memberdata name="lactiv7" type="Property" favorites="True"/>
			<memberdata name="cgridsortlist" type="Property" favorites="True"/>
			<memberdata name="nselectate" type="Property" favorites="True"/>
			<memberdata name="do_selectall" type="Method" favorites="True"/>
			<memberdata name="creeaza_cursoare" type="Method" favorites="True"/>
			<memberdata name="lshowrezultate" display="lShowRezultate"/>
		</VFPData>
	*</PropValue>

	ADD OBJECT '_ct_controller_keypress1' AS _ct_controller_keypress WITH ;
		Left = 134, ;
		Name = "_ct_controller_keypress1", ;
		Top = 126
		*< END OBJECT: ClassLib="_ct_base.vcx" BaseClass="custom" />

	ADD OBJECT 'Gridsort1' AS gridsort WITH ;
		Left = 24, ;
		Name = "Gridsort1", ;
		Top = 3
		*< END OBJECT: ClassLib="gridsort.vcx" BaseClass="custom" />
	
	PROCEDURE actualizeaza_cursoare
	ENDPROC

	PROCEDURE actualizeaza_drepturi
		If !Empty(gcAcces)
		&&	format gcAcces = [optiune1];[optiune2];...;[optiuneN]; &&
			Local lcAcces,lnPozitieS,lnPozitieF,N
			lnPozitieS=1
			For i=1 To Occurs([;],gcAcces)
				lnPozitieF=At([;],gcAcces,i)
				lcAcces=Substr(gcAcces,lnPozitieS,lnPozitieF-lnPozitieS)
				lcProp='this.lactiv'+Alltrim(lcAcces)
				If Type(lcProp)<>'U'
					&lcProp=.T.
					lcProp='this.cbuton'+Alltrim(lcAcces)
					If Type(lcProp)<>'U' And !Empty(&lcProp)
		&&	format lcButoane = [nume_buton1];[nume_buton2];...;[nume_butonN]; &&
						lcButoane=&lcProp
						lnPS=1
						lcButoane=Iif(Substr(lcButoane,Len(lcButoane)-1)=[;],lcButoane,lcButoane+[;])
						For j=1 To Occurs([;],lcButoane)
							lnPF=At([;],lcButoane,j)
							lcButon=Substr(lcButoane,lnPS,lnPF-lnPS)
							lcProp='this.'+Alltrim(lcButon)+'.visible'
							lcProp1='!this.'+ALLTRIM(lcButon)+'.lvizibil'
							If Type(lcProp)<>'U'
								&lcProp=IIF(TYPE(lcProp1)<>'U' and &lcProp1,.F.,.T.)
							Endif
							lnPS=lnPF+1
						Endfor
					Endif
				Endif
				lnPozitieS=lnPozitieF+1
			Endfor
		Endif
		
	ENDPROC

	PROCEDURE actualizeaza_grid1
	ENDPROC

	PROCEDURE actualizeaza_grid2
	ENDPROC

	PROCEDURE creeaza_cursoare
	ENDPROC

	PROCEDURE do_activeaza_container
		This._ct_controller_keypress1.do_bind()
		This.actualizeaza_cursoare()
	ENDPROC

	PROCEDURE do_adauga
	ENDPROC

	PROCEDURE do_cauta
	ENDPROC

	PROCEDURE do_copiaza
	ENDPROC

	PROCEDURE do_dezactiveaza_container
		This._ct_controller_keypress1.do_unbind()
		
	ENDPROC

	PROCEDURE do_excel
	ENDPROC

	PROCEDURE do_executa
	ENDPROC

	PROCEDURE do_listare
	ENDPROC

	PROCEDURE do_modifica
	ENDPROC

	PROCEDURE do_precedent
	ENDPROC

	PROCEDURE do_reface
	ENDPROC

	PROCEDURE do_reset
	ENDPROC

	PROCEDURE do_selectall
	ENDPROC

	PROCEDURE do_sterge
	ENDPROC

	PROCEDURE do_urmator
	ENDPROC

	PROCEDURE grid_sort
		Aevents( laEvents, 0 )
		loHeader = laEvents[ 1 ]
		If Vartype( loHeader ) = 'O'
			If Type('this.gridsort1') = 'O'
				This.gridsort1.oColumnReference = loHeader.Parent
				This.gridsort1.gridsort(loHeader.Parent)
			Endif
		Endif
	ENDPROC

	PROCEDURE grid_sort_bind
		Local lcListaGrid, lnGridCount, loGrid, lcGrid, i, j, loHeader
		
		lcListaGrid = Alltrim(This.cGridSortList)
		lcListaGrid = Strtran(lcListaGrid, ',', ';')
		
		lnGridCount = Getwordcount(lcListaGrid, ';')
		
		For i = 1 To lnGridCount
			lcGrid = Getwordnum(lcListaGrid, i, ';')
			lcGrid = 'this.' + lcGrid
			loGrid = &lcGrid
			If !Pemstatus(loGrid,'name',5)
				Loop
			Endif
		
			For j = 1 To loGrid.ColumnCount
				loHeader = loGrid.Columns(j).Header1
				Bindevent(loHeader, "DblClick", This, "grid_sort")
			Endfor
		Endfor
	ENDPROC

	PROCEDURE inainte_de_do_excel
		If This.lactiv1
			This.do_excel()
		Endif
		
	ENDPROC

	PROCEDURE inainte_de_do_listare
		If This.lactiv2
			This.do_listare
		Endif
	ENDPROC

	PROCEDURE inainte_de_do_modifica
		If This.lactiv3
			This.do_modifica()
		Endif
		
	ENDPROC

	PROCEDURE inainte_de_do_reface
		If This.lactiv4
			This.do_reface
		Endif
	ENDPROC

	PROCEDURE inainte_de_do_sterge
		If This.lactiv4
			This.do_sterge()
		Endif
		
	ENDPROC

	PROCEDURE Init
		This.actualizeaza_drepturi
		This.grid_sort_bind()
	ENDPROC

ENDDEFINE
