Mini Kabibi Habibi

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

G�VERSION =   3.00dataenvironmentdataenvironmentDataenvironmentLLeft = 105
Top = 221
Width = 495
Height = 155
Name = "Dataenvironment"
cursorcursorCursor1Dataenvironment�Left = 20
Top = 10
Width = 90
Height = 90
Alias = "employee"
Database = ..\..\data\testdata.dbc
CursorSource = "employee"
Name = "Cursor1"
22formformfrmQueryByForm�DataSession = 2
Top = 2
Left = 5
Height = 326
Width = 444
DoCreate = .T.
BufferMode = 1
BorderStyle = 3
Caption = "Create a Query-By-Example Form"
MaxButton = .F.
HelpContextID = 169
Name = "frmQueryByForm"
�PROCEDURE parsecondition
LPARAMETERS cCondition, cControlSource
LOCAL lcRetCondition, lcFieldName
IF TYPE('cCondition') = 'C'
	cCondition = ALLTRIM(cCondition)
ENDIF

lcFieldName = SUBSTRC(cControlSource,(RATC(".",cControlSource)+1))

*!* NOTE: If you add a checkbox, radio button, or command group to
*!* the form, this routine will need to be changed to handle that
*!* specific datatype.

IF !EMPTY(cCondition) THEN
	*!* If the type is Character or Memo, check to see if the 
	*!* user has entered a complex condition (if so, take that 
	*!* condition literally without any manipulation
	IF TYPE('cCondition')$ "CM" 
		IF ("<"	 	$ cCondition OR ;
			"==" 	$ cCondition OR ;
			"LIKE" 	$ cCondition OR ;
			"<>" 	$ cCondition OR ;
			"!=" 	$ cCondition OR ;
			"#" 	$ cCondition OR ;
			"=" 	$ cCondition OR ;
			">" 	$ cCondition)
		  	lcRetCondition = lcFieldName + cCondition
		ENDIF
	ENDIF
	*!* If a complex condition wasn't found above (lcRetCondition will be empty)
	*!* Then we need to create the WHERE condition ourselves
	IF EMPTY(lcRetCondition)
		*!* The RATC() Functions figure out the column to compare based on the 
		*!* controlSource of the control and any delimiters needed for the 
		*!* datatype are added around the values (not all conditions are
		*!* assumed to be = when we construct them ourselves
		DO CASE
			CASE TYPE(cControlSource) $ "CM"
				lcRetCondition = "ALLTRIM(" + lcFieldName + ")" + " = " + CHR(34) + cCondition + CHR(34)
			CASE TYPE(cControlSource) $ "DT"
				lcRetCondition = lcFieldName + " = {" + DTOC(cCondition) + "}"
			OTHERWISE
				lcRetCondition = lcFieldName + " = " + STR(cCondition)
		ENDCASE	
	ENDIF
ELSE
	lcRetCondition = ""
ENDIF

RETURN lcRetCondition
ENDPROC
PROCEDURE Deactivate
IF TYPE("THIS.c_solutions1") = "O" THEN
	THIS.c_solutions1.restoreHelp
ENDIF
ENDPROC
PROCEDURE Activate
THIS.c_solutions1.saveHelp
ENDPROC
PROCEDURE Init
IF  fontmetric(1, 'MS Sans Serif', 8, '') # 13 OR ;
	fontmetric(4, 'MS Sans Serif', 8, '') # 2 OR ;
	fontmetric(6, 'MS Sans Serif', 8, '') # 5 OR ;
	fontmetric(7, 'MS Sans Serif', 8, '') # 11
	this.setall('fontname', 'Tahoma')  
ELSE
	this.setall('fontname','MS Sans Serif')
ENDIF
this.setall('fontsize',8)


ENDPROC
I�� 00�%�)e�U��������%�C�
cConditionb�C��C�T��C�����T��C�C�.����%�C��
����%�C�
cConditionb�CM���m%��<��
�==���LIKE��
�<>��
�!=��	�#��	�=��	�>����T��������%�C������
H�7����C�b�CM����5T���ALLTRIM(��)� = C�" �C�" ���C�b�DT���� T���� = {C�*�}��2���T���� = C�Z�������
T������	B����U
CCONDITIONCCONTROLSOURCELCRETCONDITIONLCFIELDNAME9%%�C�THIS.c_solutions1b�O��2�
������UTHISC_SOLUTIONS1RESTOREHELP
�����UTHISC_SOLUTIONS1SAVEHELP	�%�C��
MS Sans Serif���$�
�!C��
MS Sans Serif���$��!C��
MS Sans Serif���$��!C��
MS Sans Serif���$�����!��C�fontname�Tahoma�������(��C�fontname�
MS Sans Serif�������C�fontsize�����UTHISSETALLparsecondition,��
Deactivaten��Activate���Init���1����A���AA��QQQ��AA��A�2Q�A2�2d	��A�3�N4 m�9"��<)0s*parsecondition Parses a condition entered into a textbox and returns a valid condition for a SQL WHERE condition
shapeshapeShape1frmQueryByFormcTop = 82
Left = 10
Height = 237
Width = 342
BackStyle = 0
SpecialEffect = 0
Name = "Shape1"

commandbutton
commandbutton
cmdQBFModefrmQueryByForm�AutoSize = .F.
Top = 83
Left = 362
Height = 23
Width = 72
FontBold = .F.
FontName = "MS Sans Serif"
FontSize = 8
Caption = "\<Enter QBF"
TabIndex = 23
Name = "cmdQBFMode"
jPROCEDURE Click

*!* In order to clear out all the controls with a controlSource,
*!* we need to start a transaction and append a record (then when
*!* we are done we'll rollback the transaction so the new record
*!* doesn't get added to the table
BEGIN TRANSACTION

APPEND BLANK

*!* Disable the VCR control so users cannot navigate to
*!* other records
THISFORM.vcr1.enabled = .F.

THIS.Enabled = .F.

THISFORM.cmdExecuteQBF.Enabled = .T.
THISFORM.cmdClearFilter.enabled = .F.

*!* Make Emp ID editable so user can search on EMP_ID
THISFORM.txtEmp_ID.readonly = .F.

THISFORM.Refresh
ENDPROC
z�� aa�%�
�Ui����T����-��T���-��T����a��T����-��T����-��
����U	THISFORMVCR1ENABLEDTHIS
CMDEXECUTEQBFCMDCLEARFILTER	TXTEMP_IDREADONLYREFRESHClick,��1VR��1_)a
commandbutton
commandbutton
cmdExecuteQBFfrmQueryByForm�Top = 111
Left = 362
Height = 23
Width = 72
FontBold = .F.
FontName = "MS Sans Serif"
FontSize = 8
Caption = "\<Query"
Enabled = .F.
TabIndex = 24
Name = "cmdExecuteQBF"
�PROCEDURE Click
LOCAL cFilter
cFilter = ""

*!* First, we need to walk all the controls on the form and find
*!* all controls with a controlSource and has a value in the value property.

FOR nCnt = 1 to THISFORM.ControlCount
	IF TYPE('THISFORM.Controls(nCnt).controlSource') <> "U" THEN
		IF !EMPTY(THISFORM.Controls(nCnt).ControlSource) AND ;
		  TYPE('THISFORM.Controls(nCnt).value') <> "U" THEN
		  
		    *!* Now we need to parse the value property into a proper
		    *!* condition using the parseCondition method of the form
			cCondition = THISFORM.parseCondition(THISFORM.Controls(nCnt).value,THISFORM.Controls(nCnt).controlSource)
			
			*!* If there is a condition, add it to are overall filter
			IF !EMPTY(cCondition) THEN
				cFilter = cFilter + " AND " + cCondition
			ENDIF
		ENDIF
	ENDIF
ENDFOR

*!* We need to rollback the transaction to discard the APPEND'ed record
ROLLBACK

THIS.Enabled = .F.
THISFORM.cmdQBFMode.Enabled = .T.

*!* Make Emp ID non-editable so user cannot change value
THISFORM.txtEmp_ID.readonly = .T.

*!* This removes the " AND " keyword that is not needed for the 
*!* first condition added to cFilter
IF !EMPTY(cFilter) THEN
	cFilter = ALLTRIM(SUBSTRC(cFilter,5))
ENDIF

*!* Now we are ready to apply the filter
SET FILTER TO &cFilter

THISFORM.cmdClearFilter.enabled = .T.

THISFORM.vcr1.enabled = .T.
THISFORM.vcr1.cmdTop.click

THISFORM.Refresh
ENDPROC
`�� GGq%����U����
T����������(������9%�C�%THISFORM.Controls(nCnt).controlSourceb�U���F%�CC�����
�(C�THISFORM.Controls(nCnt).valueb�U	���-T��CC����C��������%�C��
���T���� AND ����������T�	�
�-��T���
�a��T���
�a��%�C��
��m�T��CC��굛���SET FILTER TO &cFilter
T���
�a��T���
�a��������
����UCFILTERNCNTTHISFORMCONTROLCOUNTCONTROLS
CONTROLSOURCE
CCONDITIONPARSECONDITIONVALUETHISENABLED
CMDQBFMODE	TXTEMP_IDREADONLYCMDCLEARFILTERVCR1CMDTOPCLICKREFRESHClick,��1q���b��AAAAC�QA��1�)GlabellabelLabel1frmQueryByForm�AutoSize = .T.
FontBold = .F.
FontName = "MS Sans Serif"
FontSize = 8
BackStyle = 0
Caption = "\<First name:"
Height = 15
Left = 21
Top = 125
Width = 53
TabIndex = 4
Name = "Label1"
labellabelLabel2frmQueryByForm�AutoSize = .T.
FontBold = .F.
FontName = "MS Sans Serif"
FontSize = 8
BackStyle = 0
Caption = "\<Last name:"
Height = 15
Left = 187
Top = 125
Width = 54
TabIndex = 6
Name = "Label2"
labellabelLabel3frmQueryByForm�AutoSize = .T.
FontBold = .F.
FontName = "MS Sans Serif"
FontSize = 8
BackStyle = 0
Caption = "\<Title:"
Height = 15
Left = 21
Top = 150
Width = 25
TabIndex = 8
Name = "Label3"
labellabelLabel4frmQueryByForm�AutoSize = .T.
FontBold = .F.
FontName = "MS Sans Serif"
FontSize = 8
BackStyle = 0
Caption = "\<Address:"
Height = 15
Left = 21
Top = 175
Width = 43
TabIndex = 10
Name = "Label4"
labellabelLabel5frmQueryByForm�AutoSize = .T.
FontBold = .F.
FontName = "MS Sans Serif"
FontSize = 8
BackStyle = 0
Caption = "Cit\<y:"
Height = 15
Left = 21
Top = 211
Width = 22
TabIndex = 12
Name = "Label5"
labellabelLabel6frmQueryByForm�AutoSize = .T.
FontBold = .F.
FontName = "MS Sans Serif"
FontSize = 8
BackStyle = 0
Caption = "\<Region:"
Height = 15
Left = 196
Top = 211
Width = 39
TabIndex = 14
Name = "Label6"
labellabelLabel7frmQueryByForm�AutoSize = .T.
FontBold = .F.
FontName = "MS Sans Serif"
FontSize = 8
BackStyle = 0
Caption = "Emp \<ID:"
Height = 15
Left = 21
Top = 100
Width = 40
TabIndex = 2
Name = "Label7"
labellabelLabel8frmQueryByForm�AutoSize = .T.
FontBold = .F.
FontName = "MS Sans Serif"
FontSize = 8
BackStyle = 0
Caption = "\<Birthdate:"
Height = 15
Left = 21
Top = 261
Width = 47
TabIndex = 18
Name = "Label8"
labellabelLabel9frmQueryByForm�AutoSize = .T.
FontBold = .F.
FontName = "MS Sans Serif"
FontSize = 8
BackStyle = 0
Caption = "\<Hire Date:"
Height = 15
Left = 189
Top = 261
Width = 50
TabIndex = 20
Name = "Label9"
labellabelLabel10frmQueryByForm�AutoSize = .T.
FontBold = .F.
FontName = "MS Sans Serif"
FontSize = 8
BackStyle = 0
Caption = "Co\<untry:"
Height = 15
Left = 21
Top = 236
Width = 41
TabIndex = 16
Name = "Label10"

commandbutton
commandbuttonClosefrmQueryByForm�AutoSize = .F.
Top = 296
Left = 362
Height = 23
Width = 72
FontBold = .F.
FontName = "MS Sans Serif"
FontSize = 8
Caption = "Close"
TabIndex = 29
Name = "Close"
WPROCEDURE Click
IF TXNLEVEL() <> 0 THEN
	ROLLBACK
ENDIF
THISFORM.Release
ENDPROC
�� ���%i�x�U&%�C�������
����UTHISFORMRELEASEClick,��1AA�1L)�vcr..\..\classes\buttons.vcx	containervcr1frmQueryByFormTop = 287
Left = 114
Width = 104
Height = 24
TabIndex = 22
Name = "vcr1"
cmdTop.Name = "cmdTop"
cmdPrior.Name = "cmdPrior"
cmdNext.Name = "cmdNext"
cmdBottom.Name = "cmdBottom"
Datachecker1.Height = 15
Datachecker1.Width = 23
Datachecker1.Name = "Datachecker1"

commandbutton
commandbuttoncmdClearFilterfrmQueryByForm�AutoSize = .F.
Top = 150
Left = 362
Height = 23
Width = 72
FontBold = .F.
FontName = "MS Sans Serif"
FontSize = 8
Caption = "\<Clear Filter"
Enabled = .F.
TabIndex = 25
Name = "cmdClearFilter"
�PROCEDURE Click

*!* Clear the filter that was set
SET FILTER TO
GO TOP
THIS.enabled = .F.

THISFORM.Refresh
THISFORM.vcr1.EnableDisableButtons

ENDPROC
 �� �4%����U3G(�#)�T���-��
����
�����UTHISENABLEDTHISFORMREFRESHVCR1ENABLEDISABLEBUTTONSClick,��1cQ���2�)textboxtextbox	txtEmp_idfrmQueryByForm�FontName = "MS Sans Serif"
FontSize = 8
ControlSource = "employee.emp_id"
Height = 23
Left = 83
ReadOnly = .T.
TabIndex = 3
Top = 96
Width = 95
Name = "txtEmp_id"
textboxtextbox
txtFirst_namefrmQueryByForm�FontName = "MS Sans Serif"
FontSize = 8
ControlSource = "employee.first_name"
Height = 23
Left = 83
TabIndex = 5
Top = 121
Width = 95
Name = "txtFirst_name"
textboxtextboxtxtLast_namefrmQueryByForm�FontName = "MS Sans Serif"
FontSize = 8
ControlSource = "employee.last_name"
Height = 23
Left = 247
TabIndex = 7
Top = 121
Width = 95
Name = "txtLast_name"
textboxtextboxtxtTitlefrmQueryByForm�FontName = "MS Sans Serif"
FontSize = 8
ControlSource = "employee.title"
Height = 23
Left = 83
TabIndex = 9
Top = 146
Width = 259
Name = "txtTitle"
editboxeditbox
edtAddressfrmQueryByForm�FontName = "MS Sans Serif"
FontSize = 8
Height = 23
Left = 83
TabIndex = 11
Top = 171
Width = 259
ControlSource = "employee.address"
Name = "edtAddress"
textboxtextboxtxtCityfrmQueryByForm�FontName = "MS Sans Serif"
FontSize = 8
ControlSource = "employee.city"
Height = 23
Left = 83
TabIndex = 13
Top = 207
Width = 95
Name = "txtCity"
textboxtextbox	txtRegionfrmQueryByForm�FontName = "MS Sans Serif"
FontSize = 8
ControlSource = "employee.region"
Height = 23
Left = 247
TabIndex = 15
Top = 207
Width = 95
Name = "txtRegion"
textboxtextbox
txtCountryfrmQueryByForm�FontName = "MS Sans Serif"
FontSize = 8
ControlSource = "employee.country"
Height = 23
Left = 83
TabIndex = 17
Top = 232
Width = 95
Name = "txtCountry"
textboxtextboxtxtBirthdatefrmQueryByForm�FontName = "MS Sans Serif"
FontSize = 8
ControlSource = "employee.birth_date"
Height = 23
Left = 83
TabIndex = 19
Top = 257
Width = 95
Name = "txtBirthdate"
textboxtextboxtxtHire_datefrmQueryByForm�FontName = "MS Sans Serif"
FontSize = 8
ControlSource = "employee.hire_date"
Height = 23
Left = 247
TabIndex = 21
Top = 257
Width = 95
Name = "txtHire_date"
c_solutions..\solution.vcxcustomC_solutions1frmQueryByForm]Top = 227
Left = 397
Height = 18
Width = 25
autosetdefault = .T.
Name = "C_solutions1"
behindscenes..\solution.vcx
commandbutton
Behindscenes1frmQueryByForm>Top = 260
Left = 408
TabIndex = 28
Name = "Behindscenes1"
shapeshapeShape3frmQueryByFormbTop = 11
Left = 10
Height = 56
Width = 425
BackStyle = 0
SpecialEffect = 0
Name = "Shape3"
labellabelLabel11frmQueryByForm�FontName = "MS Sans Serif"
FontSize = 8
WordWrap = .T.
Caption = "This interface provides an easy way for users to find information in a table.  First, enter QBF mode by clicking Enter QBF.  Next, enter what you would like to search for in the boxes and then click Query to execute the query to see the results."
Height = 43
Left = 20
Top = 21
Width = 403
TabIndex = 0
Name = "Label11"
labellabelLabel14frmQueryByForm�AutoSize = .T.
FontName = "MS Sans Serif"
FontSize = 8
Caption = " Instructions "
Height = 15
Left = 18
Top = 5
Width = 62
TabIndex = 0
Name = "Label14"
labellabelLabel12frmQueryByForm�AutoSize = .T.
FontName = "MS Sans Serif"
FontSize = 8
Caption = " Employee Information "
Height = 15
Left = 18
Top = 75
Width = 109
TabIndex = 1
Name = "Label12"

commandbutton
commandbutton
cmdShowFilterfrmQueryByForm�AutoSize = .F.
Top = 189
Left = 362
Height = 23
Width = 72
FontBold = .F.
FontName = "MS Sans Serif"
FontSize = 8
Caption = "\<Show Filter..."
TabIndex = 25
Name = "cmdShowFilter"
�PROCEDURE Click
#DEFINE NOFILTER_LOC	"No filter is currently applied."
#DEFINE FILTER_LOC	"Filter: "
IF EMPTY(FILTER()) THEN
	MESSAGEBOX(NOFILTER_LOC)
ELSE
	MESSAGEBOX(FILTER_LOC + FILTER())
ENDIF

ENDPROC
�� ����%����U_%�CC����9�+��C�No filter is currently applied.�x���X���C�Filter: C��x���UClick,��1���qA2�)�rArial, 0, 9, 5, 15, 12, 32, 3, 0
MS Sans Serif, 0, 8, 5, 13, 11, 11, 2, 0
Courier New, 1, 11, 9, 17, 12, 11, 5, 0
�DataSession = 2
Top = 2
Left = 5
Height = 326
Width = 444
DoCreate = .T.
BufferMode = 1
BorderStyle = 3
Caption = "Create a Query-By-Example Form"
MaxButton = .F.
HelpContextID = 1231557
Name = "frmQueryByForm"