Mini Kabibi Habibi

Current Path : C:/Users/ITO/Desktop/VF9/program files/microsoft visual foxpro 9/samples/solution/toledo/
Upload File :
Current File : C:/Users/ITO/Desktop/VF9/program files/microsoft visual foxpro 9/samples/solution/toledo/caxml.sct

A�VERSION =   3.00dataenvironmentdataenvironmentDataenvironmentaTop = 182
Left = 183
Width = 520
Height = 200
DataSource = .NULL.
Name = "Dataenvironment"

cursoradapter
cursoradapterCursor1Dataenvironment�Top = 20
Left = 11
Height = 90
Width = 91
UseDeDataSource = .F.
SelectCmd = See CursorFill
UpdateCmd = 
InsertCmd = 
DeleteCmd = 
CursorSchema = CUSTOMERID C(10), COMPANYNAME C(80), ADDRESS C(120), CONTACTNAME C(60), CONTACTTITLE C(60), COUNTRY C(30), FAX C(48), PHONE C(48), POSTALCODE C(20), REGION C(30)
Alias = "customers"
BufferModeOverride = 5
DataSourceType = "XML"
Flags = 0
KeyFieldList = 
Tables = 
UpdatableFieldList = 
UpdateNameList = 
ConversionFunc = 
Name = "Cursor1"
�PROCEDURE CursorFill
lparameters tlUseCursorSchema, tlNoData, tuOptions, toSource
*** Select code: DO NOT REMOVE
set multilocks on
*** End of Select code: DO NOT REMOVE
*** Setup code: DO NOT REMOVE
***<SelectCmd>
This.SelectCmd = [Thisform.oXMLAdapter.Tables.Item(1)]
***</SelectCmd>
*** End of Setup code: DO NOT REMOVE





return dodefault(tlUseCursorSchema, tlNoData, tuOptions, toSource)

ENDPROC
]�� DDk�%����Uh������G_ �3T����#Thisform.oXMLAdapter.Tables.Item(1)��B�C������UTLUSECURSORSCHEMATLNODATA	TUOPTIONSTOSOURCETHIS	SELECTCMD
CursorFill,��11b4�2�)D22frmsolution..\solution.vcxformForm1�DataSession = 2
Height = 348
Width = 431
DoCreate = .T.
Caption = "CursorAdapter with XMLAdapter"
HelpContextID = 1231690
BindControls = .F.
Name = "Form1"
C_solutions1.Top = 141
C_solutions1.Left = 309
C_solutions1.Name = "C_solutions1"
Behindscenes1.Top = 316
Behindscenes1.Left = 12
Behindscenes1.Name = "Behindscenes1"
Shape2.Top = 12
Shape2.Left = 12
Shape2.Height = 67
Shape2.Width = 408
Shape2.Name = "Shape2"
Label1.Caption = 'This sample shows how to create a cursor fom XML using the CursorAdapter and XMLAdapter classes and how to bind that data to form controls. Make changes in the grid below and click the "Show DiffGram" button to see the changes in an XML diffgram.'
Label1.Height = 53
Label1.Left = 19
Label1.Top = 23
Label1.Width = 396
Label1.Name = "Label1"
Label4.Name = "Label4"
Cmdclose1.Top = 316
Cmdclose1.Left = 348
Cmdclose1.Name = "Cmdclose1"
	�PROCEDURE showprops
#DEFINE CR_LF	CHR(13)+CHR(10)

LPARAMETERS tcObject
LOCAL cPropText, lcObjName 

AMEMBERS(laProps, &tcObject)
ASORT(laProps)
lcObjName = tcObject	
cPropText = "**CursorAdapter non-empty properties **" + CR_LF 
cPropText = cPropText + "** These properties were set by the CursorAdapter builder **" + CR_LF 
cPropText = cPropText + "WITH " + tcObject + CR_LF

FOR i = 1 TO ALEN(laProps,1)
	lcProp = lcObjName + "." + laProps[i]			
	IF TYPE(lcProp)="O" OR NOT (ISNULL(&lcProp) OR EMPTY(&lcProp))
		cPropText = cPropText + CHR(9) + [.] + PROPER(laProps[i]) 
		DO CASE
			CASE TYPE(lcProp)="C"
				IF LEFT(&lcProp,1)= "=" 
					cPropText = cProptext + [ = ] + SUBSTR(&lcProp,2) + CR_LF
				ELSE
					cPropText = cProptext + [ = "] + &lcProp + ["]+ CR_LF
				ENDIF
			CASE TYPE(lcProp)="N"
				cPropText = cPropText + [ = ] + ALLTRIM(STR(&lcProp))+ CR_LF
			CASE TYPE(lcProp)="L"
				cPropText = cPropText + [ = ] + IIF(&lcProp, ".T.", ".F.")+ CR_LF
			CASE TYPE(lcProp)="O"	
				cPropText = cPropText + [= "(Object)"] + CR_LF
			OTHERWISE
				cPropText = cPropText + CR_LF
		ENDCASE			
	ENDIF
NEXT	
cPropText = cPropText + "ENDWITH"

lcFile = thisform.cRunPath+"caprops.prg"
IF FILE(lcFile)
	DELETE FILE (lcFile)
ENDIF
STRTOFILE(cPropText,lcFile)
MODIFY COMMAND (lcFile) NOEDIT NOMENU

ENDPROC
PROCEDURE Init
LOCAL oXMLAdapter as XMLAdapter

DODEFAULT()

TRY
	Thisform.AddProperty('oXMLAdapter',CREATEOBJECT('XMLAdapter'))
	
	*-- Load the XML which creates the Tables collection on the XMLAdapter
	*-- This XML file happens to be an ADO.NET dataset.
	WITH Thisform.oXMLAdapter
	
		.LoadXml(Thisform.cRunPath+'getcustomers.xml',.t.)
	
	ENDWITH	
	
	*-- Take a look in the CursorAdapter Builder (Open the DataEnvironment Designer, 
	*-- right-click on the CursorAdapter then select "Builder") to see the properties 
	*-- of the CursorAdapter. Those properties were set via the CursorAdapter Builder 
	*-- including this important one:	
	Thisform.DataEnvironment.cursor1.SelectCmd="Thisform.oXMLAdapter.Tables.Item(1)"
	*-- This specifies that the source of our CursorAdapter is the XMLTable.
	
	*-- We call CursorFill() on the CursorAdapter after the XMLAdapter is loaded.
	Thisform.DataEnvironment.cursor1.cursorfill()
	
	GO TOP
	
	*-- Once the cursor is created and attached, we can bind the controls on the form.
	Thisform.BindControls = .T.
	Thisform.grdCustomer.AutoFit() 
CATCH
ENDTRY
ENDPROC
:�� !!	>%;�6\�U"������� AMEMBERS(laProps, &tcObject)

��C����
T�����@T���'**CursorAdapter non-empty properties **C�
 C�
 ��YT����<** These properties were set by the CursorAdapter builder **C�
 C�
 ��&T����WITH �C�
 C�
 �������(�C������T����.C����FIF TYPE(lcProp)="O" OR NOT (ISNULL(&lcProp) OR EMPTY(&lcProp))���#T���C�	 �.CC�����
H������C�b�C���� IF LEFT(&lcProp,1)= "=" �4�GcPropText = cProptext + [ = ] + SUBSTR(&lcProp,2) + CHR(13)+CHR(10)
��CcPropText = cProptext + [ = "] + &lcProp + ["]+ CHR(13)+CHR(10)
��C�b�N����JcPropText = cPropText + [ = ] + ALLTRIM(STR(&lcProp))+ CHR(13)+CHR(10)
�C�b�L��D�OcPropText = cPropText + [ = ] + IIF(&lcProp, ".T.", ".F.")+ CHR(13)+CHR(10)
�C�b�O����)T����= "(Object)"C�
 C�
 ��2���T���C�
 C�
 ������T����ENDWITH��T�����caprops.prg��%�C�0�����������C�����
/������U	TCOBJECT	CPROPTEXT	LCOBJNAMELAPROPSILCPROPLCFILETHISFORMCRUNPATH	��Q�
XMLADAPTER�	��C������+��C�oXMLAdapterC�
XMLAdapter�N������������&��C���getcustomers.xmla�����9T������#Thisform.oXMLAdapter.Tables.Item(1)����C������#)�T��	�a����C��
��������UOXMLADAPTERTHISFORMADDPROPERTYLOADXMLCRUNPATHDATAENVIRONMENTCURSOR1	SELECTCMD
CURSORFILLBINDCONTROLSGRDCUSTOMERAUTOFIT	showprops,��Init���1s����a��a1�Aq�1AA�A�A���AAA����A��3Q���bB�4R��A1?'Z�	.)!
*showprops 
textboxtextboxtxtContactnameForm1�Comment = ""
FontName = "Tahoma"
FontSize = 8
ControlSource = "customers.contactname"
Height = 23
Left = 84
MaxLength = 60
TabIndex = 3
Top = 88
Width = 336
Name = "txtContactname"
labellabellblContactnameForm1�AutoSize = .T.
FontName = "Tahoma"
FontSize = 8
WordWrap = .T.
BackStyle = 0
Caption = "Contact Name"
Height = 15
Left = 12
Top = 91
Width = 68
TabIndex = 2
Name = "lblContactname"
gridgridgrdCustomerForm1oColumnCount = 10
FontName = "Tahoma"
FontSize = 8
AllowAddNew = .T.
Height = 180
Left = 12
RecordSource = "customers"
RecordSourceType = 1
RowHeight = 16
Top = 124
Width = 408
Name = "grdCustomer"
Column1.FontName = "Tahoma"
Column1.FontSize = 8
Column1.ControlSource = "customers.customerid"
Column1.Width = 56
Column1.Name = "Column1"
Column2.FontName = "Tahoma"
Column2.FontSize = 8
Column2.ControlSource = "customers.companyname"
Column2.Width = 73
Column2.Name = "Column2"
Column3.FontName = "Tahoma"
Column3.FontSize = 8
Column3.ControlSource = "customers.address"
Column3.Width = 42
Column3.Name = "Column3"
Column4.FontName = "Tahoma"
Column4.FontSize = 8
Column4.ControlSource = "customers.contactname"
Column4.Width = 66
Column4.Name = "Column4"
Column5.FontName = "Tahoma"
Column5.FontSize = 8
Column5.ControlSource = "customers.contacttitle"
Column5.Width = 58
Column5.Name = "Column5"
Column6.FontName = "Tahoma"
Column6.FontSize = 8
Column6.ControlSource = "customers.country"
Column6.Width = 41
Column6.Name = "Column6"
Column7.FontName = "Tahoma"
Column7.FontSize = 8
Column7.ControlSource = "customers.fax"
Column7.Width = 20
Column7.Name = "Column7"
Column8.FontName = "Tahoma"
Column8.FontSize = 8
Column8.ControlSource = "customers.phone"
Column8.Width = 34
Column8.Name = "Column8"
Column9.FontName = "Tahoma"
Column9.FontSize = 8
Column9.ControlSource = "customers.postalcode"
Column9.Width = 56
Column9.Name = "Column9"
Column10.FontName = "Tahoma"
Column10.FontSize = 8
Column10.ControlSource = "customers.region"
Column10.Width = 34
Column10.Name = "Column10"
_PROCEDURE AfterRowColChange
LPARAMETERS nColIndex
thisform.txtContactName.Refresh 
ENDPROC
��� ��ƀ%u���U���
�����U	NCOLINDEXTHISFORMTXTCONTACTNAMEREFRESHAfterRowColChange,��1q�1T)�headerheaderHeader1Form1.grdCustomer.Column1UFontBold = .T.
FontName = "Tahoma"
FontSize = 8
Caption = "ID"
Name = "Header1"
textboxtextboxText1Form1.grdCustomer.Column1�FontName = "Tahoma"
FontSize = 8
BorderStyle = 0
ControlSource = "customers.customerid"
Margin = 0
ForeColor = 0,0,0
BackColor = 255,255,255
Name = "Text1"
headerheaderHeader1Form1.grdCustomer.Column2_FontBold = .T.
FontName = "Tahoma"
FontSize = 8
Caption = "Company Name"
Name = "Header1"
textboxtextboxText1Form1.grdCustomer.Column2�FontName = "Tahoma"
FontSize = 8
BorderStyle = 0
ControlSource = "customers.companyname"
Margin = 0
ForeColor = 0,0,0
BackColor = 255,255,255
Name = "Text1"
headerheaderHeader1Form1.grdCustomer.Column3ZFontBold = .T.
FontName = "Tahoma"
FontSize = 8
Caption = "Address"
Name = "Header1"
textboxtextboxText1Form1.grdCustomer.Column3�FontName = "Tahoma"
FontSize = 8
BorderStyle = 0
ControlSource = "customers.address"
Margin = 0
ForeColor = 0,0,0
BackColor = 255,255,255
Name = "Text1"
headerheaderHeader1Form1.grdCustomer.Column4_FontBold = .T.
FontName = "Tahoma"
FontSize = 8
Caption = "Contact Name"
Name = "Header1"
textboxtextboxText1Form1.grdCustomer.Column4�FontName = "Tahoma"
FontSize = 8
BorderStyle = 0
ControlSource = "customers.contactname"
Margin = 0
ForeColor = 0,0,0
BackColor = 255,255,255
Name = "Text1"
headerheaderHeader1Form1.grdCustomer.Column5`FontBold = .T.
FontName = "Tahoma"
FontSize = 8
Caption = "Contact Title"
Name = "Header1"
textboxtextboxText1Form1.grdCustomer.Column5�FontName = "Tahoma"
FontSize = 8
BorderStyle = 0
ControlSource = "customers.contacttitle"
Margin = 0
ForeColor = 0,0,0
BackColor = 255,255,255
Name = "Text1"
headerheaderHeader1Form1.grdCustomer.Column6ZFontBold = .T.
FontName = "Tahoma"
FontSize = 8
Caption = "Country"
Name = "Header1"
textboxtextboxText1Form1.grdCustomer.Column6�FontName = "Tahoma"
FontSize = 8
BorderStyle = 0
ControlSource = "customers.country"
Margin = 0
ForeColor = 0,0,0
BackColor = 255,255,255
Name = "Text1"
headerheaderHeader1Form1.grdCustomer.Column7VFontBold = .T.
FontName = "Tahoma"
FontSize = 8
Caption = "Fax"
Name = "Header1"
textboxtextboxText1Form1.grdCustomer.Column7�FontName = "Tahoma"
FontSize = 8
BorderStyle = 0
ControlSource = "customers.fax"
Margin = 0
ForeColor = 0,0,0
BackColor = 255,255,255
Name = "Text1"
headerheaderHeader1Form1.grdCustomer.Column8XFontBold = .T.
FontName = "Tahoma"
FontSize = 8
Caption = "Phone"
Name = "Header1"
textboxtextboxText1Form1.grdCustomer.Column8�FontName = "Tahoma"
FontSize = 8
BorderStyle = 0
ControlSource = "customers.phone"
Margin = 0
ForeColor = 0,0,0
BackColor = 255,255,255
Name = "Text1"
headerheaderHeader1Form1.grdCustomer.Column9^FontBold = .T.
FontName = "Tahoma"
FontSize = 8
Caption = "Postal Code"
Name = "Header1"
textboxtextboxText1Form1.grdCustomer.Column9�FontName = "Tahoma"
FontSize = 8
BorderStyle = 0
ControlSource = "customers.postalcode"
Margin = 0
ForeColor = 0,0,0
BackColor = 255,255,255
Name = "Text1"
headerheaderHeader1Form1.grdCustomer.Column10YFontBold = .T.
FontName = "Tahoma"
FontSize = 8
Caption = "Region"
Name = "Header1"
textboxtextboxText1Form1.grdCustomer.Column10�FontName = "Tahoma"
FontSize = 8
BorderStyle = 0
ControlSource = "customers.region"
Margin = 0
ForeColor = 0,0,0
BackColor = 255,255,255
Name = "Text1"

commandbutton
commandbuttoncmdDiffGramForm1�AutoSize = .T.
Top = 316
Left = 60
Height = 23
Width = 87
FontName = "Tahoma"
FontSize = 8
Caption = "Show DiffGram"
BackColor = 255,255,128
Name = "cmdDiffGram"
CPROCEDURE Click
LOCAL lcXML, lcFile, lnRecNo

IF NOT EOF() AND NOT BOF()
	lnRecNo = RECNO()
ELSE
	lnRecNo = 1
ENDIF	

WITH Thisform.oXMLAdapter
	
	*-- Release the XML document but preserve the schema
	.ReleaseXML(.F.)	  

	.UTF8Encoded = .T.	  && Indicates International characters	
	.IsDiffgram = .T.	  && Generate an XML DiffGram	
	llIncludeBefore = .T. && Include <diffgram:before> format
	llChangesOnly = .T.   && Generate only changes we made
	llIsFile = .F.		  && Our XML is a stream 	
	lcSchemaLocation = "" && Our schema is inline
		
	.ToXML("lcXML",lcSchemaLocation,llIsFile,llIncludeBefore,llChangesOnly)
ENDWITH

lcFile = thisform.cRunpath + "CustomerChange.xml"
IF FILE(lcFile)
	DELETE FILE (lcFile)
ENDIF	
STRTOFILE(lcXML,lcFile)
MODIFY FILE (lcFile) NOEDIT NOMENU

GO lnRecNo


ENDPROC
��� ���1%O�U=�����%�C+
�C
	��/�T��CO���D�
T����������������C-���T��a��T��a��T��a��T�	�a��T�
�-��
T�����#��C�lcXML��
��	�����&T����
�CustomerChange.xml��%�C�0����������C�����
/�����	#����ULCXMLLCFILELNRECNOTHISFORMOXMLADAPTER
RELEASEXMLUTF8ENCODED
ISDIFFGRAMLLINCLUDEBEFORE
LLCHANGESONLYLLISFILELCSCHEMALOCATIONTOXMLCRUNPATHClick,��1�B���A�������2Ab��A���38)�
commandbutton
commandbuttonCommand2Form1�AutoSize = .T.
Top = 316
Left = 156
Height = 23
Width = 168
FontName = "Tahoma"
FontSize = 8
Caption = "Show CursorAdapter Properties"
Name = "Command2"
RPROCEDURE Click
thisform.ShowProps("Thisform.DataEnvironment.Cursor1")
ENDPROC
�� ��Ё%x���U30��C� Thisform.DataEnvironment.Cursor1����UTHISFORM	SHOWPROPSClick,��11G)��Arial, 0, 9, 5, 15, 12, 32, 3, 0
MS Sans Serif, 0, 8, 5, 13, 11, 11, 2, 0
Tahoma, 0, 8, 5, 13, 11, 21, 2, 0
Tahoma, 1, 8, 6, 13, 11, 26, 2, 0