Mini Kabibi Habibi

Current Path : C:/Users/ITO/Desktop/VF9/program files/microsoft visual foxpro 9/wizards/
Upload File :
Current File : C:/Users/ITO/Desktop/VF9/program files/microsoft visual foxpro 9/wizards/wizbtns.vct


(@VERSION =  3.029gridgridgrid1pRecordSource = "customer"
FontName = "MS Sans Serif"
FontSize = 8
Height = 152
Width = 397
Name = "grid1"
Class1PixelsJArial, 0, 9, 5, 15, 12, 21, 3, 0
MS Sans Serif, 0, 8, 5, 13, 11, 11, 2, 0
gridaddformPixelsClass10formgridaddform�FontName = "MS Sans Serif"
FontSize = 8
Caption = "Enter key value linking parent and child records:"
Height = 15
Left = 16
Top = 114
Width = 229
Name = "Label5"
gridaddform.Label5labellabel�AutoSize = .T.
FontName = "MS Sans Serif"
FontSize = 8
BackStyle = 0
Caption = "Key field:"
Height = 15
Left = 18
Top = 137
Width = 45
Name = "Label4"
gridaddform.Label4labellabel�FontItalic = .T.
FontName = "MS Sans Serif"
FontSize = 8
BackStyle = 0
Caption = "Label3"
Height = 16
Left = 90
Top = 137
Width = 145
Name = "Label3"
gridaddform.Label3labellabel�FontName = "MS Sans Serif"
FontSize = 8
Caption = "Select option for adding records:"
Height = 15
Left = 16
Top = 17
Width = 155
Name = "Label2"
gridaddform.Label2labellabel�AutoSize = .T.
FontName = "MS Sans Serif"
FontSize = 8
BackStyle = 0
Caption = "\<Key value:"
Height = 15
Left = 18
Top = 165
Width = 52
Name = "Label1"
gridaddform.Label1label!Arial, 0, 9, 5, 15, 12, 21, 3, 0
nobtnsPixelsClass4baseformnobtns�AutoSize = .T.
FontSize = 14
BackStyle = 0
Caption = "Label1"
Height = 25
Left = 27
Top = 12
Width = 60
Name = "Label1"
nobtns.Label1labellabel?Top = 264
Left = 3
Height = 2
Width = 584
Name = "Shape2"
nobtns.Shape2shapeshape>Top = 48
Left = 1
Height = 2
Width = 584
Name = "Shape1"
nobtns.Shape1shapeshape!DoCreate = .T.
Name = "nobtns"
formlabel�FontName = "MS Sans Serif"
FontSize = 8
Alignment = 0
Height = 24
Left = 90
TabIndex = 3
Top = 161
Width = 196
Name = "Text1"
gridaddform.Text1textboxtextbox)MS Sans Serif, 0, 8, 5, 13, 11, 11, 2, 0
txtbtnsPixelsClass11	container�PROCEDURE Click
cKeyValue = THIS.Parent.Text1.Value
nAddAction = THIS.Parent.OptionGroup1.Value
nBtnAction = THIS.Value
THISFORM.Release()
ENDPROC
{ButtonCount = 2
BackStyle = 0
BorderStyle = 0
Value =       1.00
ControlSource = "nBtnAction"
Height = 33
Left = 142
Top = 198
Width = 161
Name = "Commandgroup1"
Command1.Top = 5
Command1.Left = 5
Command1.Height = 23
Command1.Width = 72
Command1.FontName = "MS Sans Serif"
Command1.FontSize = 8
Command1.Caption = "\<Add"
Command1.TabIndex = 1
Command1.Name = "Command1"
Command2.Top = 5
Command2.Left = 84
Command2.Height = 23
Command2.Width = 72
Command2.FontName = "MS Sans Serif"
Command2.FontSize = 8
Command2.Cancel = .T.
Command2.Caption = "Cancel"
Command2.TabIndex = 2
Command2.Name = "Command2"
gridaddform.
Commandgroup1commandgroupcommandgrouptxtbtns�Top = 0
Left = 378
Height = 24
Width = 53
FontName = "MS Sans Serif"
FontSize = 8
Caption = "\<Edit"
Enabled = .T.
StatusBarText = "Edit existing record / Revert edits"
TabIndex = 8
ToolTipText = ""
Name = "cmdEdit"
txtbtns.cmdEdit
commandbutton
commandbuttontxtbtns.�PROCEDURE InteractiveChange
DO CASE
CASE THIS.Value = 2
	THISFORM.Text1.Value = THISFORM.cKeyValue
CASE TYPE('THISFORM.cKeyValue') = "C"
	THISFORM.Text1.Value = ""
CASE ATC(TYPE('THISFORM.cKeyValue'),"NYIBF") # 0
	THISFORM.Text1.Value = 0
CASE ATC(TYPE('THISFORM.cKeyValue'),"DT") # 0
	THISFORM.Text1.Value = {//}
CASE TYPE('THISFORM.cKeyValue') = "L"
	THISFORM.Text1.Value = .T.
ENDCASE

THISFORM.Text1.ReadOnly = (THIS.Value = 2)

ENDPROC
gridaddform.Optiongroup1optiongroupoptiongroupTTop = 120
Left = 10
Height = 73
Width = 288
SpecialEffect = 0
Name = "Shape1"
gridaddform.Shape1shapeshapeckeyvalue
1 = ""
THIS.TopFile = .F.
THIS.EndFile = .F.
THIS.AddClass
THIS.nWorkArea = SELECT()
THIS.oldSetDelete = SET�ButtonCount = 3
BackStyle = 0
BorderStyle = 1
Value = 2
ControlSource = "nAddAction"
Height = 72
Left = 10
SpecialEffect = 0
Top = 24
Width = 288
TabIndex = 1
Name = "Optiongroup1"
Option1.FontName = "MS Sans Serif"
Option1.FontSize = 8
Option1.BackStyle = 0
Option1.Caption = "Add record to \<parent only"
Option1.Value = 0
Option1.Height = 15
Option1.Left = 5
Option1.Top = 11
Option1.Width = 137
Option1.AutoSize = .T.
Option1.Name = "Option1"
Option2.FontName = "MS Sans Serif"
Option2.FontSize = 8
Option2.BackStyle = 0
Option2.Caption = "Add record to \<child (grid) only"
Option2.Value = 1
Option2.Height = 15
Option2.Left = 5
Option2.Top = 31
Option2.Width = 155
Option2.AutoSize = .T.
Option2.Name = "Option2"
Option3.FontName = "MS Sans Serif"
Option3.FontSize = 8
Option3.BackStyle = 0
Option3.Caption = "Add record to \<both"
Option3.Value = 0
Option3.Height = 15
Option3.Left = 5
Option3.Top = 51
Option3.Width = 106
Option3.AutoSize = .T.
Option3.Name = "Option3"
��� ��m�%�'��U4�����"��C�
��
��
������UNERRORCMETHODNLINETHISPARENTERROR�%�CC����B��9%�C�"Do you want to delete this record?�$�x������%�C�������
%�C+
��}�	H�����%�C+�C
	����
H����������C�������C������%��������t,������UTHISPARENT
UPDATEROWS
BUTTONREFRESH
NAVREFRESHTHISFORM
SHOWWINDOWNAMEError,��Click���1�!2�AA�AA��A1�AAAB�A2d�)��Top = 0
Left = 432
Height = 24
Width = 53
FontName = "MS Sans Serif"
FontSize = 8
Caption = "\<Delete"
Enabled = .T.
StatusBarText = "Delete existing record"
TabIndex = 9
ToolTipText = ""
Name = "cmdDelete"
	cmdDelete
commandbutton�ScaleMode = 3
Height = 235
Width = 309
ShowWindow = 1
DoCreate = .T.
AutoCenter = .T.
BorderStyle = 3
Caption = "Add Record"
MaxButton = .F.
MinButton = .F.
WindowType = 1
Name = "gridaddform"
formPROCEDURE Error
LPARAMETERS nError, cMethod, nLine
this.parent.error(m.nError, m.cMethod, m.nLine)
ENDPROC
PROCEDURE Click
#DEFINE MSGBOX_YES		6
#DEFINE C_MSGBOX1		36
#DEFINE C_DELETE_LOC	"Do you want to delete this record?"
#DEFINE C_NOLOCK_LOC	"Record could not be deleted because it is being used by someone else."

* Note: Cascading deletes should be handled via RI triggers in DBC!
IF EMPTY(ALIAS())
	RETURN
ENDIF

IF MESSAGEBOX(C_DELETE_LOC,C_MSGBOX1) = MSGBOX_YES
	DELETE
	IF THIS.Parent.UpdateRows()  &&success
		* Success
		IF !EOF()
			SKIP 1
		ENDIF
		IF EOF() AND !BOF()
			SKIP -1
		ENDIF
	ENDIF
	THIS.Parent.ButtonRefresh()
	THIS.Parent.NavRefresh()
ENDIF

IF THISFORM.ShowWindow = 2 
	Activate Window (THISFORM.Name)
ENDIF

ENDPROC

commandbutton�PROCEDURE Error
LPARAMETERS nError, cMethod, nLine
this.parent.error(m.nError, m.cMethod, m.nLine)
ENDPROC
PROCEDURE Click
IF THIS.Parent.EditMode
	THIS.Parent.UpdateRows()
ELSE
	IF !THIS.Parent.AddRec()
		RETURN
	ENDIF
ENDIF

THIS.Parent.EditMode = !THIS.Parent.EditMode
THIS.Parent.AddMode = THIS.Parent.EditMode
THIS.Parent.TopFile = .F.
THIS.Parent.ButtonRefresh()
THIS.Parent.NavRefresh()

ENDPROC
txtbtns.cmdAdd�PROCEDURE Init
LPARAMETERS cFldKey,cKeyValue,nBtnAction,nAddAction,lChildPrimaryKey,lUpdatableParentKey,lNoSendUpdates

IF PARAMETERS() # 7
	RETURN .F.
ENDIF

THIS.CommandGroup1.Value = 0
THIS.Label3.Caption = m.cFldKey
THIS.cKeyValue = m.cKeyValue

DO CASE
CASE m.lNoSendUpdates
	* Send Parent Updates
	THIS.Optiongroup1.Option1.Enabled = .F.
	THIS.Optiongroup1.Option3.Enabled = .F.
CASE !m.lUpdatableParentKey
	* Updatable parent key
	THIS.Optiongroup1.Option3.Enabled = .F.
ENDCASE

* Has a primary key
IF m.lChildPrimaryKey
	THIS.Optiongroup1.Option2.Enabled = .F.
ENDIF

DO CASE
CASE TYPE('THIS.cKeyValue') = "C"
	THIS.Text1.Value = ""
CASE ATC(TYPE('THIS.cKeyValue'),"NYIBF") # 0
	THIS.Text1.Value = 0
CASE ATC(TYPE('THIS.cKeyValue'),"DT") # 0
	THIS.Text1.Value = {//}
CASE TYPE('THIS.cKeyValue') = "L"
	THIS.Text1.Value = .T.
ENDCASE

ENDPROC
PROCEDURE QueryUnload
nBtnAction = 2
THISFORM.Release()
ENDPROC
�� ��vK%�e7��U4�����"��C�
��
��
������UNERRORCMETHODNLINETHISPARENTERROR����������%�CC���,�B��%��������%��������F����	��%�C�	Buffering�����
��Ca���%�C���
�
����F����
��%�C�	Buffering�����
��Ca�����q�
�����T�
��C���y�������(��
���m�*%�C�	BufferingC�
������i���CaC�
���������F����	��%�CN���
����#)����#��������E�F%�C�
SourceType��C�offline�
	�C�SendUpdates�
	���T��a���q%�C���
�
�C�
SourceType���
�	�C�offline���
�
	�C�SendUpdates���
�
	����T��a���2%��
���
�	�C���
���
�	���O��C�CYou cannot edit because the view(s) selected does not send updates.�x��B��T���	�C��T����CO���T�������
��T����-����C���
����C�����ULNOSENDPARENTUPDATESLNOSENDCHILDUPDATESATABLESUSEDNTABLESUSEDITHISPARENTEDITMODE
USEDATAENVOLDALIAS	GRIDALIASOLDRECADDMODE
BUTTONREFRESH
NAVREFRESHError,��Click���1�!2���AA32��Aa��AA��A��qAAAaQ��A�d�A�A#�AA"!A�2d��)��PROCEDURE Error
LPARAMETERS nError, cMethod, nLine
this.parent.error(m.nError, m.cMethod, m.nLine)
ENDPROC
PROCEDURE Click
#DEFINE C_NOUPDATE_LOC	"You cannot edit because the view(s) selected does not send updates."

LOCAL lNoSendParentUpdates,lNoSendChildUpdates
LOCAL aTablesUsed,nTablesUsed,i

IF EMPTY(ALIAS())
	RETURN
ENDIF

** Reverting record
IF THIS.Parent.EditMode
	
	IF THIS.Parent.UseDataEnv
		SELECT (THIS.Parent.OldAlias)
		IF CURSORGETPROP("Buffering")>1
			=TableRevert(.T.)
		ENDIF
		IF !EMPTY(THIS.Parent.GridAlias)
			SELECT (THIS.Parent.GridAlias)
			IF CURSORGETPROP("Buffering")>1
				=TableRevert(.T.)
			ENDIF
		ENDIF			
	ELSE
		DIMENSION aTablesUsed[1]
		m.nTablesUsed = AUSED(aTablesUsed)
		FOR i = 1 TO m.nTablesUsed
			IF CURSORGETPROP("Buffering",aTablesUsed[m.i,1])>1
				=TableRevert(.T.,aTablesUsed[m.i,1])
			ENDIF
		ENDFOR
	ENDIF
	
	* Go back to original place
	SELECT (THIS.Parent.OldAlias)
	IF RECCOUNT() < THIS.Parent.OldRec	&&added record at EOF()
		GO TOP
	ELSE
		GO THIS.Parent.OldRec
	ENDIF
ELSE

	* Check to see if view allows updates
	IF CURSORGETPROP("SourceType")#3 AND !CURSORGETPROP("offline") AND;
		!CURSORGETPROP("SendUpdates")
		lNoSendParentUpdates = .T.
	ENDIF
	IF !EMPTY(THIS.Parent.GridAlias) AND ;
	  CURSORGETPROP("SourceType",THIS.Parent.GridAlias)#3 AND ;
	  !CURSORGETPROP("offline",THIS.Parent.GridAlias) AND ;
	  !CURSORGETPROP("SendUpdates",THIS.Parent.GridAlias)
		lNoSendChildUpdates= .T.
	ENDIF
	
	IF (m.lNoSendChildUpdates AND m.lNoSendParentUpdates) OR;
		(EMPTY(THIS.Parent.GridAlias) AND m.lNoSendParentUpdates)
		=MESSAGEBOX(C_NOUPDATE_LOC)
		RETURN
	ENDIF
	
	THIS.Parent.OldAlias = ALIAS()	&&save alias in case reverting
	THIS.Parent.OldRec = RECNO()	&&save record in case reverting
ENDIF

** Editing record
THIS.Parent.EditMode = !THIS.Parent.EditMode
THIS.Parent.AddMode = .F.
THIS.Parent.ButtonRefresh()
THIS.Parent.NavRefresh()

ENDPROC
S�� ::�%����U4�����"��C�
��
��
������UNERRORCMETHODNLINETHISPARENTERROR�%������#���C������H�%�C���
��D�B���T�������
��T���������T����-����C�������C�����U	THISPARENTEDITMODE
UPDATEROWSADDRECADDMODETOPFILE
BUTTONREFRESH
NAVREFRESHError,��Click���1�!21�QAAA��2d��):�Top = 0
Left = 324
Height = 24
Width = 53
FontName = "MS Sans Serif"
FontSize = 8
Caption = "\<Add"
Enabled = .T.
StatusBarText = "Add new record / Save edits"
TabIndex = 7
ToolTipText = ""
Name = "cmdAdd"

commandbutton
commandbutton�� ����%Pe_�U

����UTHISFORMRELEASEClick,��1�2#)�.PROCEDURE Click
THISFORM.Release

ENDPROC
�Top = 0
Left = 486
Height = 24
Width = 53
FontName = "MS Sans Serif"
FontSize = 8
Caption = "E\<xit"
Enabled = .T.
StatusBarText = "Exit input form"
TabIndex = 10
ToolTipText = ""
Name = "cmdExit"
txtbtns.cmdExit
commandbutton
commandbutton�� ��J�%j!(�UU�����
H�����CC���7�
T������C�
sourcetype���j�T��CC&�FRX���2���T��CC�=�.FRX���
H������C�_reports.vcx0����T���_reports.vcx��'�CC�Q�FFC\�_reports.vcx0���%T��C�Q�FFC\�_reports.vcx��&�C�..\FFC\�_reports.vcx0��f�$T���..\FFC\�_reports.vcx��2�����C�����B�� T��C�
_outputdialog����-%�C����O�����C�0
	������C�����B��
�����>�T��CC�0����6��T�������T�	����
������C�����U	LCREPNAMELOOUTPUTDIALOGLCDCLASSTHISPARENTPRINTRPTLNORPTSOURCECREPORTLPREVENTSOURCECHANGESLPREVENTSCOPECHANGESLNORPTSCOPESHOWClick,��1�����Q��A���qQaA�AA�AA��AAA2�)��PROCEDURE Click
#DEFINE DIALOG_CLASS "_outputdialog"
#DEFINE DIALOG_CLASSLIB "_reports.vcx"

LOCAL lcRepName,loOutputDialog,lcDClass

DO CASE
CASE EMPTY(ALIAS())
	lcRepName = ""
CASE CURSORGETPROP("sourcetype")=3	&& tables
	lcRepName = FORCEEXT(DBF(),"FRX")
OTHERWISE
	lcRepName = LEFT(ALIAS(),8)+".FRX"
ENDCASE

DO CASE
CASE FILE(DIALOG_CLASSLIB)
	lcDClass = DIALOG_CLASSLIB
CASE FILE(HOME()+"FFC\"+DIALOG_CLASSLIB)
	lcDClass = HOME()+"FFC\"+DIALOG_CLASSLIB
CASE FILE("..\FFC\"+DIALOG_CLASSLIB)
	lcDClass = "..\FFC\"+DIALOG_CLASSLIB
OTHERWISE
	THIS.Parent.PrintRpt()
	RETURN
ENDCASE

loOutputDialog = NewObject(DIALOG_CLASS,lcDClass)
IF VARTYPE(loOutputDialog) # "O" OR;
	(THIS.Parent.lNoRptSource AND !FILE(lcRepName))
	THIS.Parent.PrintRpt()
	RETURN
ENDIF

WITH loOutputDialog
	.cReport= IIF(FILE(lcRepName),lcRepName,"")
	.lPreventSourceChanges=THIS.Parent.lNoRptSource
	.lPreventScopeChanges=THIS.Parent.lNoRptScope
ENDWITH
loOutputDialog.Show(1)

ENDPROC
txtbtns.JArial, 0, 9, 5, 15, 12, 21, 3, 0
MS Sans Serif, 0, 8, 5, 13, 11, 11, 2, 0
	addrecordPixelsClass8form	addrecord�AutoSize = .T.
FontName = "MS Sans Serif"
FontSize = 8
BackStyle = 0
Caption = "Key field:"
Height = 15
Left = 24
Top = 72
Width = 45
TabIndex = 6
Name = "Label4"
	addrecord.Label4labellabel	addrecord.Label3)MS Sans Serif, 0, 8, 5, 13, 11, 11, 2, 0
gridbtns�Top = 0
Left = 274
Height = 24
Width = 49
FontName = "MS Sans Serif"
FontSize = 8
Caption = "P\<rint"
Enabled = .T.
StatusBarText = "Print to report"
TabIndex = 6
ToolTipText = ""
Name = "cmdPrint"
cmdPrint
commandbutton
commandbutton�� ����%i+�Ua�������%�CC���$�B��%��������%��C�
��d�
T�C��a��T��a���%��9������T�9�����T��a����T��C�
searchform�N��
��C����%��
�����
T�C��-���%��
����T�9������%������(�t,������T�	�
��-��T�	�
��-����C�	�
�
��UOSEARCHDLOG
LVISCHANGELSTATECHANGETHISFORM
SHOWWINDOWVISIBLEWINDOWSTATESHOWNAMETHISPARENTTOPFILEENDFILE
NAVREFRESHClick,��1q��AAC��A1��AA����A��AB�A1�)�Pixelsstylebmp\textbttn.bmpstylebmp\textbttn.bmptxtbtns.cmdFind�FontItalic = .T.
FontName = "MS Sans Serif"
FontSize = 8
BackStyle = 0
Caption = "Label3"
Height = 16
Left = 96
Top = 72
Width = 192
TabIndex = 5
Name = "Label3"
labellabel�FontName = "MS Sans Serif"
FontSize = 8
WordWrap = .T.
BackStyle = 0
Caption = "To add a new record, you must provide a unique value for the key field below."
Height = 36
Left = 12
Top = 12
Width = 324
TabIndex = 4
Name = "Label2"
	addrecord.Label2labellabel�AutoSize = .T.
FontName = "MS Sans Serif"
FontSize = 8
BackStyle = 0
Caption = "\<Key value:"
Height = 15
Left = 24
Top = 100
Width = 52
TabIndex = 3
Name = "Label1"
	addrecord.Label1labellabel�FontName = "MS Sans Serif"
FontSize = 8
Alignment = 0
Height = 24
Left = 96
TabIndex = 1
Top = 96
Width = 204
Name = "Text1"
	addrecord.Text1textboxtextbox�PROCEDURE Click
LOCAL oSearchDlog
LOCAL lVisChange,lStateChange

IF EMPTY(ALIAS())
	RETURN
ENDIF

* Check if SDI Window
IF THISFORM.ShowWindow = 2 
	IF !_VFP.Visible
		_VFP.Visible = .T.
		lVisChange = .T.
	ENDIF
	IF _SCREEN.WindowState = 1
		_SCREEN.WindowState = 0
		lStateChange = .T.
	ENDIF
ENDIF

oSearchDlog = CREATE("searchform")
oSearchDlog.SHOW()

IF m.lVisChange
	_VFP.Visible = .F.
ENDIF
IF m.lStateChange 
	_SCREEN.WindowState = 1
ENDIF

IF THISFORM.ShowWindow = 2 
	Activate Window (THISFORM.Name)
ENDIF

* Reset from prior
THIS.Parent.TopFile = .F.
THIS.Parent.EndFile = .F.
THIS.Parent.NavRefresh()
ENDPROC
�Top = 0
Left = 224
Height = 24
Width = 49
FontName = "MS Sans Serif"
FontSize = 8
Caption = "\<Find"
Enabled = .T.
StatusBarText = "Search for records"
TabIndex = 5
ToolTipText = ""
Name = "cmdFind"

commandbutton
commandbutton�� ���%avp�U��C�END�����UTHISPARENTNAVIGATEClick,��1a2.)�9PROCEDURE Click
THIS.Parent.Navigate("END")

ENDPROC
txtbtns.cmdEnd
commandbutton0PROCEDURE Click
THISFORM.Release()

ENDPROC
�ButtonCount = 2
BackStyle = 0
BorderStyle = 0
Value =       1.00
ControlSource = "nBtnAction"
Height = 33
Left = 168
Top = 134
Width = 161
TabIndex = 2
Name = "Commandgroup1"
Command1.Top = 5
Command1.Left = 5
Command1.Height = 23
Command1.Width = 72
Command1.FontName = "MS Sans Serif"
Command1.FontSize = 8
Command1.Caption = "\<Add"
Command1.TabIndex = 1
Command1.Name = "Command1"
Command2.Top = 5
Command2.Left = 84
Command2.Height = 23
Command2.Width = 72
Command2.FontName = "MS Sans Serif"
Command2.FontSize = 8
Command2.Cancel = .T.
Command2.Caption = "Cancel"
Command2.TabIndex = 2
Command2.Name = "Command2"
	addrecord.
Commandgroup1commandgroupcommandgroupSTop = 60
Left = 16
Height = 68
Width = 308
SpecialEffect = 0
Name = "Shape1"
	addrecord.Shape1shapeshape0oretvalue
ckeyvalue
ckeyfield
*setkeyfield 
SPROCEDURE QueryUnload
THIS.CommandGroup1.Value=2
THIS.Release()
ENDPROC
PROCEDURE Show
LPARAMETERS nStyle

THIS.Label3.Caption = THIS.cKeyField

DO CASE
CASE TYPE('THIS.cKeyValue') = "C"
	THIS.Text1.Value = ""
CASE ATC(TYPE('THIS.cKeyValue'),"NYIBF") # 0
	THIS.Text1.Value = 0
CASE ATC(TYPE('THIS.cKeyValue'),"DT") # 0
	THIS.Text1.Value = {//}
CASE TYPE('THIS.cKeyValue') = "L"
	THIS.Text1.Value = .T.
ENDCASE

ENDPROC
PROCEDURE Release
THIS.oRetValue.AddProperty("cKeyValue",THIS.Text1.Value)
THIS.oRetValue.AddProperty("nBtnAction",THIS.CommandGroup1.Value)

ENDPROC
form
searchformClass6	container)MS Sans Serif, 0, 8, 5, 13, 11, 11, 2, 0
sh = 0
oldrec picbtns
TabIndex = 1
nworkarea = 0
editmode = 0
prevPixels= 542
Height = 25
BackStyle = 0
BorderWidth = 0stylebmp\picbttns.bmpWITH EVAL("."+aMems[m.i])
					IF stylebmp\picbttns.bmp1�a�S {Cg..�&YQFh.IR�Class9�%I;/]E:IS�100___UUUMMMBBB999
���������```txtbtns(fvEE>j(�9jJ2�picbtns���������i����ݜ����*o�?��H�6��Awizbmppath
�����������������������Y�� @@7�%����ULT��������T��������T������
��C��	��U
	CKEYVALUETHISPARENTTEXT1VALUE
NADDACTIONOPTIONGROUP1
NBTNACTIONTHISFORMRELEASEClick,��1aa�1�)@�� ���%Shb�U
��C����UTHISFORMRELEASEClick,��1�2%)�
commandbutton@PROCEDURE Init

TxtBtns::Init()
THISFORM.ShowTips = .T.

ENDPROC
PROCEDURE setcaption
IF !THIS.EditMode
	THIS.cmdAdd.Picture = THIS.wizbmppath+"wznew.bmp"
	THIS.cmdEdit.Picture = THIS.wizbmppath+"wzedit.bmp"
	THIS.cmdAdd.DownPicture = THIS.wizbmppath+"wznew.bmp"
	THIS.cmdEdit.DownPicture = THIS.wizbmppath+"wzedit.bmp"
ELSE
	THIS.cmdAdd.Picture = THIS.wizbmppath+"wzsave.bmp"
	THIS.cmdEdit.Picture = THIS.wizbmppath+"wzundo.bmp"
	THIS.cmdAdd.DownPicture = THIS.wizbmppath+"wzsave.bmp"
	THIS.cmdEdit.DownPicture = THIS.wizbmppath+"wzundo.bmp"
ENDIF
ENDPROC
�����	�	containerhape1"
Label1.Height = 16
Label1.Left = 0
Lawizbtns.vcxx= 51
Shape1.Height = 20
Shape1.Width = 97
JArial, 0, 9, 5, 15, 12, 21, 3, 0
MS Sans Serif, 0, 8, 5, 13, 11, 11, 2, 0
!Arial, 0, 9, 5, 15, 12, 13, 3, 0
ocess = SET("REPROCESS"
scrollgrid.nWorkArea = SELECT()
THIS.oldSetDelete = SETPixelsx
THIS.TopFile = .F.
THIS.EndFile = .F.
THIS.AddClassardfieldIS.ParentKey = ""
THIS.ViewType = 3
THIS.3andardfield"
 This routine sets the member variables
grid
SpecialEffect = 1
Width = 100
ColorSource = 0
N
scrollgrid "MS Sans Serif"
FontSize = 8
Alignment = 3
scrollgrid.Column1.					"To remedy this, ensure the View)MS Sans Serif, 0, 8, 5, 13, 11, 11, 2, 0
verttxtbtnsPixelsstylebmp\textbttn.bmpstylebmp\textbttn.bmpClass1txtbtnsverttxtbtns�Width = 55
Height = 276
Name = "verttxtbtns"
cmdPrev.Top = 24
cmdPrev.Left = 0
cmdPrev.Name = "cmdPrev"
cmdNext.Top = 48
cmdNext.Left = 0
cmdNext.Name = "cmdNext"
cmdTop.Top = 0
cmdTop.Left = 0
cmdTop.Name = "cmdTop"
cmdEnd.Top = 72
cmdEnd.Left = 0
cmdEnd.Name = "cmdEnd"
cmdFind.Top = 108
cmdFind.Left = 0
cmdFind.Width = 55
cmdFind.Name = "cmdFind"
cmdPrint.Top = 132
cmdPrint.Left = 0
cmdPrint.Width = 55
cmdPrint.Name = "cmdPrint"
cmdExit.Top = 252
cmdExit.Left = 0
cmdExit.Height = 24
cmdExit.Width = 55
cmdExit.Name = "cmdExit"
cmdAdd.Top = 168
cmdAdd.Left = 0
cmdAdd.Name = "cmdAdd"
cmdDelete.Top = 216
cmdDelete.Left = 0
cmdDelete.Name = "cmdDelete"
cmdEdit.Top = 192
cmdEdit.Left = 0
cmdEdit.Name = "cmdEdit"
	containerwizbtns.vcxx�Top = 0
Left = 168
Height = 24
Width = 55
FontName = "MS Sans Serif"
FontSize = 8
Caption = "\<Bottom"
StatusBarText = "Go to bottom of table"
TabIndex = 4
ToolTipText = ""
Name = "cmdEnd"
�� ���%avp�U��C�TOP�����UTHISPARENTNAVIGATEClick,��1a2.)�9PROCEDURE Click
THIS.Parent.Navigate("TOP")

ENDPROC
�Top = 0
Left = 0
Height = 24
Width = 55
FontName = "MS Sans Serif"
FontSize = 8
Caption = "\<Top"
StatusBarText = "Go to top of table"
TabIndex = 1
ToolTipText = ""
Name = "cmdTop"
txtbtns.cmdTop
commandbutton
commandbutton�� ���%bwq�U��C�NEXT�����UTHISPARENTNAVIGATEClick,��1q2/)�:PROCEDURE Click
THIS.Parent.Navigate("NEXT")

ENDPROC
�Top = 0
Left = 112
Height = 24
Width = 55
FontName = "MS Sans Serif"
FontSize = 8
Caption = "\<Next"
StatusBarText = "Skip to next record"
TabIndex = 3
ToolTipText = ""
Name = "cmdNext"
txtbtns.cmdNext
commandbutton
commandbutton�� ���%bwq�U��C�PREV�����UTHISPARENTNAVIGATEClick,��1q1-)�8PROCEDURE Click
THIS.Parent.Navigate("PREV")
ENDPROC
�Top = 0
Left = 56
Height = 24
Width = 55
FontName = "MS Sans Serif"
FontSize = 8
Caption = "\<Prev"
StatusBarText = "Skip to previous record"
TabIndex = 2
ToolTipText = ""
Name = "cmdPrev"
txtbtns.cmdPrev
commandbuttonPixels
commandbuttonkWidth = 542
Height = 25
BackStyle = 0
BorderWidth = 0
Visible = .T.
TabIndex = 1
nworkarea = 0
editmode = 0
previewmode = .F.
topfile = 0
endfile = 0
oldbuffering = 1
oldrefresh = 0
oldrec = 0
oldreprocess = 0
previewinit = .T.
usedataenv = .T.
viewkey = ("")
lautobuffer = .T.
lstarttop = .T.
parentalias = 
childalias = 
Name = "txtbtns"
	containergridbtns�PROCEDURE Error
LPARAMETERS nError, cMethod, nLine
this.parent.error(m.nError, m.cMethod, m.nLine)
ENDPROC
PROCEDURE Click
THIS.Parent.DeleteRec()

ENDPROC
N�� 55��%����UP
H�
�.�������7�T��������&�C�THISFORM.cKeyValueb�C��p�T�������/�CC�THISFORM.cKeyValueb�NYIBF������T�������,�CC�THISFORM.cKeyValueb�DT������T�������&�C�THISFORM.cKeyValueb�L��.�T����a���T���������UTHISVALUETHISFORMTEXT1	CKEYVALUEREADONLYInteractiveChange,��1�Aaa1�1��aA�2�)5�Top = 2
Left = 178
Height = 24
Width = 53
FontName = "MS Sans Serif"
FontSize = 8
Caption = "\<Delete"
Enabled = .T.
StatusBarText = "Delete existing record"
TabIndex = 9
ToolTipText = ""
Name = "cmdDelete"
gridbtns.�Height = 174
Width = 341
ShowWindow = 1
DoCreate = .T.
AutoCenter = .T.
BorderStyle = 2
Caption = "Add Record"
MaxButton = .F.
MinButton = .F.
WindowType = 1
ckeyvalue = 
Name = "addrecord"
stylebmp\searchfm.bmpstylebmp\searchfm.bmp]�� DDk�%����U4�����"��C�
��
��
������UNERRORCMETHODNLINETHISPARENTERROR��C�����UTHISPARENT	DELETERECError,��Click���1�!22d��)D	cmdDelete
commandbutton
commandbuttonZ�� AA��%����U4�����"��C�
��
��
������UNERRORCMETHODNLINETHISPARENTERROR��C�����UTHISPARENTADDRECError,��Click���1�!21d��)A�PROCEDURE Error
LPARAMETERS nError, cMethod, nLine
this.parent.error(m.nError, m.cMethod, m.nLine)
ENDPROC
PROCEDURE Click
THIS.Parent.AddRec()
ENDPROC
gridbtns.Class3form
searchform�� ��±%"k1�U�
H�
���������O�����G(�T�
��C�POINTv��G;(��.��T�
��C�����SET POINT TO &cSavePoint
%�C�
��
��?�SET FILTER TO &cGetExpr
-�%�C+��*�R��C�FNo records were found which meet your query. Please try another query.�x��T����a��B��T����-���K�-��������~�G(�-�T����-��2����<��U	THISVALUECGETEXPR
CSAVEPOINTTHISFORMSEARCHCLASS1
SEARCHEXPRPARENT
CHANGEDFILTERClick,��1�A�aa�a�!�A�!AA�AAAaA�Br1�)�
searchform.
Commandgroup1commandgroupcommandgroup
searchform.Searchclass1	containerwizbtns.vcxsearchclass'saverecord
savefilter
changedfilter
cmdAdd
commandbuttonwizrowstretch
s,cDataEnvRef
DIMENSION aTablesUsed[1]

commandbuttongridUPDATEVIEW_LOC	"Edits to one or more of the Views ma�Height = 208
Width = 448
ShowWindow = 1
DoCreate = .T.
AutoCenter = .T.
BorderStyle = 2
Caption = "Search"
MaxButton = .F.
MinButton = .F.
WindowType = 1
AlwaysOnTop = .T.
Name = "searchform"

gridaddrec�Top = 2
Left = 116
Height = 24
Width = 53
FontName = "MS Sans Serif"
FontSize = 8
Caption = "\<Add"
Enabled = .T.
StatusBarText = "Add new record"
TabIndex = 7
ToolTipText = ""
Name = "cmdAdd"
T�� ;;��%����U4�����"��C�
��
��
������UNERRORCMETHODNLINETHISPARENTERROR
��C����UTHISFORMRELEASEError,��Click���1�!2�2d��);�PROCEDURE Error
LPARAMETERS nError, cMethod, nLine
this.parent.error(m.nError, m.cMethod, m.nLine)
ENDPROC
PROCEDURE Click
THISFORM.Release()

ENDPROC
�Top = 2
Left = 240
Height = 24
Width = 53
FontName = "MS Sans Serif"
FontSize = 8
Caption = "E\<xit"
Enabled = .T.
StatusBarText = "Exit input form"
TabIndex = 10
ToolTipText = ""
Name = "cmdExit"
.Height = 22
Width = 39
Name = "gridaddrec"
gridbtns.cmdExit
commandbutton
commandbutton��� ����%�*+��U4�����"��C�
��
��
������UNERRORCMETHODNLINETHISPARENTERROR�������
H� ����CC���;�
T������C�
sourcetype���n�T��CC&�FRX���2���T��CC�=�.FRX���
H���v��C�_reports.vcx0����T���_reports.vcx��'�CC�Q�FFC\�_reports.vcx0�� �%T��C�Q�FFC\�_reports.vcx��&�C�..\FFC\�_reports.vcx0��j�$T���..\FFC\�_reports.vcx��2�v�B��%�CC�
����T��CO��� T��C�
_outputdialog����%�C����O����B��%�����C�0
	���T����-���
�����[�T��CC�0����6��T�������T�	����
������C�����%�CC�
����	#�����U	LCREPNAMELOOUTPUTDIALOGLCDCLASSLNRECNOTHISPARENTLNORPTSOURCECREPORTLPREVENTSOURCECHANGESLPREVENTSCOPECHANGESLNORPTSCOPESHOWError,��Click���1�!24����Q��A���qQaA�AA��AQAA�A��AAA��A1d��)�gridbtns.cmdPrint
commandbuttonaaddoption
keyvalue
keyfield
childprimarykey
updatableparentkey
nosendupdates
*runaddform 

commandbutton
scrollgrid
THIS.ParentKey = ""
THIS.ViewType = 3
THIS.�Top = 2
Left = 58
Height = 24
Width = 49
FontName = "MS Sans Serif"
FontSize = 8
Caption = "P\<rint"
Enabled = .T.
StatusBarText = "Print to report"
TabIndex = 6
ToolTipText = ""
Name = "cmdPrint"
�� ��A�%9�W�U4�����"��C�
��
��
������UNERRORCMETHODNLINETHISPARENTERROR<�����%�CC���$�B�-���%��������%��C�
��d�
T�C��a��T��a���%��9������T�9�����T��a����T��C�
searchform�N��
��C����
��C����%��
�����
T�C��-���%��
����T�9������%������5�t,���	���U

LVISCHANGELSTATECHANGEOSEARCHDLOGTHISFORM
SHOWWINDOWVISIBLEWINDOWSTATESHOWREFRESHNAMEError,��Click���1�!2��qAC��A1��AA�����A��AA�A2d��)�gridbtns.1�� -k%x���U����%�������%�C�����/�G(��g�T�
������SET FILTER TO &cFilterExpr
�%�CN�����#�������UCFILTEREXPRTHIS
CHANGEDFILTER
SAVEFILTER
SAVERECORDK%�CC�
��D�T���CO��T���C�FILTERv��T���-���UTHIS
SAVERECORD
SAVEFILTER
CHANGEDFILTERDestroy,��Init���1q!a�!�A�AA3����A1��)form�PROCEDURE Error
LPARAMETERS nError, cMethod, nLine
this.parent.error(m.nError, m.cMethod, m.nLine)
ENDPROC
PROCEDURE Click
#DEFINE DIALOG_CLASS "_outputdialog"
#DEFINE DIALOG_CLASSLIB "_reports.vcx"

LOCAL lcRepName,loOutputDialog,lcDClass,lnRecno

DO CASE
CASE EMPTY(ALIAS())
	lcRepName = ""
CASE CURSORGETPROP("sourcetype")=3	&& tables
	lcRepName = FORCEEXT(DBF(),"FRX")
OTHERWISE
	lcRepName = LEFT(ALIAS(),8)+".FRX"
ENDCASE

DO CASE
CASE FILE(DIALOG_CLASSLIB)
	lcDClass = DIALOG_CLASSLIB
CASE FILE(HOME()+"FFC\"+DIALOG_CLASSLIB)
	lcDClass = HOME()+"FFC\"+DIALOG_CLASSLIB
CASE FILE("..\FFC\"+DIALOG_CLASSLIB)
	lcDClass = "..\FFC\"+DIALOG_CLASSLIB
OTHERWISE
	RETURN
ENDCASE

IF !EMPTY(ALIAS())
	lnRecno=RECNO()
ENDIF

loOutputDialog = NewObject(DIALOG_CLASS,lcDClass)
IF VARTYPE(loOutputDialog) # "O"
	RETURN
ENDIF

IF THIS.Parent.lNoRptSource AND !FILE(lcRepName)
	THIS.Parent.lNoRptSource=.F.
ENDIF
	
WITH loOutputDialog
	.cReport= IIF(FILE(lcRepName),lcRepName,"")
	.lPreventSourceChanges=THIS.Parent.lNoRptSource
	.lPreventScopeChanges=THIS.Parent.lNoRptScope
ENDWITH
loOutputDialog.Show(1)

IF !EMPTY(ALIAS())
	GO lnRecno
ENDIF
ENDPROC
�Top = 2
Left = 0
Height = 24
Width = 49
FontName = "MS Sans Serif"
FontSize = 8
Caption = "\<Find"
Enabled = .T.
StatusBarText = "Search for records"
TabIndex = 5
ToolTipText = ""
Name = "cmdFind"
cmdFind
commandbutton
commandbutton�wizrowstretch = .T.
Name = "scrollgrid2"
Column1.Header1.Name = "Header1"
Column1.Container1.Name = "Container1"
Column1.Name = "Column1"
OCAL aTablesUsed,nTablesUsed,i,aMems,nTot�PROCEDURE Destroy
LOCAL cFilterExpr
IF THIS.ChangedFilter
	IF EMPTY(THIS.SaveFilter)
		SET FILTER TO
	ELSE
		m.cFilterExpr = THIS.SaveFilter
		SET FILTER TO &cFilterExpr
	ENDIF
	IF RECCOUNT() # 0
		GO THIS.SaveRecord
	ENDIF
ENDIF

ENDPROC
PROCEDURE Init
IF !EMPTY(ALIAS())
	THIS.SaveRecord = RECNO()
	THIS.SaveFilter = SET("FILTER")
	THIS.ChangedFilter = .F.
ENDIF
ENDPROC
�PROCEDURE Error
LPARAMETERS nError, cMethod, nLine
this.parent.error(m.nError, m.cMethod, m.nLine)
ENDPROC
PROCEDURE Click
LOCAL lVisChange,lStateChange,oSearchDlog

IF EMPTY(ALIAS())
	RETURN .F.
ENDIF

* Check if SDI Window
IF THISFORM.ShowWindow = 2 
	IF !_VFP.Visible
		_VFP.Visible = .T.
		lVisChange = .T.
	ENDIF
	IF _SCREEN.WindowState = 1
		_SCREEN.WindowState = 0
		lStateChange = .T.
	ENDIF
ENDIF

oSearchDlog = CREATE("searchform")
oSearchDlog.SHOW()
THISFORM.REFRESH()

IF m.lVisChange
	_VFP.Visible = .F.
ENDIF
IF m.lStateChange 
	_SCREEN.WindowState = 1
ENDIF
IF THISFORM.ShowWindow = 2 
	Activate Window (THISFORM.Name)
ENDIF

ENDPROC
	container)MS Sans Serif, 0, 8, 5, 13, 11, 11, 2, 0
searchclassscrollgrid2

* This routine sets the member variables
Width = 296
Height = 26
BackStyle = 0
BorderWidth = 0
Visible = .T.
TabIndex = 1
nworkarea = 0
previewmode = .F.
oldbuffering = 1
oldrefresh = 0
oldrec = 0
oldreprocess = 0
previewinit = .T.
usedataenv = .T.
lautobuffer = .T.
lpromptkey = .T.
Name = "gridbtns"
Pixelsstylebmp\searchcl.bmp!Arial, 0, 9, 5, 15, 12, 13, 3, 0
ew button of the Form W	PROCEDURE Click
#DEFINE NORECSFOUND_LOC		"No records were found which meet your query. Please try another query."

DO CASE
CASE THIS.VALUE = 1		&&SET FILTER condition
	LOCAL cGetExpr,cSavePoint
	SET FILTER TO
	m.cSavePoint = SET("POINT")
	SET POINT TO "."
	m.cGetExpr = THISFORM.SearchClass1.SearchExpr()	
	SET POINT TO &cSavePoint
	IF !EMPTY(m.cGetExpr)
		SET FILTER TO &cGetExpr
		LOCATE
		* Check if no records found
		IF EOF()
			=MESSAGEBOX(NORECSFOUND_LOC)
			THIS.Parent.ChangedFilter = .T.
			RETURN
		ENDIF
		THIS.Parent.ChangedFilter = .F.		&&good query
	ELSE
		LOCATE
	ENDIF
CASE THIS.VALUE = 2  &&SET FILTER TO all
	SET FILTER TO
	LOCATE
	THIS.Parent.ChangedFilter = .F.			&&good query
OTHERWISE

ENDCASE

RELEASE THISFORM
ENDPROC
stylebmp\searchcl.bmpClass15	containersearchclass�Top = 69
Left = 290
Height = 15
Width = 88
FontName = "MS Sans Serif"
FontSize = 8
AutoSize = .T.
BackStyle = 0
Caption = "Case Sensiti\<ve"
TabIndex = 8
Name = "chkCaseSensitive"
searchclass.chkCaseSensitivecheckboxcheckbox�FontName = "MS Sans Serif"
FontSize = 8
BackStyle = 0
Caption = "Value:"
Height = 16
Left = 262
Top = 99
Width = 165
Name = "label6"
searchclass.label6labelwizbtns.vcxxion()
ENDPROC
PROCEDURE initvars
						
label�FontName = "MS Sans Serif"
FontSize = 8
BackStyle = 0
Caption = "Operator:"
Height = 16
Left = 161
Top = 99
Width = 93
Name = "label5"
searchclass.label5labellabelsearchclass.label4
Container19, 5, 15, 12, 13, 3, 0
or more of the Views ma�FontName = "MS Sans Serif"
FontSize = 8
BackStyle = 0
Caption = "Field:"
Height = 16
Left = 12
Top = 99
Width = 102
Name = "label4"
gridtyle.vcx
	SET FIELDS ON
ENDIF

SET REFRESH TO THIlabellabelcustom�FontName = "MS Sans Serif"
FontSize = 8
BackStyle = 0
Caption = "Value:"
Height = 16
Left = 262
Top = 7
Width = 165
Name = "label3"
TTop = 23
Left = 15
Width = 200
Height = 200
BackStyle = 1
Name = "Container1"
92
Name = "Container1"
will not be	containercption()
ENDPROC
PROCEDURE initvars
						
	containercmdDelete.Enabled =  !THIS.EditMode AND !ISREAD'Caption = "Header1"
Name = "Header1"
t.Enabled =  !THIscrollgrid.Column1.dFind.Enabled = !THIS.EditMode
THIS.Header1seS.nWorkArea
	SELECT (THIS.nWorkArea)
ENDIF

searchclass.label3labellabelsearchclass.label2headerogicuttons
* for appropriate table environments.
headerck1"

Top = 9
Width = 43
Name = "Label1"
 whi
wizbtnstyle
 = 56
Height = 18
Width = 17
Caption = "1ClassPixels
gridaddrecscrollgrid2 0

* These properties should not be used. �FontName = "MS Sans Serif"
FontSize = 8
BackStyle = 0
Caption = "Operator:"
Height = 16
Left = 158
Top = 7
Width = 93
Name = "label2"
labellabel�FontName = "MS Sans Serif"
FontSize = 8
BackStyle = 0
Caption = "Field:"
Height = 16
Left = 12
Top = 7
Width = 102
Name = "label1"
searchclass.label1PixelsET DELETED ON
THIS.oldReprocess = SET("REPROCESS"labellabelcustomwizbase.vcx(PROCEDURE Init
THIS.VALUE =1
ENDPROC
)MS Sans Serif, 0, 8, 5, 13, 11, 11, 2, 0
picformbtnsPixelsClass1gridbtnspicformbtns	containerwizbtns.vcxsearchclass.optgrpAndOroptiongroup�ColumnCount = 1
AllowHeaderSizing = .F.
AllowRowSizing = .F.
DeleteMark = .F.
HeaderHeight = 0
Height = 178
Highlight = .F.
HighlightRow = .F.
RecordMark = .F.
RowHeight = 300
ScrollBars = 2
SplitBar = .F.
Width = 369
BackColor = 192,192,192
wizbtnstyle = gridbtns
Name = "scrollgrid"
Column1.Width = 500
Column1.Sparse = .F.
Column1.BackColor = 192,192,192
Column1.Name = "Column1"
iewinit = .T.
usedataenv = .T.
view�nworkarea Saves old workarea (set internally).
previewmode Whether the form is in preview mode for use with Preview button on Wizard (set internally).
oldsetfields Saves SET FIELDS (set internally).
oldsetdelete Saves SET DELETED (set internally).
oldmultilocks Saves SET MULTILOCKS (set internally).
oldbuffering Saves table buffering state (set internally).
oldrefresh Saves SET REFRESH (set internally).
oldrec Saves record number (set internally).
oldreprocess Saves SET REPROCESS (set internally).
oldalias Saves alias when editing to restore with 1-Many forms (set internally).
previewinit For use with Preview button on wizard (set internally).
usedataenv Whether the form has a data environment object attached (set internally).
hasgeneral Whether the form has general field oleboundcontrol object (set internally).
oldtalk Saves SET TALK (set internally).
hasmemo Whether the form has memo field editbox object (set internally).
haderror Whether an error occurred.
lnorptsource Whether to hide source for reporting dialog.
lnorptscope Whether to hide scope for reporting dialog.
lautobuffer Whether to always buffer data.
lpromptkey Whether to prompt for primary key when adding new record.
lstarttop Whether to always start at first record.
*initvars Saves and sets certain environment variables.
*updaterows Handles add, edit and delete operations of records to tables.
*addrec Adds a new record.
*deleterec Deletes current record.
*checkerror 
�� ��f�%Pd^�UT������UTHISVALUEInit,��11)�WAutoSize = .T.
ButtonCount = 2
BackStyle = 0
Value = 1
Height = 46
Left = 50
Top = 55
Width = 58
TabIndex = 7
Name = "optgrpAndOr"
Option1.FontName = "MS Sans Serif"
Option1.FontSize = 8
Option1.BackStyle = 0
Option1.Caption = "\<And"
Option1.Value = 1
Option1.Height = 18
Option1.Left = 5
Option1.Top = 5
Option1.Width = 48
Option1.Name = "Option1"
Option2.FontName = "MS Sans Serif"
Option2.FontSize = 8
Option2.BackStyle = 0
Option2.Caption = "\<Or"
Option2.Value = 0
Option2.Height = 18
Option2.Left = 5
Option2.Top = 23
Option2.Width = 39
Option2.Name = "Option2"
optiongroup|FontName = "MS Sans Serif"
FontSize = 8
Height = 23
Left = 260
TabIndex = 6
Top = 118
Width = 176
Name = "txtExpr2"
searchclass.txtExpr2textboxtextbox�� ��=K%W�	��U|b��C�Requals\;not equals\;more than\;less than\;is blank\;is NULL\;contains\;in\;between����T���C�����UTHISADDITEMVALUELISTW%�C�������.�T���������"T�����C�����
��UTHIS
LISTITEMIDPARENTTXTEXPR2VALUEENABLEDInit,��InteractiveChange���1"q3�aA!2��f)�qPROCEDURE Init
#DEFINE C_OPERATORS_LOC	"equals\;not equals\;more than\;less than\;is blank\;is NULL\;contains\;in\;between"
THIS.ADDITEM(C_OPERATORS_LOC)
THIS.VALUE = THIS.LIST[1]

ENDPROC
PROCEDURE InteractiveChange
IF INLIST(THIS.ListItemId,5,6)
	THIS.Parent.TxtExpr2.Value = ""
ENDIF
THIS.Parent.TxtExpr2.ENABLED = !INLIST(THIS.ListItemId,5,6)

ENDPROC
�FontName = "MS Sans Serif"
FontSize = 8
Height = 23
Left = 160
Style = 2
TabIndex = 5
Top = 117
Width = 96
Name = "cboOperators2"
searchclass.
cboOperators2comboboxcombobox�� �]%����UCT������T����	aWizFList��T���C�����UTHIS
ROWSOURCETYPE	ROWSOURCEVALUELISTInit,��1�q2a)lPROCEDURE Init
THIS.RowSourceType = 5
THIS.RowSource = "aWizFList"
THIS.VALUE = THIS.LIST[1]

ENDPROC
�FontName = "MS Sans Serif"
FontSize = 8
Height = 23
Left = 11
Style = 2
TabIndex = 4
Top = 117
Width = 141
Name = "cboFields2"
searchclass.
cboFields2comboboxcombobox{FontName = "MS Sans Serif"
FontSize = 8
Height = 23
Left = 260
TabIndex = 3
Top = 25
Width = 176
Name = "txtExpr1"
searchclass.txtExpr1textboxtextbox�� ��=K%W�	��U|b��C�Requals\;not equals\;more than\;less than\;is blank\;is NULL\;contains\;in\;between����T���C�����UTHISADDITEMVALUELISTW%�C�������.�T���������"T�����C�����
��UTHIS
LISTITEMIDPARENTTXTEXPR1VALUEENABLEDInit,��InteractiveChange���1"q3�aA!2��f)�searchclass.6ButtonCount = 3
BackStyle = 0
BorderStyle = 0
Value = 1
Height = 31
Left = 103
Top = 175
Width = 241
Name = "Commandgroup1"
Command1.Top = 1
Command1.Left = 0
Command1.Height = 23
Command1.Width = 72
Command1.FontName = "MS Sans Serif"
Command1.FontSize = 8
Command1.Caption = "\<Search"
Command1.TabIndex = 1
Command1.Name = "Command1"
Command2.Top = 1
Command2.Left = 84
Command2.Height = 23
Command2.Width = 72
Command2.FontName = "MS Sans Serif"
Command2.FontSize = 8
Command2.Caption = "A\<ll"
Command2.TabIndex = 2
Command2.Name = "Command2"
Command3.Top = 1
Command3.Left = 168
Command3.Height = 23
Command3.Width = 72
Command3.FontName = "MS Sans Serif"
Command3.FontSize = 8
Command3.Cancel = .T.
Command3.Caption = "\<Cancel"
Command3.TabIndex = 3
Command3.Name = "Command3"
qPROCEDURE Init
#DEFINE C_OPERATORS_LOC	"equals\;not equals\;more than\;less than\;is blank\;is NULL\;contains\;in\;between"
THIS.ADDITEM(C_OPERATORS_LOC)
THIS.VALUE = THIS.LIST[1]

ENDPROC
PROCEDURE InteractiveChange
IF INLIST(THIS.ListItemId,5,6)
	THIS.Parent.TxtExpr1.Value = ""
ENDIF
THIS.Parent.TxtExpr1.ENABLED = !INLIST(THIS.ListItemId,5,6)

ENDPROC
�FontName = "MS Sans Serif"
FontSize = 8
Alignment = 0
Height = 23
Left = 158
Style = 2
TabIndex = 2
Top = 25
Width = 96
Name = "cboOperators1"

cboOperators1comboboxcombobox�� ���%]�k�U����7��
�������C�������
��C.�(�����������%%�CC�
����G�M�U�������C��
����(��C�C���D��C�������T������T����	aWizFList��T���C�����UI	AWIZFLISTTHIS
ROWSOURCETYPE	ROWSOURCEVALUELISTInit,��1qq���Q!�AA�q2n)�yPROCEDURE Init
LOCAL i
PUBLIC aWizFList
DIMENSION aWizFList[1]
=AFIELDS(aWizFList)
FOR m.i = FCOUNT() TO 1 STEP -1
	IF INLIST(aWizFList[m.i,2],"G","M","U")	&&Memo field
		=ADEL(aWizFList,m.i)
		DIMENSION aWizFList[MAX(1,ALEN(aWizFList,1)-1),ALEN(aWizFList,2)]
	ENDIF
ENDFOR
THIS.RowSourceType = 5
THIS.RowSource = "aWizFList"
THIS.VALUE = THIS.LIST[1]

ENDPROC
<PROCEDURE runaddform
#DEFINE C_NOOBJ_LOC	"Failed to create the Add Record form class. Check or reinstall the WIZSTYLE.VCX file."

PRIVATE cFldKey,cKeyValue,nBtnAction,nAddAction,oGridAddForm 

IF TYPE("THIS.KeyField") # "C"
	THIS.KeyField = ""
ENDIF

cFldKey = THIS.KeyField
cKeyValue = THIS.KeyValue
nBtnAction = 1
nAddAction = 1

oGridAddForm = CREATE("gridaddform",m.cFldKey,m.cKeyValue,;
	m.nBtnAction,m.nAddAction,THIS.ChildPrimaryKey,THIS.UpdatableParentKey,THIS.NoSendUpdates)

IF TYPE("m.oGridAddForm") # "O"
	=MESSAGEBOX(C_NOOBJ_LOC)
	THIS.AddOption = 0
	RETURN
ENDIF

IF THIS.NoSendUpdates
	oGridAddForm.OptionGroup1.Value = 2
	oGridAddForm.Text1.Value = m.cKeyValue
ENDIF

oGridAddForm.Show()

THIS.AddOption = IIF(m.nBtnAction=1,m.nAddAction,0)
THIS.KeyValue = m.cKeyValue

ENDPROC
Top = 0
Left = 0
Width = 452
Height = 160
BorderWidth = 0
TabIndex = 1
Name = "Searchclass1"
cbofields1.TabIndex = 1
cbofields1.Name = "cbofields1"
cbooperators1.TabIndex = 2
cbooperators1.Name = "cbooperators1"
txtexpr1.TabIndex = 3
txtexpr1.Name = "txtexpr1"
cbofields2.TabIndex = 4
cbofields2.Name = "cbofields2"
cbooperators2.TabIndex = 5
cbooperators2.Name = "cbooperators2"
txtexpr2.TabIndex = 6
txtexpr2.Name = "txtexpr2"
optgrpandor.option1.Value = 1
optgrpandor.option1.Left = 5
optgrpandor.option1.Top = 5
optgrpandor.option1.Name = "option1"
optgrpandor.option2.Value = 0
optgrpandor.option2.Left = 5
optgrpandor.option2.Top = 23
optgrpandor.option2.Name = "option2"
optgrpandor.Height = 46
optgrpandor.Width = 58
optgrpandor.TabIndex = 7
optgrpandor.Name = "optgrpandor"
label1.Height = 16
label1.Left = 12
label1.Top = 7
label1.Width = 102
label1.Name = "label1"
label2.Height = 16
label2.Left = 158
label2.Top = 7
label2.Width = 93
label2.Name = "label2"
label3.Height = 16
label3.Left = 262
label3.Top = 7
label3.Width = 165
label3.Name = "label3"
label4.Height = 16
label4.Left = 12
label4.Top = 99
label4.Width = 102
label4.Name = "label4"
label5.Height = 16
label5.Left = 161
label5.Top = 99
label5.Width = 93
label5.Name = "label5"
label6.Height = 16
label6.Left = 262
label6.Top = 99
label6.Width = 165
label6.Name = "label6"
chkCaseSensitive.Top = 69
chkCaseSensitive.Left = 290
chkCaseSensitive.Height = 15
chkCaseSensitive.Width = 88
chkCaseSensitive.Name = "chkCaseSensitive"
�Width = 210
Name = "picformbtns"
cmdFind.Width = 37
cmdFind.Picture = wizbmps\wzlocate.bmp
cmdFind.Caption = ""
cmdFind.ToolTipText = "Search for records"
cmdFind.Name = "cmdFind"
cmdPrint.Top = 2
cmdPrint.Left = 42
cmdPrint.Width = 38
cmdPrint.Picture = wizbmps\wzprint.bmp
cmdPrint.Caption = ""
cmdPrint.ToolTipText = "Print to report"
cmdPrint.Name = "cmdPrint"
cmdExit.Top = 2
cmdExit.Left = 171
cmdExit.Width = 38
cmdExit.Picture = wizbmps\wzclose.bmp
cmdExit.Caption = ""
cmdExit.ToolTipText = "Exit input form"
cmdExit.Name = "cmdExit"
cmdAdd.Top = 2
cmdAdd.Left = 85
cmdAdd.Width = 38
cmdAdd.Picture = wizbmps\wznew.bmp
cmdAdd.Caption = ""
cmdAdd.ToolTipText = "Add new record"
cmdAdd.Name = "cmdAdd"
cmdDelete.Top = 2
cmdDelete.Left = 128
cmdDelete.Width = 38
cmdDelete.Picture = wizbmps\wzdelete.bmp
cmdDelete.Caption = ""
cmdDelete.ToolTipText = "Delete existing record"
cmdDelete.Name = "cmdDelete"
�� ��RP%;� ^�U���������%�C���6�B�-���T���	����T��
���
���T����
���
H�������
�����T���
��-��T�����-����
�
����T�����-���%��
����T�����-���
H����"�C�THIS.cKeyValueb�C��I�T���	����+�CC�THIS.cKeyValueb�NYIBF������T���	����(�CC�THIS.cKeyValueb�DT������T���	����"�C�THIS.cKeyValueb�L����T���	�a���UCFLDKEY	CKEYVALUE
NBTNACTION
NADDACTIONLCHILDPRIMARYKEYLUPDATABLEPARENTKEYLNOSENDUPDATESTHIS
COMMANDGROUP1VALUELABEL3CAPTIONOPTIONGROUP1OPTION1ENABLEDOPTION3OPTION2TEXT1
T�����
��C����U
NBTNACTIONTHISFORMRELEASEInit,��QueryUnload���1�qA2Q!��BABA�AA�!1�1��!A3��1n��')��FontName = "MS Sans Serif"
FontSize = 8
ControlSource = ""
Height = 23
Left = 11
Style = 2
TabIndex = 1
Top = 25
Width = 141
Name = "cboFields1"
searchclass.
cboFields1comboboxcombobox9remotedelimeter
*searchexpr 
*dataexpr 
*searchitem 
�Width = 452
Height = 160
BackStyle = 0
TabIndex = 1
BackColor = 192,192,192
remotedelimeter = (.F.)
Name = "searchclass"
	container��� ���%�9�U��C�����T���a��UTXTBTNSINITTHISFORMSHOWTIPS>%���
����#T�������	wznew.bmp��$T�������
wzedit.bmp��#T�������	wznew.bmp��$T�������
wzedit.bmp���7�$T�������
wzsave.bmp��$T�������
wzundo.bmp��$T�������
wzsave.bmp��$T�������
wzundo.bmp���UTHISEDITMODECMDADDPICTURE
WIZBMPPATHCMDEDITDOWNPICTUREInit,��
setcaptionr��1��31A1A�AAAAA1<]5)�7�� 2r%Y���U#T�������
��C����UTHIS
COMMANDGROUP1VALUERELEASE���T��������
H�*��"�C�THIS.cKeyValueb�C��_�T�������+�CC�THIS.cKeyValueb�NYIBF������T�������(�CC�THIS.cKeyValueb�DT������T�������"�C�THIS.cKeyValueb�L���T����a���UNSTYLETHISLABEL3CAPTION	CKEYFIELDTEXT1VALUEN%��C�	cKeyValue��������&��C�
nBtnAction��������UTHIS	ORETVALUEADDPROPERTYTEXT1VALUE
COMMANDGROUP1QueryUnload,��Showx��Release���11�2qb�!1�1��!A3Qa2A\��H)KWidth = 513
Height = 29
wizbmppath = (HOME()+"WIZARDS\WIZBMPS\")
Name = "picbtns"
cmdPrev.Top = 4
cmdPrev.Left = 51
cmdPrev.Width = 50
cmdPrev.Picture = (HOME()+"WIZARDS\WIZBMPS\WZBACK.BMP")
cmdPrev.Caption = ""
cmdPrev.ToolTipText = "Previous record"
cmdPrev.Name = "cmdPrev"
cmdNext.Top = 4
cmdNext.Left = 102
cmdNext.Width = 50
cmdNext.Picture = (HOME()+"WIZARDS\WIZBMPS\WZNEXT.BMP")
cmdNext.Caption = ""
cmdNext.ToolTipText = "Next record"
cmdNext.ColorSource = 0
cmdNext.Name = "cmdNext"
cmdTop.Top = 4
cmdTop.Left = 0
cmdTop.Width = 50
cmdTop.Picture = (HOME()+"WIZARDS\WIZBMPS\WZTOP.BMP")
cmdTop.Caption = ""
cmdTop.ToolTipText = "Top record"
cmdTop.Name = "cmdTop"
cmdEnd.Top = 4
cmdEnd.Left = 153
cmdEnd.Width = 50
cmdEnd.Picture = (HOME()+"WIZARDS\WIZBMPS\WZEND.BMP")
cmdEnd.Caption = ""
cmdEnd.ToolTipText = "Bottom record"
cmdEnd.Name = "cmdEnd"
cmdFind.Top = 4
cmdFind.Left = 204
cmdFind.Width = 50
cmdFind.Picture = (HOME()+"WIZARDS\WIZBMPS\WZLOCATE.BMP")
cmdFind.Caption = ""
cmdFind.ToolTipText = "Find records"
cmdFind.Name = "cmdFind"
cmdPrint.Top = 4
cmdPrint.Left = 255
cmdPrint.Width = 50
cmdPrint.Picture = (HOME()+"WIZARDS\WIZBMPS\WZPRINT.BMP")
cmdPrint.Caption = ""
cmdPrint.ToolTipText = "Print report"
cmdPrint.Name = "cmdPrint"
cmdExit.Top = 4
cmdExit.Left = 459
cmdExit.Width = 50
cmdExit.Picture = (HOME()+"WIZARDS\WIZBMPS\WZCLOSE.BMP")
cmdExit.Caption = ""
cmdExit.ToolTipText = "Exit form"
cmdExit.Name = "cmdExit"
cmdAdd.Top = 4
cmdAdd.Left = 306
cmdAdd.Width = 50
cmdAdd.Picture = (HOME()+"WIZARDS\WIZBMPS\WZNEW.BMP")
cmdAdd.Caption = ""
cmdAdd.ToolTipText = "Add / Save record"
cmdAdd.Name = "cmdAdd"
cmdDelete.Top = 4
cmdDelete.Left = 408
cmdDelete.Width = 50
cmdDelete.Picture = (HOME()+"WIZARDS\WIZBMPS\WZDELETE.BMP")
cmdDelete.Caption = ""
cmdDelete.ToolTipText = "Delete record"
cmdDelete.Name = "cmdDelete"
cmdEdit.Top = 4
cmdEdit.Left = 357
cmdEdit.Width = 50
cmdEdit.Picture = (HOME()+"WIZARDS\WIZBMPS\WZEDIT.BMP")
cmdEdit.Caption = ""
cmdEdit.ToolTipText = "Edit / Revert record"
cmdEdit.Name = "cmdEdit"
t file <<m.filname>> could not be found
    Knworkarea Saves old workarea (set internally).
editmode Whether the form is in edit mode (set internally).
previewmode Whether the form is in preview mode for use with Preview button on Wizard (set internally).
topfile Whether the record pointer is at top of table (set internally).
endfile Whether the record pointer is at end of table (set internally).
oldsetfields Saves SET FIELDS (set internally).
oldsetdelete Saves SET DELETED (set internally).
oldmultilocks Saves SET MULTILOCKS (set internally).
oldbuffering Saves table buffering state (set internally).
addmode Whether the form is in add mode where a new record is being added (set internally).
oldrefresh Saves SET REFRESH (set internally).
oldrec Saves record number (set internally).
oldreprocess Saves SET REPROCESS (set internally).
oldalias Saves alias when editing to restore with 1-Many forms (set internally).
previewinit For use with Preview button on wizard (set internally).
usedataenv Whether the form has a data environment object attached (set internally).
gridref Object reference to grid object (set internally).
odatarelation Object reference to data environment (set internally).
viewkey Key expression of child table used in grid object (set internally). Expression is obtained from Tag property of form.
gridalias Alias of table used in grid object (set internally).
viewtype Data source type for grid object (set internally).
parentkey Key expression of parent table used in 1-Many form (set internally). Expression is obtained from Comment property of form.
hasgeneral Whether the form has general field oleboundcontrol object (set internally).
oldtalk Saves SET TALK (set internally).
usercontrolmode This mode will allow user added controls such as comboboxes, listboxes and spinners to take on behavior of EditMode.
haderror Whether an error occurred.
lautobuffer Whether to automatically buffer data.
lnorptsource Whether to disable changing report/alias source in reporting dialog.
lnorptscope Whether to disable changing scope in reporting dialog.
lpromptkey Whether to always prompt for a unique primary key value when adding new record.
lstarttop Always start on first record when running form.
parentalias Alias of parent table.
childalias Alias of child table.
*buttonrefresh Enables/disables buttons.
*initvars Saves and sets certain environment variables.
*updaterows Handles add, edit and delete operations of records to tables.
*setcaption Changes caption/picture of buttons when edit mode toggled on/off.
*setallprop Enables/disables editing of data bound objects on form.
*navrefresh Refreshes record navigational buttons.
*getgridref Locates reference to grid object if one exists.
*addrec Adds a new record to datasource.
*printrpt Prints report not using outputdialog (old VFP5 style).
*navigate Navigates record pointer (Top, Prev, Next, End).
s�� ZZ*�%���U�5������!%�C�
THIS.KeyFieldb�C��H�T�������T������T������
T�����
T�����ET��C�gridaddform�
��
��
��
�����	��
�N��"%�C�m.oGridAddFormb�O��b�a��C�UFailed to create the Add Record form class. Check or reinstall the WIZSTYLE.VCX file.�x��T������B��%���
����T���
����T���
��
����
��C����&T���C�
����
���6��T����
���UCFLDKEY	CKEYVALUE
NBTNACTION
NADDACTIONOGRIDADDFORMTHISKEYFIELDKEYVALUECHILDPRIMARYKEYUPDATABLEPARENTKEY
NOSENDUPDATES	ADDOPTIONOPTIONGROUP1VALUETEXT1SHOW
runaddform,��1sA��S"AA1QA�b!21)Z'Z�� A'A'�%	%�"x&�>#�U#����������
�����
�����T��	�C�W��T��
�C�DELETEDv��G �T���C�	REPROCESSv��GM(����T���C�FIELDSv��T��
�C�
MULTILOCKSv��6T���CC�THIS.PreviewModeb�L�-���6��6T���CC�THIS.PreviewInitb�L�a���6��
H�A���,�C�THISFORM.DataEnvironmentb�O����T���a��T��C������b��%T���THISFORM.DataEnvironment��/�C�THISFORMSET.DataEnvironmentb�O��t�T���a��T��C������b��(T���THISFORMSET.DataEnvironment��'%�C�THISFORMb�O���
	��p�T���a���2���T���-���%�����n���C�
���j������(��
���f�5%�CC�.C�
���
.BaseClass�f�CURSOR��b���C�.C�
����^�"%�C�
SourceType����Z�2%���
�OFF�C�?C�SQL�ꉸ�	��y�
��C����*%�C�SendUpdates��
��
�
	��V����C�8Edits to one or more of the Views may not be permanent. �\To remedy this, ensure the View's Send SQL Updates checkbox is checked in the View Designer.�x��T��a������������
%�C�s����HR,�����8The table is Read-Only. You will not be able to edit it.���T����C�s
��T����C�s
��%������B��$%������
	�CC���3�B��T���C�	buffering��%������k�B��G�G_ �T�
��C���y�������(��
�����+%�C�
sourcetypeC�
��������%��C�	buffering�C�
��������UATABLESUSEDNTABLESUSEDIAMEMSNTOTMEMCWIZFILELSHOWEDMESSCDATAENVREFTHIS	NWORKAREAOLDSETDELETEOLDREPROCESSOLDSETFIELDS
OLDMULTILOCKSPREVIEWMODEPREVIEWINIT
USEDATAENVTHISFORMDATAENVIRONMENTTHISFORMSETVISIBLEALIASCMDADDENABLED	CMDDELETELAUTOBUFFEROLDBUFFERING{�������������	�
��
�����
�����T�
�����
T�
��a��T�
��CW��T�
��C���y�������(��
���X�F�C�
�����T�
�	�CC�Databaseꉡ
��T�
�����
T�
�
�-��
T�
��-��
H�����C�	Buffering���/�.��C����k�T�
��C-a��%��
���g�.��;��
�	
�(C�2C���ꐸ��C�3C���ꐸ�	����T�
��C���+��
����Q�#��
���T�
��CS��%��
�
��*�,T�
���Record in use by another user��Z�!��%��
�
��9���
����(�C.��5�%�CC�
�/b�G��r�.��%�CC�
�/�_CC�
�/���1�
T�
��a��`%�C�IData has been changed by another user. Overwrite changes with your edits?�4�x����
T�
�
�a���-�
T�
��-��Z�!������T�
��C�
����%��
�����T�
��Ca�
�
��%��
�����.��Z����
�	�������T�
��Ca-��%��
��������.�����T��C���z��
H�����������C������W�,T�
���Unique primary key violation.���C��������T�
���Trigger failed.���C����-����(T�
���Field doesn't accept NULL���C����.��
�"T�
���Field rule violated���C�������O�,T�
���Record in use by another user���C����/���� T�
���Row rule violated���C����\����%T�
���Unique index violation���C����1����%��
�	����`%�C�IData has been changed by another user. Overwrite changes with your edits?�4�x��������T�
��Caa��%��
���|����.������*��C�Could not force table updates.�x�����2���%�C�
��
����!T�
���Error: C�������
��Ca��
T�
��-��%�C�
��
��T�*��C�Failed to update table: �
��x�����Z�F��
���B��
���U
AERRORS
CERRORMESSAGEATABLESUSEDNTABLESUSEDNTOTERRNFLDINOLDAREALSUCCESSLINDBC
LOVERWRITELHADMESSAGE
NMODRECORD)%�CC����B�-����������%�C+�C��G�#)��T��CO��
H�d���F�C�
SourceType��C�offline�
	�C�SendUpdates�
	���[��C�OYou cannot add a new record because the view(s) selected does not send updates.�x��B�-���CC�databaseꉡ��+���C�
SourceType���N��(�C�	buffering����
	��{��2���T��C�DATABASEv��G(�C�database��2T��CC�
sourcename��Table�
PrimaryKey��SET DATABASE TO &lcSaveData
%�C���������"T��C�	AddRecord������T��C�custom�N��T������T��	�C���T��
����
��C����%��������r��C��������	�����T��
�a�����%���
���T��
�-��	#����B�-���
��C����U	LNSAVEREC
LCSAVEDATALOADDRECLOCUSTOMCPAPAKEYTHIS
LPROMPTKEYCLASSLIBRARY	CKEYFIELD	CKEYVALUE	ORETVALUESHOW
NBTNACTIONHADERRORTHISFORMREFRESH�%�CC����B�-���9%�C�"Do you want to delete this record?�$�x������%�C������
%�C+
��}�	H�����%�C+�C
	����
H��������
��C�����%��������t,������UTHIS
UPDATEROWSTHISFORMREFRESH
SHOWWINDOWNAME��C���z��%�C���\����T��C�HA unique key error violation has occurred. That record will be reverted.�x��
��Ca��B��"%�C�
sourcetype�����V��C�JA problem occurred updating the remote data. That record will be reverted.�x����Ca���B��U
AGETERRORSALIAS���������
�����
T�����%�C�THIS.Parentb�O��X�B��0%�C�THIS.oldTalkb�C�
���ON	����G2 ��%�����O�
�����
H�����,�C�THISFORM.DataEnvironmentb�O��,�T��C���	�
��b��%T���THISFORM.DataEnvironment��/�C�THISFORMSET.DataEnvironmentb�O����T��C����
��b��(T���THISFORMSET.DataEnvironment��������(��
���K�!��C�
��.C�
����G�B%�C���C�CURSOR�
��	�C�	buffering��	��C�%�Caa��
��?�
��C�����������%�����g�B��%����OFF����G��GM(�����G&(�
F�����'%������
���	����B��%��������B��T�
��C���y�������(��
���|�+%�C�
sourcetypeC�
������x�(��C�	buffering��C�
��������%����OFF����G_��%����ON����G ��UNTABLESUSEDATABLESUSEDI
NDECURSORS
ADECURSORSCDATAENVREFTHISOLDTALK
USEDATAENVTHISFORMDATAENVIRONMENTTHISFORMSETALIAS	BASECLASS
CHECKERRORPREVIEWMODEOLDSETDELETEOLDREPROCESS	NWORKAREALAUTOBUFFEROLDBUFFERING
OLDMULTILOCKSOLDSETFIELDSb4��������
�����T��C���z��T���a��
H�T����C�
��������q�B���
�������B���
�������B�$����C�����	������CC����x��B�������%�C+����#6���#)��B����\����%�C�	buffering���|�6��C�*A unique key error violation has occurred.�x��B��k%�C�*A unique key error violation has occurred.� �!Would you like to revert changes?�$�x�����
��Ca���B��Z��CC�EC�
 �Error: C�ZC�
 CEC�
 �Method: �C�
 �Line: C�Z�x��B�UNERRORCMETHODNLINEAFOXERRNTOTERRTHISHADERRORS�����%�C�THIS.Parentb�O��2�B��%�C�TALKv�ON��g�G2�T����ON�����T����OFF���+%�C�WIZBTNS.VCXC�CLASSLIBv�����T���<��%��\���W�T��C�
��C�\�
��\��F%�C�
��R�\�C�
�>�	�C�
�C�
�>��\�:	��S�T��C�
��C�
�>�\����l�
T������T��C�3��:��\6��(%�C�
��R�\:
�	C�
��
	����T�
���
��
����
H������C�WIZBTNS.VCX0���T���WIZBTNS.VCX�� �C�
��WIZBTNS.VCX0��L�T���
��WIZBTNS.VCX��,�C�
��WIZARDS\�WIZBTNS.VCX0����*T���
��WIZARDS\�WIZBTNS.VCX���CC�Q�WIZBTNS.VCX0����T��C�Q�WIZBTNS.VCX��*�CC�Q�WIZARDS\�WIZBTNS.VCX0��.�(T��C�Q�WIZARDS\�WIZBTNS.VCX��2���f��C�HThe class library (WIZBTNS.VCX) needed by this form could not be found. �Please locate.�x��*T��C�VCX�Find: �WIZBTNS.VCX����#%�C�WIZBTNS.VCX�
�������G~(��
�����B�-����
��C����'%�CC�
�C+�C���	��L�#)��UCWIZHOMEPATH	SEPARATORCWIZSTYFILETHISOLDTALKCWIZFILEINITVARS	LSTARTTOP�%������	����T���-��T����-��T����-��T����-��T����-��T����-��T��	�CW���U
THISPREVIEWMODEPREVIEWINITCMDADDENABLED	CMDDELETECMDFINDCMDPRINTCMDEXIT	NWORKAREAinitvars,��
updaterowsc��addrecg��	deleterec9��
checkerrorT��Destroy���Error]��Init���Refresh�!��15��"�a����da����Q����q�A��A�Q�!%�A�A
�AAAAAAA��ACAAABAA�AAAbaB��QAA3~������A�B������BA�AA�$A���QAA��AA�����QAAAAAAA�Q�AAQA�Q�QAAAA#��������!����Q��R�QA�A�AAA�!AA��!�ABR��3�qAr"QA��c�q�R�R�R�qa!��Q�!a!�A���AAA��qA�2�qA�A��A1�AA�AB�A3�bB�AA"b�AA3����AAaA����Q���A�#B�AJBAAAAraA�a�rAABAAC���AAraAbaA3���!���AAAAAA2A�Q�QAA!�aAA��AAA�B3��AA�a!�1A��!�b�A��A��qA�����������a�A2��rAB�rQA3���A2�G�2d�O�"���"a$9��$�&U�&4/j>P/�3�a�3�:���:�;;)A'bPROCEDURE searchexpr
LOCAL cGetExpr1,cGetExpr2,cJoin,cGetExpr

m.cGetExpr1 = THIS.SearchItem(THIS.cboFields1,THIS.cboOperators1,THIS.txtExpr1)
m.cGetExpr2 = THIS.SearchItem(THIS.cboFields2,THIS.cboOperators2,THIS.txtExpr2)
m.cJoin = IIF(THIS.optGrpAndOr.value = 2," OR "," AND ")

DO CASE
CASE EMPTY(m.cGetExpr1) AND EMPTY(m.cGetExpr2)
	m.cGetExpr = ""
CASE EMPTY(m.cGetExpr2)
	m.cGetExpr = m.cGetExpr1
CASE EMPTY(m.cGetExpr1)
	m.cGetExpr = m.cGetExpr2
OTHERWISE
	m.cGetExpr = m.cGetExpr1+m.cJoin+m.cGetExpr2
ENDCASE

RETURN m.cGetExpr
ENDPROC
PROCEDURE dataexpr
LPARAMETER cDataType,cFldExpr

LOCAL cTmpExpr

DO CASE
CASE INLIST(m.cDataType,"M","G","P","O","U")
	RETURN ""

CASE m.cDataType = "C"
	IF TYPE("'Test'="+m.cFldExpr) # "L"
		IF THIS.REMOTEDELIMETER
			cTmpExpr = '"'+m.cFldExpr+'"'
		ELSE
			cTmpExpr = "["+m.cFldExpr+"]"
		ENDIF
	ELSE
		cTmpExpr = m.cFldExpr
	ENDIF
	
	* Check for case sensitive
	IF THIS.chkCaseSensitive.Value = 0
		m.cTmpExpr= "UPPER("+m.cTmpExpr+")" 
	ENDIF
	RETURN m.cTmpExpr
	
CASE INLIST(m.cDataType,"N","F","I","Y","B")
	* Check for any commas and remove
	RETURN ALLTRIM(STR(VAL(STRTRAN(m.cFldExpr,",")),16,4))

CASE INLIST(m.cDataType,"D","T")
	RETURN "{"+CHRTRAN(m.cFldExpr,"{}","")+"}"

OTHERWISE
	RETURN ""

ENDCASE


ENDPROC
PROCEDURE searchitem
LPARAMETERS oField,oOp,oExpr
LOCAL cExpr,cDataType,cOp,cFldName,cFldExpr,cRetExpr,aExprs,nTotExprs,i

* Check to make sure proper parameters passed
IF TYPE("m.oField")#"O" OR TYPE("m.oOp")#"O" OR TYPE("m.oExpr")#"O"
	RETURN ""
ENDIF

m.cFldName = ALLTRIM(m.oField.Value)
m.cFldExpr = ALLTRIM(m.oExpr.Value)

* If empty expression return empty.
IF EMPTY(m.cFldExpr) AND !INLIST(m.oOp.listitemid,5,6)
	RETURN ""
ENDIF

* Get data type of field
m.cDataType = aWizFList(m.oField.listitemid,2)

IF m.cDataType = "C" AND THIS.chkCaseSensitive.Value = 0
	m.cFldName = "UPPER("+m.cFldName+")" 
ENDIF

* Get the operator language equivalent
DO CASE
CASE m.oOp.listitemid = 1	&& equals
	m.cOp = "="
CASE m.oOp.listitemid = 2	&& not equals
	m.cOp = "<>"
CASE m.oOp.listitemid = 3	&& more than
	m.cOp = ">"
CASE m.oOp.listitemid = 4	&& less than
	m.cOp = "<"
CASE m.oOp.listitemid = 5	&& is blank
	RETURN "EMPTY("+m.cFldName+")"
CASE m.oOp.listitemid = 6	&& is NULL
	RETURN "ISNULL("+m.cFldName+")"
CASE m.cDataType = "L" 		&& don't allow other options for logical type
	m.cOp = "="
CASE m.oOp.listitemid = 7	&& contains
	m.cFldExpr = THIS.DataExpr("C",m.cFldExpr)
	DO CASE
	CASE m.cDataType = "T"
		RETURN "AT("+m.cFldExpr+",TTOC("+m.cFldName+"))>0"
	CASE m.cDataType = "D"
		RETURN "AT("+m.cFldExpr+",DTOC("+m.cFldName+"))>0"
	CASE INLIST(m.cDataType,"N","F","I","Y","B")
		RETURN "AT("+m.cFldExpr+",ALLTRIM(STR("+m.cFldName+")))>0"
	OTHERWISE
		RETURN "AT("+m.cFldExpr+","+m.cFldName+")>0"
	ENDCASE
OTHERWISE
	nTotExprs = OCCURS(",",m.cFldExpr)+1
	DIMENSION aExprs[m.nTotExprs]
	FOR i =  1 TO m.nTotExprs
		DO CASE
		CASE m.i = m.nTotExprs
			aExprs[m.i] = SUBSTR(m.cFldExpr,RAT(",",m.cFldExpr)+1)
		CASE m.i =1
			aExprs[m.i] = LEFT(m.cFldExpr,AT(",",m.cFldExpr)-1)
		OTHERWISE
			aExprs[m.i] = SUBSTR(m.cFldExpr,AT(",",m.cFldExpr,m.i-1)+1,;
				AT(",",m.cFldExpr,m.i)-AT(",",m.cFldExpr,m.i-1)-1)
		ENDCASE
		aExprs[m.i] = THIS.DataExpr(m.cDataType,aExprs[m.i])
	ENDFOR

	DO CASE
	CASE m.oOp.listitemid = 8	&& in
		m.cFldExpr = ""
		FOR i = 1 TO m.nTotExprs
			m.cFldExpr = m.cFldExpr + aExprs[m.i]
			IF	m.i # m.nTotExprs
				m.cFldExpr = m.cFldExpr + ","			
			ENDIF
		ENDFOR
		RETURN "INLIST("+m.cFldName+","+m.cFldExpr+")"
	CASE m.oOp.listitemid = 9	&& between
		IF ALEN(aExprs)=1
			DIMENSION aExprs[2]
			aExprs[2] = aExprs[1]
		ENDIF
		IF ALEN(aExprs)>2
			DIMENSION aExprs[2]
		ENDIF
		RETURN "BETWEEN("+m.cFldName+","+aExprs[1]+","+aExprs[2]+")"
	OTHERWISE
		RETURN ""
	ENDCASE
ENDCASE

DO CASE
CASE INLIST(m.cDataType,"M","G","P","O","U")
	RETURN ""
CASE m.cDataType = "L"
	IF TYPE(m.cFldName+m.cOp+m.cFldExpr) # "L"
		IF (AT(m.cFldExpr,"fFnN")#0 AND m.cOp # "<>") OR (AT(m.cFldExpr,"tTyY")#0 AND m.cOp = "<>")
			m.cFldName = "!"+m.cFldName
		ENDIF
		RETURN m.cFldName
	ENDIF
OTHERWISE
	m.cFldExpr = THIS.DataExpr(m.cDataType,m.cFldExpr)
ENDCASE

IF EMPTY(m.cFldExpr)
	RETURN ""
ELSE
	RETURN m.cFldName+m.cOp+m.cFldExpr
ENDIF


ENDPROC
PROCEDURE Destroy
RELEASE aWizFList

ENDPROC
�� ����%�8�
�U@������%T�
��C����������%T�
��C��	��
������0T�
��C���
��
� OR �� AND 6��
H���.��C�
���C�
��	����T�
������C�
������T�
���
����C�
����	�T�
���
���2�.�T�
���
��
��
����B��
���U	CGETEXPR1	CGETEXPR2CJOINCGETEXPRTHIS
SEARCHITEM
CBOFIELDS1
CBOOPERATORS1TXTEXPR1
CBOFIELDS2
CBOOPERATORS2TXTEXPR2OPTGRPANDORVALUE��������
H����%�C�
��M�G�P�O�U���M�	B������
��C��1�!%�C�'Test'=�
�b�L����%�������T���"�
��"�����T���[�
��]������T���
����%�������"� T�
���UPPER(�
��)���B��
���%�C�
��N�F�I�Y�B���s�B�CCCC�
��,�g��Z����C�
��D�T�����B��{C�
��{}���}��2���	B�����U	CDATATYPECFLDEXPRCTMPEXPRTHISREMOTEDELIMETERCHKCASESENSITIVEVALUE������'��������	�
��D%�C�m.oFieldb�O�C�m.oOpb�O�C�m.oExprb�O����	B�����T�
��C�
�����T�
��C�
�����&%�C�
���C�
��
���
	����	B�����T�
��C�
��
����%%��
��C�����	��F� T�
���UPPER(�
��)���
H�W�����
��
���}�T�
���=����
��
�����T�
���<>����
��
�����T�
���>����
��
�����T�
���<����
��
��� �B��EMPTY(�
��)����
��
���Q�B��ISNULL(�
��)����
��L��u�T�
���=����
��
�����T�
��C�C�
�����
H�������
��T����*B��AT(�
��,TTOC(�
��))>0����
��D��1�*B��AT(�
��,DTOC(�
��))>0��%�C�
��N�F�I�Y�B�����2B��AT(�
��
,ALLTRIM(STR(�
��)))>0��2���$B��AT(�
��,�
��)>0���2���T�
�C�,�
������	��
�
�������(��
�
���
H������
��
�
��K�(T�	��
���C�
�C�,�
���\����
������(T�	��
���C�
�C�,�
��=��2���ZT�	��
���C�
�C�,�
��
���C�,�
��
�C�,�
��
���\���)T�	��
���C�
�C�
��	������
H�&�����
��
�����T�
����������(��
�
����T�
���
�C�
��	��%��
��
�
����T�
���
��,�����&B��INLIST(�
��,�
��)����
��
�	����%�C�	���'�
�	����T�	����C��	���%�C�	���L�
�	�����6B��BETWEEN(�
��,C��	�,C��	�)��2���	B������
H�����%�C�
��M�G�P�O�U�����	B������
��L����"%�C�
��
��
�b�L����R%�C�
��fFnN���
��<>	�#C�
��tTyY���
��<>	��x�T�
���!�
����B��
����2���T�
��C�
��
������%�C�
������	B�������B��
��
��
����UOFIELDOOPOEXPRCEXPR	CDATATYPECOPCFLDNAMECFLDEXPRCRETEXPRAEXPRS	NTOTEXPRSIVALUE
LISTITEMID	AWIZFLISTTHISCHKCASESENSITIVEDATAEXPR
<��U	AWIZFLIST
searchexpr,��dataexpr��
searchitem��Destroy���11RQ�����A�2�r�Q�B���A��AsA�R�����B4�qC�Abac�A�RA�aaaaa�a�Aa��A�A�Q!�AA�����Q�1���A�A�a���QaAAaaA�qAA�Aa��AA�Q�A!!aA�A��A��qA4q2)H$,E&=�DW�)�O��� �O�O��%oG�N/oH�U�%�CW���� �
F������
��C����T������
��T������
��T������
��T������
�C�s
	��
��C��	��U
THIS	NWORKAREA
SETALLPROPCMDFINDENABLEDEDITMODECMDPRINTCMDEXIT	CMDDELETE
SETCAPTIONc#����������
�����
�����T��	����T��
����T������T������T��
�-��T���-��T���-��T���C�W��T���C�DELETEDv��G �T���C�	REPROCESSv��GM(����T���C�
MULTILOCKSv��T���C�FIELDSv��6T���CC�THIS.PreviewModeb�L�-���6��6T���CC�THIS.PreviewInitb�L�a���6��
H�����,�C�THISFORM.DataEnvironmentb�O��%�T���a��T��C������b��%T���THISFORM.DataEnvironment��/�C�THISFORMSET.DataEnvironmentb�O����T���a��T��C������b��(T���THISFORMSET.DataEnvironment��'%�C�THISFORMb�O���
	����T���a���2���T���-���%�����l���C�
���h������(��
�����7%�CC�.C�
���
.BaseClass�f�RELATION����"T����
��.C�
����!���������(��
���d�5%�CC�.C�
���
.BaseClass�f�CURSOR��`���C�.C�
����\�8%�C�
SourceType���C�offline��
	��X�2%����OFF�C�?C�SQL�ꉸ�	��w�
��C����*%�C�SendUpdates��
��
�
	��T����C�8Edits to one or more of the Views may not be permanent. �\To remedy this, ensure the View's Send SQL Updates checkbox is checked in the View Designer.�x��T��a������������3T���CC�
THIS.EditModeb�L�-���6��
%�C�s���HR,�����8The table is Read-Only. You will not be able to edit it.��T���-���T��� �C�s
��T��!� �C�s
��T��"� �C�s
��%�����Z�B��
��C��#��$%������$
	�CC�����B��T��%�C�	buffering��%���%�����B��G_ �G�T�
��C���y�������(��
���\�+%�C�
sourcetypeC�
������X�%��C�	buffering�C�
��������U&ATABLESUSEDNTABLESUSEDIAMEMSNTOTMEMCWIZFILELSHOWEDMESSCDATAENVREFTHISVIEWKEY	PARENTKEYVIEWTYPE	GRIDALIASTOPFILEENDFILEADDMODE	NWORKAREAOLDSETDELETEOLDREPROCESS
OLDMULTILOCKSOLDSETFIELDSPREVIEWMODEPREVIEWINIT
USEDATAENVTHISFORMDATAENVIRONMENTTHISFORMSETVISIBLE
ODATARELATIONALIASEDITMODECMDADDENABLEDCMDEDIT	CMDDELETE
GETGRIDREFLAUTOBUFFEROLDBUFFERING��������������	�
�����
����
�����
�����T�
�����
T�
��a��T�
��CW��T�
��C���y��
T����� %�C���
�
C���
	��]������(��
���Y�"%�CC�
���fC��f���
T�����!��"%�CC�
���fC��f��U�
T�����!����������(��
����F�C�
�����T�
�	�CC�Databaseꉡ
��T�
�����
T�
�
�-��
T�
��-��
H�����C�	Buffering����.��C����>�T�
��C-a��%��
���:�.��;��
�	
�(C�2C���ꐸ��C�3C���ꐸ�	��l�T�
��C���+��
����$�#��
���T�
��CS��%��
�
����,T�
���Record in use by another user��Z�!��%��
�
�����
����(�C.���%�CC�
�/b�G��E�.��%�CC�
�/�_CC�
�/����
T�
��a��`%�C�IData has been changed by another user. Overwrite changes with your edits?�4�x�����
T�
�
�a����
T�
��-��Z�!������T�
��C�
����%��
���h�T�
��Ca�
�
��%��
���_�.��Z����
�	������%�������
F�����T�
��Ca-��
T�����F�C�
������T�
��Ca-��%��
��������.�����T��C���z��
H�(�$������9��C������~�,T�
���Unique primary key violation.���C��������T�
���Trigger failed.���C����-����(T�
���Field doesn't accept NULL���C����.��1�"T�
���Field rule violated���C�������v�,T�
���Record in use by another user���C����/���� T�
���Row rule violated���C����\����%T�
���Unique index violation���C����1����%��
�	����`%�C�IData has been changed by another user. Overwrite changes with your edits?�4�x��������T�
��Caa��%��
��������.������*��C�Could not force table updates.�x�����2�$�%�C�
��
�� �!T�
���Error: C�������
��Ca��
T�
��-��%�C�
��
��{�*��C�Failed to update table: �
��x�����Z�F��
���B��
���UAERRORS
CERRORMESSAGEATABLESUSEDNTABLESUSEDNTOTERRNFLDINOLDAREALSUCCESSLINDBC
LOVERWRITELHADMESSAGEORELCCHILDALIAS
CPAPAALIASLNCHILDFIRSTLCHILDFIRSTTHIS
CHILDALIASPARENTALIAS
NMODRECORD�%�����D�T�����\<Save��T�����\<Revert���}�T�����\<Add��T�����\<Edit���UTHISEDITMODECMDADDCAPTIONCMDEDIT���������%�C���5�T�
������N�T�
���
����
H�_���$�C�	Pageframe�
��������T������3�C�
���Optiongroup,Commandgroup������T������2���T������������(��
�����
H����$�C�	Pageframe�
������X���CC�
��
���	�
��=�C�
���Optiongroup,Commandgroup����	�	���� T�
��
��
�����	���G�CC�
��
����Optiongroup,Commandgroup����	�	�����CC�
��
���	�
��Q�C�	ContainerC�
��
������ C�PageC�
��
�����������CC�
��
���	�
��G�CC�
��
����ListBox,ComboBox,Spinner����	�	���� T�
����
�����	���4�CC�
��
����OleBoundControl����@� T�
����
�����	���=�CC�
��
����CheckBox,TextBox,EditBox������!T�
����
�����	�
��)�CC�
��
����Grid������!T�
����
�����	�
�����U
OCONTAINERIOCONTROLPARENT
NCTRLCOUNTTHISFORM	BASECLASS	PAGECOUNTBUTTONCOUNTCONTROLCOUNTTHIS
SETALLPROPPAGESUSERCONTROLMODEBUTTONSENABLEDEDITMODECONTROLSREADONLY������T�
������T���a��%�CW����O�
F������%���
�CC�
	��D�T���C+�����%���
����H�T���C+��
H���������#6��T��	�C�C+���	��%���	
��'�
H������T��	�C��%���	
��#�H���%���	��@�#)���"T��
����	
���
	��"T������	
���
	��"T��
����
���
	��"T������
���
	��
H���������C�s����'����C�	BUFFERING�	��,�T����-�������M�T����a���CN��C�C+����T����-��T����-������
����T����a��T����a���%���
�
C���
	����T��C����
H����C��b�C��>�%T�����=�[�
��]���C��b�L��e�T�������C��b�D����'T�����=�{C�
�*�}���C��b�T����(T�����=�{C�
���}��2��%T�����=CC�
���Z����
F�����
H�-����-��8�������h�SET FILTER TO &cFiltExpr
��������SET FILTER TO &cFiltExpr
�
F������T����
���
��C����U
OLDLOCKSCREENKEYVALUE	CFILTEXPRTHISFORM
LOCKSCREENTHIS	NWORKAREAEDITMODEENDFILETOPFILECMDTOPENABLEDCMDPREVCMDNEXTCMDENDPREVIEWMODECMDEDIT	CMDDELETEVIEWKEY	PARENTKEY	GRIDALIASVIEWTYPEREFRESHn�����T������%�C�THISFORMb�O��g�
�����T��C�����b��
�����c������(��
���_�3%�CC�.C�
���
.BaseClass�f�GRID��[�T���C�
������C�.����S�!T���C�
sourcetype���T������%������O�T��	��
��T���������!�������U
AMEMSNTOTMEMITHISGRIDREFTHISFORMVIEWTYPERECORDSOURCE	GRIDALIASVIEWKEYTAG	PARENTKEYCOMMENTe���������#����	�
���
���������������%�CC�����B�-���T���C��T���CO��%�C�������
H���s�F�C�
SourceType��C�offline�
	�C�SendUpdates�
	��j�[��C�OYou cannot add a new record because the view(s) selected does not send updates.�x��B�-���CC�databaseꉡ������C�
SourceType������(�C�	buffering����
	�����2�s�T��C�DATABASEv��G(�C�database��2T��CC�
sourcename��Table�
PrimaryKey��T��C��W��SET DATABASE TO &lcSaveData
%�C�����������o�T��C�
�m��"T��C�	AddRecord������T��C�custom�N��T����
���T���C�
���T�� ����
��C��!��%���"���U�r��C���
���������k�T��#�a�����%���#����T��#�-��
F�����#�����B�-���B�a���T��-��%�C��$�
����T�
�C��$���
H�����C�m.oRelb�O��s�
���
��d�T���%��T���&��T���'��T���(����T�
���C��)�
��K�T��C��T����*��T����+��T����)��z%�C�
SourceType�
���C�offline�
��
	�=C�,�
��,�,C�UpdatableFieldList�
���,��	��G�T��a���2���T��C��T��C����T����+��T��C�
�����T��'����T��%����
F���+��
T�,����%�C��)��	C�
��
	����
T����������(�C��V��X�%�CC�
��fC�
�f��T�T��C�
�m��T��C�
���!����,%�C�(�
����C�+�
�������
T��������T���
���T�,�C�
�b����U%�C�
SourceType�
���C�offline�
��
	�C�SendUpdates�
��
	��%�T��a���U%�C�
SourceType�
���C�offline�
��
	�C�SendUpdates�
��
	����T��a���%��
���
�	���[��C�OYou cannot add a new record because the view(s) selected does not send updates.�x��B�-���
F�����#%�C�
�,�
��
�,C�
�b	��F�T��a���
H�W��"��
���
���
�	����[��C�OYou cannot add a new record because the view(s) selected does not send updates.�x��B�-����
���
�	���	����C�{You cannot add a new record because the view(s) selected does not send updates and the child data source has a primary key.�x��B�-����
���/
��%�C�;The child data source is a view and does not send updates. �9Do you just want to add a new record to the parent table?�$�x���&
�B�-������
����
��%�C�OThe field relating the grid's view to the parent data source is not updatable. �9Do you just want to add a new record to the parent table?�$�x����
�B�-������
������%�C�LThe fields relating the parent and child tables are not the same data type. �9Do you just want to add a new record to the parent table?�$�x�����B�-����2��T��a��z%�C�
SourceType�
���C�offline�
��
	�=C�,�
��,�,C�UpdatableFieldList�
���,��	��H�T��-���,%�C�(�
����C�+�
�������
T������T�	�C�DATASESSIONv��T��C�
GridAddRec�N��%�C�	m.oAddRecb�O��?
�^��C�RFailed create the Add Record form class. Check or reinstall your WIZBTNS.VCX file.�x��B�-���%�CC�databaseꉡ
���
�T��C�DATABASEv��G(�C�database��=%�CCC�
sourcename�
���Table�
InsertTriggerꋡ
���
�T��-���SET DATABASE TO &lcSaveData
�T��-��
���T��.��
���T��/��
���T��0��
���'T��1�CC�
��
�
C�
����6��
��C��2��%���3�����B�-���G�(��	��
F�����$%�C�oAddRec.KeyValueb�C����T��1�C��1`���T�
�CO��%�C��3�����\�%�C�
����-���
����X�#r���
�����0�����1����T��CO��%�C��3������#��
�
��%���#����
�����)%�C���z��C����\	������Ca�
������#��
���=%�C�
���)C�
��.�
�bC�oAddRec.KeyValueb��F���
����p�"r���
����
������1���%�-���T����4��F��
���T��4�CW��T��5���5
��T��6���5��T��7�-��
��C��8��
��C��9��T��4����B�-������%���#��^�T��#�-��
F�����#�����B�-���U:OSEARCHDLOGOADDRECCCHILDALIAS
CPAPAALIASI	LPRIMEKEYNPAPAKEYCPAPAKEY	CCHILDKEY	NSAVESESSORELCTAGNAMELBADVIEWKEYNSAVEREC	NSAVEREC2LBADCHILDKEYLUPDATABLEPARENTKEYLNOSENDPARENTUPDATESLNOSENDCHILDUPDATES
LCSAVEDATALOADDRECLOCUSTOMAFOXERR	NSAVEAREATHISOLDALIASOLDRECGRIDREF
LPROMPTKEYCLASSLIBRARY	CKEYFIELD	CKEYVALUE	ORETVALUESHOW
NBTNACTIONHADERROR
ODATARELATIONPARENTALIASRELATIONALEXPR
CHILDALIAS
CHILDORDERVIEWKEY	PARENTKEY	GRIDALIASCGRIDKEYTYPECHILDPRIMARYKEYUPDATABLEPARENTKEY
NOSENDUPDATESKEYFIELDKEYVALUE
RUNADDFORM	ADDOPTION	NWORKAREAEDITMODEADDMODETOPFILE
BUTTONREFRESH
NAVREFRESHl�������T��C��T��C�
SourceName��T��C�Database��
T�����T��CC�=�.FRX��T��C�DATASESSIONv��,%�C�THISFORM.DataEnvironmentb�O����T����������T���	�����%��
���>�%��
����:�G�(����F��%�C�
��
��K�
���
����%�C�
������F��
��� %�C�
SourceName�
�����T��C�
SourceName��
Q��
���F����%�CC���6�Q��
�����
���%�CC���2�8��C�,Error opening table. Unable to print report.�x��B�����%�C�
�0��b�?��
���:����)T�
��C�frx�Pick report:�����%�C�
��
����%�C�
�0����?��
���:������<���
AUTOREPORT�����%��
���?�%�C��
��"�Q���
����
G�(��
���F��
����%���
���e�t,������UCREPNAME	NSAVESESS
CSAVEALIASCSAVESOURCE	CSAVEDATACDIFFSOURCELPRIVATESESSIONTHISFORMDATASESSIONTHISFORMSET
SHOWWINDOWNAMEg���
F�����%�CC���)�B�-���
H�:�S��C�TOP�����t�-�T���a��T���C+���C�END�������#6�T���-��T���a���C�NEXT������
%�C+
����	H�����T���C��T���C+���C�PREV�����S�
%�C
��1�
H�������T���C��T���C+���
��C����U
CDIRECTIONTHIS	NWORKAREATOPFILEENDFILE
NAVREFRESH�%������	����T���-��T����-��T����-��T����-��T����-��T����-��T��	��-��T��
�CW��
��C����
��C����
��C��
���UTHISPREVIEWMODEPREVIEWINITCMDADDENABLEDCMDEDIT	CMDDELETECMDFINDCMDPRINTCMDEXIT	NWORKAREA
GETGRIDREF
SETALLPROP
NAVREFRESH�������%�C�THIS.Parentb�O��6�B��%�C�TALKv�ON��k�G2�T����ON�����T����OFF���+%�C�WIZBTNS.VCXC�CLASSLIBv�����T���<��%��\���[�T��C�
��C�\�
��\��F%�C�
��R�\�C�
�>�	�C�
�C�
�>��\�:	��W�T��C�
��C�
�>�\����p�
T������T��C�3��:��\6��(%�C�
��R�\:
�	C�
��
	����T�
���
��
����
H������C�WIZBTNS.VCX0���T���WIZBTNS.VCX�� �C�
��WIZBTNS.VCX0��P�T���
��WIZBTNS.VCX��,�C�
��WIZARDS\�WIZBTNS.VCX0����*T���
��WIZARDS\�WIZBTNS.VCX���CC�Q�WIZBTNS.VCX0����T��C�Q�WIZBTNS.VCX��*�CC�Q�WIZARDS\�WIZBTNS.VCX0��2�(T��C�Q�WIZARDS\�WIZBTNS.VCX��2���f��C�HThe class library (WIZBTNS.VCX) needed by this form could not be found. �Please locate.�x��*T��C�VCX�Find: �WIZBTNS.VCX����#%�C�WIZBTNS.VCX�
������G~(��
�����B�-����
��C����%����CC�
	��B�#)��
��C��	��
��C��
��T������%�C�
��
�����UCGRIDREFCWIZHOMEPATH	SEPARATORCWIZSTYFILETHISOLDTALKCWIZFILEINITVARS	LSTARTTOP
BUTTONREFRESH
NAVREFRESHGRIDREF�4��������
�����T��C���z��T���a��
H�T�1��C�
��������q�B���
�������B�$����C�����	������CC����x��B�$����C����\	��1�E��C�9Failed to add/update record(s) because of non uniqueness.�x��B��Z��CC�EC�
 �Error: C�ZC�
 CEC�
 �Method: �C�
 �Line: C�Z�x��UNERRORCMETHODNLINEAFOXERRNTOTERRTHISHADERROR���������
�����%�C�THIS.Parentb�O��K�B��0%�C�THIS.oldTalkb�C�
���ON	����G2 ��%�����G�
�����
H�����,�C�THISFORM.DataEnvironmentb�O���T��C���	�
��b��%T���THISFORM.DataEnvironment��/�C�THISFORMSET.DataEnvironmentb�O����T��C����
��b��(T���THISFORMSET.DataEnvironment��������(��
���C�!��C�
��.C�
����?�^%�C���C�CURSOR�
��	�C�
sourcetype��	�C�	buffering��	��;���Ca���������%�����_�B��%����OFF����G��GM(�����G&(�
F�����%������
	����B��%��������B��T�
��C���y�������(��
���h�+%�C�
sourcetypeC�
������d�(��C�	buffering��C�
��������%����OFF����G_��%����ON����G ��UNTABLESUSEDATABLESUSEDI
NDECURSORS
ADECURSORSCDATAENVREFTHISOLDTALK
USEDATAENVTHISFORMDATAENVIRONMENTTHISFORMSETALIAS	BASECLASSPREVIEWMODEOLDSETDELETEOLDREPROCESS	NWORKAREALAUTOBUFFEROLDBUFFERING
OLDMULTILOCKSOLDSETFIELDS
buttonrefresh,��initvars8��
updaterowsA
��
setcaption���
setallpropw��
navrefresh.��
getgridref���addrec� ��printrpt�4��navigate�8��Refreshz:��Init�;��Error�@��Destroy�B��13�A�qqq��26�����"�a����da����Q����q�A��A�q!AAA�Q��&�A�A
�AAAAAAA2���ACAAAA�BAA�AAAbaB��QAA3~�q�����A��!�AA!�AAAA�A������BA�AA�$A���QAA��AA�����QAAAAAAA�Q�AAQA�R��AA�QAAAA#��������!����Q��R�QA�A�AAA�!AA��!�ABR��3�����A3q���A�A1�A��A��s��sB��EA3�!�2�A��A���QA���AAAQAB"!!!�qr�AA�!�qQqqqq��RA���C�A�A�A"�3������1qqAAAAAAAA3�11q�qA��"�c�q�R�R�R�qa!��Q�!a!A�A���AAA���qAqA�1!A�������A�1���A���A������!AAA����AAS�AR�A��qA�1�A�!�q�qq��qAQ�1
qAQ�
qAQ����A��A����qA�qa��A�A"!!!q�AqA��BQA����1AA������A�����!A���A1���qAAAA���qA3u�������Q�QA�1��!�A����AA�q��AAAAA���!���AAA�A��AB�A3q��qA��A���Q�����A�����A��A�3������A37�AA�a!�1A��!�b�A��A��qA�����������a�A2��rAB��QA��!C3���!���AAAA2AARAA�3���AAaA����Q���A���IAAAAAraA�a��AABAAD���AAraAbaA2���b�$���$&C�"&�-R�-�6�Z�679�qT9�Z	I�Z�a'��a�cr�d�e���e�m���m�p���p�x)�OyPROCEDURE buttonrefresh
* This is a generic routine which refreshes the buttons
* for appropriate table environments.
IF SELECT()# THIS.nWorkArea
	SELECT (THIS.nWorkArea)
ENDIF

THIS.SetAllProp()
THIS.cmdFind.Enabled = !THIS.EditMode
THIS.cmdPrint.Enabled =  !THIS.EditMode
THIS.cmdExit.Enabled =  !THIS.EditMode
THIS.cmdDelete.Enabled =  !THIS.EditMode AND !ISREADONLY()
THIS.SetCaption()
ENDPROC
PROCEDURE initvars
						
#DEFINE C_NOUPDATEVIEW_LOC	"Edits to one or more of the Views may not be permanent. "+;
							"To remedy this, ensure the View's Send SQL Updates checkbox is checked in the View Designer."
#DEFINE C_READONLY_LOC		"The table is Read-Only. You will not be able to edit it."

LOCAL aTablesUsed,nTablesUsed,i,aMems,nTotMem,cWizFile,lShowedMess,cDataEnvRef
DIMENSION aTablesUsed[1]
DIMENSION aMems[1]

* This routine sets the member variables
THIS.ViewKey = ""
THIS.ParentKey = ""
THIS.ViewType = 3
THIS.GridAlias = ""
THIS.TopFile = .F.
THIS.EndFile = .F.
THIS.AddMode = .F.

THIS.nWorkArea = SELECT(0)
THIS.oldSetDelete = SET("DELETED")
SET DELETED ON
THIS.oldReprocess = SET("REPROCESS")
SET REPROCESS TO 0
THIS.oldMultiLocks = SET("MULTILOCKS")
THIS.oldSetFields = SET("FIELDS")

* These properties should not be used. They are reserved for use by
* the Preview button of the Form Wizards.
THIS.PreviewMode = IIF(TYPE("THIS.PreviewMode")#"L",.F.,THIS.PreviewMode)
THIS.PreviewInit = IIF(TYPE("THIS.PreviewInit")#"L",.T.,THIS.PreviewInit)

* Check for data environment
DO CASE
CASE TYPE("THISFORM.DataEnvironment") = "O"
	THIS.UseDataEnv = .T.
	nTotMem = AMEMBERS(aMems,THISFORM.DataEnvironment,2)
	cDataEnvRef = "THISFORM.DataEnvironment"
CASE TYPE("THISFORMSET.DataEnvironment") = "O"
	THIS.UseDataEnv = .T.
	nTotMem = AMEMBERS(aMems,THISFORMSET.DataEnvironment,2)
	cDataEnvRef = "THISFORMSET.DataEnvironment"
	IF TYPE("THISFORM")="O" AND !THISFORM.VISIBLE 
		THISFORM.VISIBLE = .T.
	ENDIF
OTHERWISE
	THIS.UseDataEnv = .F.
ENDCASE

IF THIS.UseDataEnv
	WITH EVAL(m.cDataEnvRef)
		* Check for relation
		FOR i = 1 TO m.nTotMem
			IF UPPER(EVAL("."+aMems[m.i]+".BaseClass")) = "RELATION"
				THIS.oDataRelation = m.cDataEnvRef+"."+aMems[m.i]
				EXIT
			ENDIF
		ENDFOR
		
		* Check for Views
		FOR i = 1 TO m.nTotMem
			IF UPPER(EVAL("."+aMems[m.i]+".BaseClass")) = "CURSOR"
				WITH EVAL("."+aMems[m.i])
					IF CURSORGETPROP("SourceType",.Alias)#3 AND ;
						!CURSORGETPROP("offline",.Alias)
						* Check if we need to requery for deleted records.
						* -- Note: Parameterized views are not requeried so all
						* records will be brought over. To remedy this situation
						* you can place a SET DELETED ON command in the
						* BeforeOpenTables event of the DataEnvironment.
						IF THIS.oldSetDelete = "OFF" AND ATC("?",CURSORGETPROP("SQL",.Alias))=0
							=REQUERY(.Alias)
						ENDIF
						* Check if updates are made
						IF !CURSORGETPROP("SendUpdates",.Alias) AND !m.lShowedMess
							=MESSAGEBOX(C_NOUPDATEVIEW_LOC)
							lShowedMess = .T.
						ENDIF
					ENDIF
				ENDWITH
			ENDIF
		ENDFOR
	ENDWITH
ENDIF

THIS.EditMode = IIF(TYPE("THIS.EditMode")#"L",.F.,THIS.EditMode)

IF ISREADONLY()
	WAIT WINDOW C_READONLY_LOC TIMEOUT 2
	THIS.EditMode = .F.
ENDIF

* Disable appropriate buttons
THIS.cmdAdd.Enabled = !ISREADONLY()
THIS.cmdEdit.Enabled = !ISREADONLY()
THIS.cmdDelete.Enabled = !ISREADONLY()

IF THIS.PreviewMode
	RETURN
ENDIF

THIS.GetGridRef()

IF (THIS.UseDataEnv AND !THIS.lAutoBuffer) OR EMPTY(ALIAS())
	RETURN
ENDIF

* The following code is here to support forms not using a DataEnvironment or 
* where there is no data buffering.

THIS.oldBuffering=CursorGetProp("buffering")
IF THIS.oldBuffering#1
	RETURN
ENDIF

SET MULTILOCKS ON
SET FIELDS OFF

m.nTablesUsed = AUSED(aTablesUsed)
FOR i = 1 TO m.nTablesUsed
	IF CursorGetProp('sourcetype',aTablesUsed[m.i,1])=3	&&skip for views
		CursorSetProp("buffering",5,aTablesUsed[m.i,1])	&&optimistic table buffering
	ENDIF
ENDFOR

ENDPROC
PROCEDURE updaterows
#DEFINE	E_FAIL_LOC			"Failed to update table: "
#DEFINE E_PRIMARYKEY_LOC	"Unique primary key violation."
#DEFINE	E_TRIGGERFAIL_LOC	"Trigger failed."
#DEFINE	E_FIELDNULL_LOC		"Field doesn't accept NULL"
#DEFINE	E_FIELDRULE_LOC		"Field rule violated"
#DEFINE	E_RECORDLOCK_LOC	"Record in use by another user"
#DEFINE	E_ROWRULE_LOC		"Row rule violated"
#DEFINE	E_UNIQUEINDEX_LOC	"Unique index violation"
#DEFINE	E_DIRTYREC_LOC		"Data has been changed by another user. Overwrite changes with your edits?"
#DEFINE	E_NOFORCE_LOC		"Could not force table updates."
#DEFINE E_PROMPT_LOC	 	"Error: "
#DEFINE MSGBOX_YES			6

LOCAL aErrors,cErrorMessage,aTablesUsed,nTablesUsed,nTotErr 
LOCAL nFld,i,nOldArea,lSuccess,lInDBC,lOverwrite,lHadMessage
LOCAL oRel,cChildAlias,cPapaAlias,lnChildFirst,lChildFirst

DIMENSION aTablesUsed[1]
DIMENSION aErrors[1]
m.cErrorMessage=""
m.lSuccess = .T.
m.nOldArea = SELECT()
m.nTablesUsed = AUSED(aTablesUsed)

* Need to sort in proper order in case of DBC triggers
* Insert - parent must go first
* Delete/Updates - child must go first
lnChildFirst=0
IF !EMPTY(THIS.ChildAlias) AND !EMPTY(THIS.ParentAlias)
	FOR i = 1 TO m.nTablesUsed
		IF UPPER(aTablesUsed[m.i,1])==UPPER(THIS.ChildAlias)
			lnChildFirst=1
			EXIT
		ENDIF
		IF UPPER(aTablesUsed[m.i,1])==UPPER(THIS.ParentAlias)
			lnChildFirst=2
			EXIT			
		ENDIF
	ENDFOR
ENDIF

* Can wrap everything in transaction if using strictly DBCs
FOR i = 1 TO m.nTablesUsed
	SELECT (aTablesUsed[m.i,1])

	m.lInDBC = !EMPTY(CURSORGETPROP("Database"))
	m.cErrorMessage = ""
	m.lOverwrite = .F.
	m.lHadMessage = .F.

	DO CASE
	CASE CURSORGETPROP("Buffering") = 1
		* Skip if buffering not on
		LOOP
	CASE GetFldState(0) = 2			&&deleted record
		* Only delete current record and force it
		m.lSuccess = TableUpdate(.F.,.T.)
		IF m.lSuccess				&&successful update
			LOOP
		ENDIF
	CASE !m.lInDBC AND (ATC("2",GetFldState(-1))#0 OR;
		 ATC("3",GetFldState(-1))#0)	
		* Field was edited - in Free Table
		* Since free tables are not supported by transactions,
		* we must process record by record
		m.nModRecord = GetNextMod(0)
		DO WHILE m.nModRecord # 0	&&loop locks all records
			GO m.nModRecord
			m.lSuccess = RLOCK()	&&try to lock record
			IF !m.lSuccess			&&failed to lock record
				m.cErrorMessage = E_RECORDLOCK_LOC
				UNLOCK ALL
				EXIT
			ENDIF
			IF !m.lHadMessage	&&so we don't repeat alert
				* See if record(s) modified by another user
				FOR m.nFld = 1 TO FCOUNT()
					IF TYPE(FIELD(m.nFld)) = "G"	&&skip for General fields
						LOOP					
					ENDIF
					IF OLDVAL(FIELD(m.nFld)) # CURVAL(FIELD(m.nFld))
						m.lHadMessage = .T.
						IF MESSAGEBOX(E_DIRTYREC_LOC,4+48) = MSGBOX_YES
							m.lOverwrite = .T.
						ELSE
							m.lSuccess = .F.
							UNLOCK ALL
							EXIT
						ENDIF
					ENDIF
				ENDFOR
			ENDIF
			m.nModRecord = GetNextMod(m.nModRecord)
		ENDDO
		IF m.lSuccess 	&&was able to lock all records
			m.lSuccess = TableUpdate(.T.,m.lOverwrite)
			IF m.lSuccess &&was able to update all records
				LOOP
			ENDIF	
			UNLOCK ALL
		ENDIF
	CASE m.lInDBC
	
		BEGIN TRANSACTION

	    * Need to sort in proper order in case of DBC triggers
	    * Insert - parent must go first
	    * Delete/Updates - child must go first
		IF lnChildFirst=1  &&child first
			SELECT (THIS.ParentAlias)
			m.lSuccess = TableUpdate(.T.,.F.)	&&successful update
			lnChildFirst=0
			SELECT (aTablesUsed[m.i,1])
		ENDIF
		
		* Try to update all records in selected table
		m.lSuccess = TableUpdate(.T.,.F.)	&&successful update
		IF m.lSuccess
			END TRANSACTION
			LOOP
		ENDIF
		ROLLBACK
	ENDCASE

	* Handle errors
	nTotErr =AERROR(aErrors)
	DO CASE
	CASE nTotErr = 0
	CASE aErrors[1,1] = 1547				&& Unique primary key violation
		m.cErrorMessage = E_PRIMARYKEY_LOC
	CASE aErrors[1,1] = 1539				&& Trigger failed
		m.cErrorMessage = E_TRIGGERFAIL_LOC
	CASE aErrors[1,1] = 1581				&& Field doesn't accept NULL
		m.cErrorMessage = E_FIELDNULL_LOC
	CASE aErrors[1,1] = 1582				&& Field rule violated
		m.cErrorMessage = E_FIELDRULE_LOC
	CASE aErrors[1,1] = 1700				&& Record in use by another user
		m.cErrorMessage = E_RECORDLOCK_LOC
	CASE aErrors[1,1] = 1583				&& Row rule violated
		m.cErrorMessage = E_ROWRULE_LOC
	CASE aErrors[1,1] = 1884				&& Unique index violation
		m.cErrorMessage = E_UNIQUEINDEX_LOC
	CASE aErrors[1,1] = 1585				&& Record changed by another user

		IF m.lInDBC		&&handle free tables above
			* Display conflict alert
			IF MESSAGEBOX(E_DIRTYREC_LOC,4+48) = MSGBOX_YES
				*Try to force update
				BEGIN TRANSACTION				
				m.lSuccess = TABLEUPDATE(.T.,.T.)
				IF m.lSuccess
					END TRANSACTION
					LOOP
				ELSE
					ROLLBACK
					=MESSAGEBOX(E_NOFORCE_LOC)
				ENDIF			
			ENDIF
		ENDIF

	OTHERWISE
		IF !EMPTY(m.cErrorMessage)	&&for free table handling above
			m.cErrorMessage = E_PROMPT_LOC+aErrors[1,2]
		ENDIF
	ENDCASE

	* Had an error we couldn't handle
	TABLEREVERT(.T.)  &&revert all records
	m.lSuccess = .F.
	IF !EMPTY(m.cErrorMessage)
		MESSAGEBOX(E_FAIL_LOC+m.cErrorMessage)
	ENDIF

ENDFOR

UNLOCK ALL &&  New code

SELECT (m.nOldArea)
RETURN m.lSuccess

ENDPROC
PROCEDURE setcaption
#DEFINE ADD_CAPTION_LOC		"\<Add"
#DEFINE EDIT_CAPTION_LOC	"\<Edit"
#DEFINE REV_CAPTION_LOC		"\<Revert"
#DEFINE SAVE_CAPTION_LOC	"\<Save"

IF THIS.EditMode
	THIS.cmdAdd.Caption = SAVE_CAPTION_LOC
	THIS.cmdEdit.Caption = REV_CAPTION_LOC
ELSE
	THIS.cmdAdd.Caption = ADD_CAPTION_LOC
	THIS.cmdEdit.Caption = EDIT_CAPTION_LOC
ENDIF

ENDPROC
PROCEDURE setallprop
LPARAMETER oContainer

* Checks for General fields
LOCAL i,oControlParent,nCtrlCount

IF PARAMETERS() = 0
	m.oControlParent = THISFORM
ELSE
	m.oControlParent = m.oContainer
ENDIF

DO CASE 
CASE ATC("Pageframe",m.oControlParent.BaseClass)#0
	nCtrlCount = oControlParent.PageCount
CASE ATC(m.oControlParent.BaseClass,"Optiongroup,Commandgroup")#0
	nCtrlCount = oControlParent.ButtonCount
OTHERWISE
	nCtrlCount = oControlParent.ControlCount
ENDCASE

FOR i = 1 TO m.nCtrlCount 
	DO CASE
	CASE ATC("Pageframe",m.oControlParent.BaseClass)#0
		THIS.SetAllProp(m.oControlParent.Pages[m.i])
		
	CASE ATC(m.oControlParent.BaseClass,"Optiongroup,Commandgroup")#0 AND ;
		THIS.UserControlMode
		m.oControlParent.Buttons[m.i].Enabled = THIS.EditMode

	CASE ATC(m.oControlParent.Controls[m.i].BaseClass,"Optiongroup,Commandgroup")#0 ;
		AND THIS.UserControlMode
		THIS.SetAllProp(m.oControlParent.Controls[m.i])

	CASE ATC("Container",m.oControlParent.Controls[m.i].BaseClass) # 0 OR; 
		ATC("Page",m.oControlParent.Controls[m.i].BaseClass) # 0
		THIS.SetAllProp(m.oControlParent.Controls[m.i])

	CASE ATC(m.oControlParent.Controls[m.i].BaseClass,"ListBox,ComboBox,Spinner") # 0 AND;
		THIS.UserControlMode
		m.oControlParent.Controls[m.i].Enabled = THIS.EditMode

	CASE ATC(m.oControlParent.Controls[m.i].BaseClass,"OleBoundControl") # 0
		m.oControlParent.Controls[m.i].Enabled = THIS.EditMode

	CASE ATC(m.oControlParent.Controls[m.i].BaseClass,"CheckBox,TextBox,EditBox") # 0
		m.oControlParent.Controls[m.i].ReadOnly = !THIS.EditMode

	CASE ATC(m.oControlParent.Controls[m.i].BaseClass,"Grid") # 0
		m.oControlParent.Controls[m.i].ReadOnly = !THIS.EditMode
	* This Deletemark setting may need to be disabled if you have a trigger
	* on your child table (Restrict Delete).
	*	m.oControlParent.Controls[m.i].DeleteMark = THIS.EditMode
		
	ENDCASE
ENDFOR

ENDPROC
PROCEDURE navrefresh
**** Navigational Button Handling ****
LOCAL OldLockScreen,KeyValue,cFiltExpr
m.OldLockScreen = THISFORM.LockScreen
THISFORM.LockScreen = .T.

IF SELECT()#THIS.nWorkArea
	SELECT (THIS.nWorkArea)
ENDIF

IF !THIS.EditMode AND !EMPTY(ALIAS())

	* Check for bottom of file
	THIS.EndFile = EOF() OR THIS.EndFile

	* Test to see we are on last record
	IF !THIS.EndFile
		SKIP
		THIS.EndFile = EOF()
		SKIP -1
	ELSE
		GO BOTTOM
	ENDIF

	* Check for top of file
	THIS.TopFile = BOF() OR EOF() OR THIS.TopFile

	* Test to see if we are on first record
	IF !THIS.TopFile
		SKIP -1
		THIS.TopFile = BOF()
		IF !THIS.TopFile
			SKIP
		ENDIF	
	ENDIF

	IF THIS.TopFile
		GO TOP
	ENDIF

ENDIF

THIS.cmdTop.Enabled = !THIS.TopFile AND !THIS.EditMode
THIS.cmdPrev.Enabled = !THIS.TopFile AND !THIS.EditMode
THIS.cmdNext.Enabled = !THIS.EndFile AND !THIS.EditMode
THIS.cmdEnd.Enabled = !THIS.EndFile AND !THIS.EditMode

* Check if no records in query set
DO CASE
CASE THIS.PreviewMode OR ISREADONLY()
	* Nothing
CASE THIS.EditMode AND CURSORGETPROP("BUFFERING")=1
	THIS.cmdEdit.Enabled = .F.
CASE THIS.EditMode
	THIS.cmdEdit.Enabled = .T.
CASE RECCOUNT()=0 OR BOF() OR EOF()
	THIS.cmdEdit.Enabled = .F.
	THIS.cmdDelete.Enabled = .F.
CASE !THIS.cmdEdit.Enabled
	THIS.cmdEdit.Enabled = .T.
	THIS.cmdDelete.Enabled = .T.
ENDCASE


* Update Grid for Views
IF !THIS.EditMode AND !EMPTY(THIS.ViewKey)
	KeyValue = EVAL(THIS.ParentKey)
	DO CASE
	CASE TYPE(THIS.ParentKey) = "C"
		cFiltExpr = THIS.ViewKey + "=" + "["+m.KeyValue+"]"
	CASE TYPE(THIS.ParentKey) = "L"
		cFiltExpr = THIS.ViewKey
	CASE TYPE(THIS.ParentKey) = "D"
		cFiltExpr = THIS.ViewKey + "=" + "{"+DTOC(m.KeyValue)+"}"	
	CASE TYPE(THIS.ParentKey) = "T"
		cFiltExpr = THIS.ViewKey + "=" + "{"+TTOC(m.KeyValue)+"}"	
	OTHERWISE	
		* Numeric
		cFiltExpr = THIS.ViewKey + "=" + ALLTRIM(STR(m.KeyValue,20,18))
	ENDCASE
		
	SELECT (THIS.GridAlias)
	DO CASE
	CASE .F. &&parameterized query
		* set parameter here
		* =requery()
	CASE THIS.ViewType = 1	&&local views
		SET FILTER TO &cFiltExpr
	CASE THIS.ViewType = 2	&&remote views
		SET FILTER TO &cFiltExpr
	ENDCASE
	SELECT (THIS.nWorkArea)
ENDIF

THISFORM.LockScreen = m.OldLockScreen
THISFORM.Refresh()

ENDPROC
PROCEDURE getgridref
* Check if we have a grid
LOCAL aMems,nTotMem,i
THIS.GridRef = ""
IF TYPE("THISFORM") = "O"
	DIMENSION aMems[1]
	nTotMem = AMEMBERS(aMems,THISFORM,2)
	WITH THISFORM
		FOR i = 1 TO m.nTotMem 
			IF UPPER(EVAL("."+aMems[m.i]+".BaseClass")) = "GRID"
				THIS.GridRef = aMems[m.i]
				WITH EVAL("."+THIS.GridRef)
					* Check if we have a view and get Tag property
					THIS.ViewType = CURSORGETPROP('sourcetype',.RecordSource)
					THIS.GridAlias = .RecordSource
					IF THIS.ViewType # 3
						THIS.ViewKey = .Tag
						THIS.ParentKey = .Comment
					ENDIF
				ENDWITH				
				EXIT
			ENDIF
		ENDFOR
	ENDWITH
ENDIF

ENDPROC
PROCEDURE addrec
#DEFINE OPT_CANCEL			0
#DEFINE OPT_ADD_PARENT		1
#DEFINE OPT_ADD_CHILD		2
#DEFINE OPT_ADD_BOTH		3
#DEFINE MB_Q_YESNO			36
#DEFINE MB_A_YES			6

#DEFINE C_KEYFLDNOUPDATE_LOC	"The field relating the grid's view to the parent data source is not updatable. "+;
	"Do you just want to add a new record to the parent table?"
#DEFINE C_BADCHILDKEY_LOC		"The fields relating the parent and child tables are not the same data type. "+;
	"Do you just want to add a new record to the parent table?"
#DEFINE C_NOCHILDUPDATE_LOC		"The child data source is a view and does not send updates. "+;
	"Do you just want to add a new record to the parent table?"
#DEFINE C_NOOBJ_LOC		"Failed create the Add Record form class. Check or reinstall your WIZBTNS.VCX file."
#DEFINE C_NOUPDATE_LOC	"You cannot add a new record because the view(s) selected does not send updates."
#DEFINE C_NOUPDATE2_LOC	"You cannot add a new record because the view(s) selected does not send updates and the child data source has a primary key."

LOCAL oSearchDlog,oAddRec,cChildAlias,cPapaAlias,i,lPrimeKey,nPapakey
LOCAL cPapaKey,cChildKey,nSaveSess,oRel,cTagName,lBadViewKey,nSaveRec,nSaveRec2
LOCAL lBadChildKey,lUpdatableParentKey,lNoSendParentUpdates,lNoSendChildUpdates
LOCAL lcSaveData,loAddRec,loCustom,aFoxErr,nSaveArea

IF EMPTY(ALIAS())
	RETURN .F.
ENDIF

THIS.OldAlias = ALIAS()	&&save alias in case reverting
THIS.OldRec = RECNO()	&&save record in case reverting

IF EMPTY(THIS.GridRef)		&& not using Grid object
	
	DO CASE
	CASE CURSORGETPROP("SourceType")#3 AND ;
	  !CURSORGETPROP("offline") AND ;
	  !CURSORGETPROP("SendUpdates")
		MESSAGEBOX(C_NOUPDATE_LOC)
		RETURN .F.
	CASE EMPTY(CURSORGETPROP("database")) 
		* Free table
		APPEND BLANK
	CASE CURSORGETPROP("SourceType")#3
		* View
		APPEND BLANK
	CASE CURSORGETPROP("buffering")#1 AND !THIS.lPromptKey
		* buffered data
		APPEND BLANK
	OTHERWISE
		lcSaveData = SET("DATABASE")
		SET DATABASE TO CURSORGETPROP("database")
		cPapaKey = DBGETPROP(CURSORGETPROP("sourcename"),"Table","PrimaryKey")
		nPapaKey = TAGNO(cPapaKey)
		SET DATABASE TO &lcSaveData
		IF EMPTY(cPapakey) OR nPapaKey=0
			APPEND BLANK
		ELSE
			cPapaKey = KEY(m.nPapaKey)
			loAddRec=NewObject("AddRecord",THIS.ClassLibrary,"")
			loCustom = Create('custom')
			loAddRec.cKeyField = m.cPapaKey
			loAddRec.cKeyValue = EVAL(m.cPapaKey)
			loAddRec.oRetValue = loCustom
			loAddRec.Show()
			IF loCustom.nBtnAction=1
				INSERT INTO (ALIAS()) ((m.cPapaKey)) VALUES(loCustom.cKeyValue)
			ELSE
				THIS.HadError = .T.	
			ENDIF
		ENDIF
	ENDCASE
	
	IF THIS.HadError
		THIS.HadError = .F.
		SELECT (THIS.OldAlias)
		GO THIS.OldRec 
		RETURN .F.
	ENDIF
	RETURN .T.
ENDIF

** Code for adding record
lPrimeKey = .F.				&&is child key primary index
IF !EMPTY(THIS.oDataRelation)
	oRel = EVAL(THIS.oDataRelation)
ENDIF

** Get alias and key information	
DO CASE
CASE TYPE("m.oRel") = "O"	&&data environment
	WITH oRel
		cPapaAlias = .ParentAlias
		cPapaKey = .RelationalExpr
		cChildAlias = .ChildAlias
		cChildKey = .ChildOrder
	ENDWITH
	oRel = .NULL.	&&reset
CASE !EMPTY(THIS.ViewKey)	&&using views
	cPapaAlias = ALIAS()
	cPapaKey = THIS.ParentKey
	cChildAlias = THIS.GridAlias
	cChildKey = THIS.ViewKey
	
	* Need to check if Key field is updatable
	IF CURSORGETPROP("SourceType",m.cChildAlias)#3 AND !CURSORGETPROP("offline",m.cChildAlias) AND ;
		ATC(","+m.cChildKey+",",","+CURSORGETPROP("UpdatableFieldList",m.cChildAlias)+",")=0
		lBadViewKey = .T.
	ENDIF
OTHERWISE
	cPapaAlias = ALIAS()
	cPapaKey = RELATION(1)
	cChildAlias = THIS.GridAlias
	cChildKey = ORDER(m.cChildAlias)
ENDCASE

THIS.ChildAlias = cChildAlias
THIS.ParentAlias = cPapaAlias

** Test to see if both keys are of the same data type
SELECT (THIS.GridAlias)
cGridKeyType = ""

IF EMPTY(THIS.ViewKey) AND !EMPTY(m.cChildKey)	&&regular table used 
	* Get the Child Key field since only index tag is here
	* if these is an expression, then default to blank.
	cTagName = ""
	FOR i = 1 TO TagCount("")
		IF UPPER(TAG(m.i)) == UPPER(m.cChildKey)
			cTagName = KEY(m.i)
			lPrimeKey = PRIMARY(m.i)
			EXIT
		ENDIF
	ENDFOR
	
	* Check if we have an index expression here.
	IF ATC("(",m.cTagName)#0 OR ATC("+",m.cTagName)#0 
		cChildKey = ""
	ELSE
		cChildKey = m.cTagName
		cGridKeyType = TYPE(m.cChildKey)
	ENDIF
ENDIF

IF CURSORGETPROP("SourceType",m.cPapaAlias)#3 AND !CURSORGETPROP("offline",m.cPapaAlias) AND ;
 !CURSORGETPROP("SendUpdates",m.cPapaAlias)
	lNoSendParentUpdates = .T.
ENDIF
IF CURSORGETPROP("SourceType",m.cChildAlias)#3 AND !CURSORGETPROP("offline",m.cChildAlias) AND ;
 !CURSORGETPROP("SendUpdates",m.cChildAlias)
	lNoSendChildUpdates = .T.
ENDIF

* Check if have two views and both do not send updates	
IF m.lNoSendParentUpdates AND m.lNoSendChildUpdates
	=MESSAGEBOX(C_NOUPDATE_LOC)
	RETURN .F.
ENDIF

SELECT (THIS.OldAlias)
IF !EMPTY(m.cGridKeyType) AND m.cGridKeyType # TYPE(m.cPapaKey)
	lBadChildKey = .T.
ENDIF

* Handle appends here
DO CASE
CASE m.lNoSendParentUpdates AND (m.lBadViewKey OR m.lBadChildKey)
	=MESSAGEBOX(C_NOUPDATE_LOC)
	RETURN .F.
CASE m.lPrimeKey AND m.lNoSendParentUpdates
	=MESSAGEBOX(C_NOUPDATE2_LOC)
	RETURN .F.
CASE m.lNoSendChildUpdates	&&child view does not send updates
	IF MESSAGEBOX(C_NOCHILDUPDATE_LOC,MB_Q_YESNO) # MB_A_YES
		RETURN .F.
	ENDIF 
	APPEND BLANK
CASE m.lBadViewKey	&&view key in not updatable
	IF MESSAGEBOX(C_KEYFLDNOUPDATE_LOC,MB_Q_YESNO) # MB_A_YES
		RETURN .F.
	ENDIF
	APPEND BLANK
CASE m.lBadChildKey 	&&bad child key -- different data type from parent
	IF MESSAGEBOX(C_BADCHILDKEY_LOC,MB_Q_YESNO) # MB_A_YES
		RETURN .F.
	ENDIF
	APPEND BLANK
OTHERWISE
	* Need to check if Key field is updatable
	lUpdatableParentKey = .T.
	IF CURSORGETPROP("SourceType",m.cPapaAlias)#3 AND !CURSORGETPROP("offline",m.cPapaAlias) AND;
		ATC(","+m.cPapaKey+",",","+CURSORGETPROP("UpdatableFieldList",m.cPapaAlias)+",")=0
		* cPapaKey = ""
		lUpdatableParentKey = .F.
	ENDIF

	* Check for expression in cPapaKey if so, then do not update record with keyvalue
	IF ATC("(",m.cPapaKey)#0 OR ATC("+",m.cPapaKey)#0
		cPapaKey = ""
	ENDIF

	nSaveSess = SET("DATASESSION")
	oAddRec = CREATE("GridAddRec")
	IF TYPE("m.oAddRec") # "O"
		=MESSAGEBOX(C_NOOBJ_LOC)
		RETURN .F.
	ENDIF
	
	* Check if INSERT trigger on child and disable 3rd option
	IF !EMPTY(CURSORGETPROP("database"))
		lcSaveData = SET("DATABASE")
		SET DATABASE TO CURSORGETPROP("database")
		IF !EMPTY(DBGETPROP(CURSORGETPROP("sourcename",m.cChildAlias),"Table","InsertTrigger"))
			lUpdatableParentKey = .F.
		ENDIF
		SET DATABASE TO &lcSaveData
	ENDIF
	
	oAddRec.ChildPrimaryKey = m.lPrimeKey
	oAddRec.UpdatableParentKey = m.lUpdatableParentKey
	oAddRec.NoSendUpdates = m.lNoSendParentUpdates
	oAddRec.KeyField = m.cPapaKey
	oAddRec.KeyValue = 	IIF(!EMPTY(m.cPapaKey),EVAL(m.cPapaKey),"")
	oAddRec.RunAddForm()
	IF oAddRec.AddOption = OPT_CANCEL
		RETURN .F.
	ENDIF

	SET DATASESSION TO nSaveSess
	SELECT (THIS.OldAlias)
	
	IF TYPE("oAddRec.KeyValue") = "C"
		oAddRec.KeyValue = TRIM(oAddRec.KeyValue)
	ENDIF
	
	* Add record to parent table
	nSaveRec = RECNO()
	IF INLIST(oAddRec.AddOption,OPT_ADD_PARENT,OPT_ADD_BOTH)
		IF EMPTY(m.cPapaKey)
			APPEND BLANK IN (m.cPapaAlias)
		ELSE
			INSERT INTO (m.cPapaAlias) ((oAddRec.KeyField)) VALUES(oAddRec.KeyValue)
		ENDIF
	ENDIF
	nSaveRec2 = RECNO()

	* Add child record
	IF INLIST(oAddRec.AddOption,OPT_ADD_CHILD,OPT_ADD_BOTH)
		* Need to check for uniqueness. This will trigger error.
		GO m.nSaveRec
		IF THIS.HadError
			* Need to check for uniqueness violation and handle error (rollback)
			DIMENSION aFoxErr[1]
			IF AERROR(aFoxErr)#0 AND aFoxErr[1,1]=1884
				TABLEREVERT(.T.,m.cPapaAlias)
			ENDIF
		ELSE
			GO m.nSaveRec2
			IF EMPTY(m.cChildKey) OR ;
				TYPE(m.cChildAlias+"."+m.cChildKey) # TYPE("oAddRec.KeyValue")
				APPEND BLANK IN (m.cChildAlias)
			ELSE
				INSERT INTO (m.cChildAlias) ((m.cChildKey)) VALUES(oAddRec.KeyValue)
			ENDIF
			IF .F. &&!THIS.HadError
				nSaveArea=THIS.nWorkArea
				SELECT (m.cChildAlias)
				THIS.nWorkArea=SELECT()
				THIS.EditMode = !THIS.EditMode
				THIS.AddMode = THIS.EditMode
				THIS.TopFile = .F.
				THIS.ButtonRefresh()
				THIS.NavRefresh()
				THIS.nWorkArea=nSaveArea
				RETURN .F.
			ENDIF
  		ENDIF
	ENDIF
ENDCASE

IF THIS.HadError
	THIS.HadError = .F.
	SELECT (THIS.OldAlias)
	GO THIS.OldRec 
	RETURN .F.
ENDIF

ENDPROC
PROCEDURE printrpt
#DEFINE C_MAKEREPO_LOC			"Could not locate a report to print. Create new one?"
#DEFINE C_NOOPEN_LOC			"Error opening table. Unable to print report."
#DEFINE C_GETFILEPROMPT_LOC		"Pick report:"

LOCAL cRepName,nSaveSess,cSaveAlias,cSaveSource,cSaveData

cSaveAlias = ALIAS()
cSaveSource = CURSORGETPROP("SourceName")
cSaveData = CURSORGETPROP("Database")
cDiffSource = ""
cRepName = LEFT(ALIAS(),8)+".FRX"
nSaveSess = SET("DATASESSION")

IF TYPE("THISFORM.DataEnvironment") = "O"
	lPrivateSession = (THISFORM.DataSession = 2)
ELSE
	lPrivateSession = (THISFORMSET.DataSession = 2)
ENDIF

* Handling for Private data sessions
IF m.lPrivateSession
	IF m.nSaveSess # 1
		SET DATASESSION TO 1
		SELECT 0
		IF !EMPTY(m.cSaveData)
			OPEN DATABASE (m.cSaveData)
		ENDIF
		IF USED(m.cSaveAlias)
			SELECT (m.cSaveAlias)
			IF CURSORGETPROP("SourceName")#m.cSaveSource
				cDiffSource = CURSORGETPROP("SourceName")
				USE IN (m.cSaveAlias)
				SELECT 0
			ENDIF
		ENDIF	
		IF EMPTY(ALIAS())
			USE (m.cSaveSource) AGAIN ALIAS (m.cSaveAlias) SHARED
			IF EMPTY(ALIAS())
				=MESSAGEBOX(C_NOOPEN_LOC)
				RETURN
			ENDIF
		ENDIF
	ENDIF
ENDIF

IF FILE(m.cRepName)
	REPORT FORM (m.cRepName) PREVIEW NOWAIT
ELSE
	m.cRepName = GETFILE("frx",C_GETFILEPROMPT_LOC,"",1)
	IF !EMPTY(m.cRepName)
		IF FILE(m.cRepName)
			* User pressed Open button
			REPORT FORM (m.cRepName) PREVIEW NOWAIT
		ELSE
			* User pressed New button
			DO (_WIZARD) WITH "AUTOREPORT"
		ENDIF
	ENDIF
ENDIF

* Private data session code
IF m.lPrivateSession
	IF !EMPTY(cDiffSource)
		USE (m.cDiffSource) IN 0
	ENDIF
	SET DATASESSION TO m.nSaveSess
	SELECT (m.cSaveAlias)
ENDIF

IF THISFORM.ShowWindow = 2 
	Activate Window (THISFORM.Name)
ENDIF

ENDPROC
PROCEDURE navigate
LPARAMETER cDirection

SELECT (THIS.nWorkArea)
IF EMPTY(ALIAS())
	RETURN .F.
ENDIF

DO CASE
CASE ATC("TOP",cDirection)#0
	LOCATE
	THIS.TopFile = .T.
	THIS.EndFile = EOF()
CASE ATC("END",cDirection)#0
	GO BOTTOM
	THIS.TopFile = .F.
	THIS.EndFile = .T.
CASE ATC("NEXT",cDirection)#0
	IF !EOF()
		SKIP 1
	ENDIF
	THIS.TopFile = BOF()
	THIS.EndFile = EOF()
CASE ATC("PREV",cDirection)#0
	IF !BOF()
		SKIP -1
	ENDIF
	THIS.TopFile = BOF()
	THIS.EndFile = EOF()
ENDCASE

THIS.NavRefresh()

ENDPROC
PROCEDURE Refresh
**** Special Preview Mode Handling ****
IF THIS.PreviewMode AND THIS.PreviewInit
	THIS.PreviewInit = .F.
	THIS.cmdAdd.Enabled = .F.
	THIS.cmdEdit.Enabled = .F.
	THIS.cmdDelete.Enabled = .F.
	THIS.cmdFind.Enabled = .F.
	THIS.cmdPrint.Enabled = .F.
	THIS.cmdExit.Enabled = .F.
	THIS.nWorkArea = SELECT()
	THIS.GetGridRef()
	THIS.SetAllProp()
	THIS.NavRefresh()
ENDIF

ENDPROC
PROCEDURE Init
#DEFINE C_WIZSTYLE			"WIZBTNS.VCX"
#DEFINE C_WIZDIR 			"WIZARDS\"
#DEFINE C_PROMPT1_LOC		"Find: "
#DEFINE E_NOSTYLE_LOC		"The class library (WIZBTNS.VCX) needed by this form could not be found. "+;
							"Please locate."

LOCAL cGridRef,cWizHomePath,separator,cWizStyFile

IF TYPE('THIS.Parent') # "O"
	RETURN
ENDIF

IF SET("TALK") = "ON"
	SET TALK OFF
	THIS.oldTalk = "ON"
ELSE
	THIS.oldTalk = "OFF"
ENDIF


IF ATC(C_WIZSTYLE,SET("CLASSLIB")) = 0
	
	* Returns just the pathname
	cWizHomePath = _WIZARD
	IF '\' $ cWizHomePath
	   cWizHomePath = SUBSTR(m.cWizHomePath,1,RAT('\',m.cWizHomePath))
	   IF RIGHT(m.cWizHomePath,1) = '\' AND LEN(m.cWizHomePath) > 1 ;
	            AND SUBSTR(m.cWizHomePath,LEN(m.cWizHomePath)-1,1) <> ':'
	         cWizHomePath = SUBSTR(m.cWizHomePath,1,LEN(m.cWizHomePath)-1)
	   ENDIF
	ELSE
	   cWizHomePath = ''
	ENDIF

	* Add a backslash unless there is one already there.
	separator = IIF(_MAC,":","\")
	IF !(RIGHT(m.cWizHomePath,1) $ '\:') AND !EMPTY(m.cWizHomePath)
	   m.cWizHomePath= m.cWizHomePath+ m.separator
	ENDIF

	DO CASE
	CASE FILE(C_WIZSTYLE)
		cWizFile = C_WIZSTYLE
	CASE FILE(m.cWizHomePath+C_WIZSTYLE)
		cWizFile = m.cWizHomePath+C_WIZSTYLE
	CASE FILE(m.cWizHomePath+C_WIZDIR+C_WIZSTYLE)
		cWizFile = m.cWizHomePath+C_WIZDIR+C_WIZSTYLE	
	CASE FILE(HOME()+C_WIZSTYLE)
		cWizFile = HOME()+C_WIZSTYLE
	CASE FILE(HOME()+C_WIZDIR+C_WIZSTYLE)
		cWizFile = HOME()+C_WIZDIR+C_WIZSTYLE
	OTHERWISE
		=MESSAGEBOX(E_NOSTYLE_LOC)
		cWizFile = GETFILE("VCX",C_PROMPT1_LOC+C_WIZSTYLE)
	ENDCASE
	
	IF ATC(C_WIZSTYLE,m.cWizFile)#0
		SET CLASS TO (m.cWizFile) ADDITIVE
	ELSE
		* Failed to get WIZSTYLE.VCX file
		RETURN .F.
	ENDIF
	
ENDIF

THIS.InitVars()

IF THIS.lStartTop AND !EMPTY(ALIAS())
	GO TOP
ENDIF

THIS.ButtonRefresh()
THIS.NavRefresh()

cGridRef=THIS.GridRef
IF !EMPTY(m.cGridRef)
	* Change this if you desire to have the grid initially selected.
	* THISFORM.&cGridRef..SetFocus()
ENDIF

ENDPROC
PROCEDURE Error
Parameters nError, cMethod, nLine

#DEFINE	E_UNIQUEINDEX2_LOC	"Failed to add/update record(s) because of non uniqueness."

LOCAL aFoxErr,nTotErr
DIMENSION aFoxErr[1]
nTotErr = AERROR(aFoxErr)

THIS.Haderror = .T.

DO CASE
CASE INLIST(m.nError,1733,1734)  &&property not found -- traps SETALL()
	RETURN
CASE m.nError=1938  &&no parent
	RETURN
CASE nToterr>0 AND aFoxErr[1,1] = 1420
	* Corrupt Ole object in General field.
	MESSAGEBOX(aFoxErr[1,2])
	RETURN
CASE nToterr>0 AND aFoxErr[1,1] = 1884
	* Uniqueness ID error
	MESSAGEBOX(E_UNIQUEINDEX2_LOC)
	RETURN
ENDCASE

**** Error Dialog ******
MESSAGEBOX(MESSAGE(1)+CHR(13)+;
	"Error: "+STR(nError)+CHR(13)+;
	MESSAGE()+CHR(13)+;
	"Method: "+cMethod+CHR(13)+;
	"Line: "+STR(nLine))

ENDPROC
PROCEDURE Destroy
* Restore various settings
LOCAL nTablesUsed,aTablesUsed,i,nDECursors,aDECursors,cDataEnvRef 
DIMENSION aTablesUsed[1]

IF TYPE('THIS.Parent') # "O"
	RETURN
ENDIF

IF TYPE("THIS.oldTalk") = "C" AND THIS.oldTalk="ON"
	SET TALK ON
ENDIF

IF THIS.UseDataEnv
	DIMENSION aDECursors[1]
	DO CASE
	CASE TYPE("THISFORM.DataEnvironment") = "O"
		nDECursors = AMEMBERS(aDECursors,THISFORM.DataEnvironment,2)
		cDataEnvRef = "THISFORM.DataEnvironment"
	CASE TYPE("THISFORMSET.DataEnvironment") = "O"
		nDECursors = AMEMBERS(aDECursors,THISFORMSET.DataEnvironment,2)
		cDataEnvRef = "THISFORMSET.DataEnvironment"
	ENDCASE
	FOR i = 1 TO m.nDECursors
		WITH EVAL(m.cDataEnvRef + "." + aDECursors[m.i])
			IF USED(.ALIAS) AND ATC("CURSOR",.BaseClass)#0 AND ;
			  CursorGetProp("sourcetype",.ALIAS)=3 AND ;
			  CursorGetProp("buffering",.ALIAS)>1
				TableRevert(.T.,.ALIAS)
				* If your form has General fields, there is a possibility
				* that certain OLE Servers supporting the General fields
				* can send data back to General fields even though they
				* are not in Edit Mode. If you experience problems in
				* closing the form because of thie, you might want to
				* uncomment the line below to resolve this. 
				*
				* CursorSetProp("buffering",1,.ALIAS)	&&optimistic table buffering
			ENDIF
		ENDWITH
	ENDFOR
ENDIF

* Skip if using preview mode
IF THIS.PreviewMode
	RETURN
ENDIF

IF THIS.oldSetDelete = "OFF"
	SET DELETED OFF
ENDIF
SET REPROCESS TO THIS.oldReprocess
SET MESSAGE TO
SELECT (THIS.nWorkArea)

IF THIS.UseDataEnv AND !THIS.lAutoBuffer
	RETURN
ENDIF

IF THIS.oldBuffering#1
	RETURN
ENDIF

* The following code is here to support
* forms not using a DataEnvironment.
m.nTablesUsed = AUSED(aTablesUsed)
FOR i = 1 TO m.nTablesUsed
	IF CursorGetProp('sourcetype',aTablesUsed[m.i,1])=3	&&skip for views
		CursorSetProp("buffering",THIS.oldBuffering,aTablesUsed[m.i,1])	&&optimistic table buffering
	ENDIF
ENDFOR

IF THIS.oldMultiLocks = "OFF"
	SET MULTILOCKS OFF
ENDIF

IF THIS.oldSetFields = "ON"
	SET FIELDS ON
ENDIF

ENDPROC
<
PROCEDURE initvars
#DEFINE C_NOUPDATEVIEW_LOC	"Edits to one or more of the Views may not be permanent. "+;
	"To remedy this, ensure the View's Send SQL Updates checkbox is checked in the View Designer."
#DEFINE C_READONLY_LOC		"The table is Read-Only. You will not be able to edit it."

LOCAL aTablesUsed,nTablesUsed,i,aMems,nTotMem,cWizFile,lShowedMess,cDataEnvRef
DIMENSION aTablesUsed[1]
DIMENSION aMems[1]

THIS.nWorkArea = SELECT(0)
THIS.oldSetDelete = SET("DELETED")
SET DELETED ON
THIS.oldReprocess = SET("REPROCESS")
SET REPROCESS TO 0
THIS.oldSetFields = SET("FIELDS")
THIS.oldMultiLocks = SET("MULTILOCKS")

* These properties should not be used. They are reserved for use by
* the Preview button of the Form Wizards.
THIS.PreviewMode = IIF(TYPE("THIS.PreviewMode")#"L",.F.,THIS.PreviewMode)
THIS.PreviewInit = IIF(TYPE("THIS.PreviewInit")#"L",.T.,THIS.PreviewInit)

* Check for data environment
DO CASE
CASE TYPE("THISFORM.DataEnvironment") = "O"
	THIS.UseDataEnv = .T.
	nTotMem = AMEMBERS(aMems,THISFORM.DataEnvironment,2)
	cDataEnvRef = "THISFORM.DataEnvironment"
CASE TYPE("THISFORMSET.DataEnvironment") = "O"
	THIS.UseDataEnv = .T.
	nTotMem = AMEMBERS(aMems,THISFORMSET.DataEnvironment,2)
	cDataEnvRef = "THISFORMSET.DataEnvironment"
	IF TYPE("THISFORM")="O" AND !THISFORM.VISIBLE 
		THISFORM.VISIBLE = .T.
	ENDIF
OTHERWISE
	THIS.UseDataEnv = .F.
ENDCASE

IF THIS.UseDataEnv
	WITH EVAL(m.cDataEnvRef)
		* Check for Views
		FOR i = 1 TO m.nTotMem
			IF UPPER(EVAL("."+aMems[m.i]+".BaseClass")) = "CURSOR"
				WITH EVAL("."+aMems[m.i])
					IF CURSORGETPROP("SourceType",.Alias)#3
						* Check if we need to requery for deleted records.
						* -- Note: Parameterized views are not requeried so all records will be brought over.
						* To remedy this situation you can place a SET DELETED ON command in the
						* BeforeOpenTables event of the DataEnvironment.
						IF THIS.oldSetDelete = "OFF" AND ATC("?",CURSORGETPROP("SQL",.Alias))=0
							=REQUERY(.Alias)
						ENDIF
						* Check if updates are made
						IF !CURSORGETPROP("SendUpdates",.Alias) AND !m.lShowedMess
							=MESSAGEBOX(C_NOUPDATEVIEW_LOC)
							lShowedMess = .T.
						ENDIF
					ENDIF
				ENDWITH
			ENDIF
		ENDFOR
	ENDWITH
ENDIF

IF ISREADONLY()
	WAIT WINDOW C_READONLY_LOC TIMEOUT 2
ENDIF

* Disable appropriate buttons
THIS.cmdAdd.Enabled = !ISREADONLY()
THIS.cmdDelete.Enabled = !ISREADONLY()

IF THIS.PreviewMode
	RETURN
ENDIF

IF (THIS.UseDataEnv AND !THIS.lAutoBuffer) OR EMPTY(ALIAS())
	RETURN
ENDIF

* The following code is here to support forms not using a DataEnvironment.

THIS.oldBuffering=CursorGetProp("buffering")
IF THIS.oldBuffering#1
	RETURN
ENDIF

SET FIELDS OFF
SET MULTILOCKS ON

m.nTablesUsed = AUSED(aTablesUsed)
FOR i = 1 TO m.nTablesUsed
	IF CursorGetProp('sourcetype',aTablesUsed[m.i,1])=3	&&skip for views
		CursorSetProp("buffering",5,aTablesUsed[m.i,1])	&&optimistic table buffering
	ENDIF
ENDFOR

ENDPROC
PROCEDURE updaterows
#DEFINE	E_FAIL_LOC			"Failed to update table: "
#DEFINE E_PRIMARYKEY_LOC	"Unique primary key violation."
#DEFINE	E_TRIGGERFAIL_LOC	"Trigger failed."
#DEFINE	E_FIELDNULL_LOC		"Field doesn't accept NULL"
#DEFINE	E_FIELDRULE_LOC		"Field rule violated"
#DEFINE	E_RECORDLOCK_LOC	"Record in use by another user"
#DEFINE	E_ROWRULE_LOC		"Row rule violated"
#DEFINE	E_UNIQUEINDEX_LOC	"Unique index violation"
#DEFINE	E_DIRTYREC_LOC		"Data has been changed by another user. Overwrite changes with your edits?"
#DEFINE	E_NOFORCE_LOC		"Could not force table updates."
#DEFINE E_PROMPT_LOC	 	"Error: "
#DEFINE MSGBOX_YES			6

LOCAL aErrors,cErrorMessage,aTablesUsed,nTablesUsed,nTotErr 
LOCAL nFld,i,nOldArea,lSuccess,lInDBC,lOverwrite,lHadMessage

DIMENSION aTablesUsed[1]
DIMENSION aErrors[1]
m.cErrorMessage=""
m.lSuccess = .T.
m.nOldArea = SELECT()
m.nTablesUsed = AUSED(aTablesUsed)

* Can wrap everything in transaction if using strictly DBCs

FOR i = 1 TO m.nTablesUsed

	SELECT (aTablesUsed[m.i,1])

	m.lInDBC = !EMPTY(CURSORGETPROP("Database"))
	m.cErrorMessage = ""
	m.lOverwrite = .F.
	m.lHadMessage = .F.

	DO CASE
	CASE CURSORGETPROP("Buffering") = 1
		* Skip if buffering not on
		LOOP
	CASE GetFldState(0) = 2			&&deleted record
		* Only delete current record and force it
		m.lSuccess = TableUpdate(.F.,.T.)
		IF m.lSuccess				&&successful update
			LOOP
		ENDIF
	CASE !m.lInDBC AND (ATC("2",GetFldState(-1))#0 OR;
		 ATC("3",GetFldState(-1))#0)	
		* Field was edited - in Free Table
		* Since free tables are not supported by transactions,
		* we must process record by record
		m.nModRecord = GetNextMod(0)
		DO WHILE m.nModRecord # 0	&&loop locks all records
			GO m.nModRecord
			m.lSuccess = RLOCK()	&&try to lock record
			IF !m.lSuccess			&&failed to lock record
				m.cErrorMessage = E_RECORDLOCK_LOC
				UNLOCK ALL
				EXIT
			ENDIF
			IF !m.lHadMessage	&&so we don't repeat alert
				* See if record(s) modified by another user
				FOR m.nFld = 1 TO FCOUNT()
					IF TYPE(FIELD(m.nFld)) = "G"	&&skip for General fields
						LOOP					
					ENDIF
					IF OLDVAL(FIELD(m.nFld)) # CURVAL(FIELD(m.nFld))
						m.lHadMessage = .T.
						IF MESSAGEBOX(E_DIRTYREC_LOC,4+48) = MSGBOX_YES
							m.lOverwrite = .T.
						ELSE
							m.lSuccess = .F.
							UNLOCK ALL
							EXIT
						ENDIF
					ENDIF
				ENDFOR
			ENDIF
			m.nModRecord = GetNextMod(m.nModRecord)
		ENDDO
		IF m.lSuccess 	&&was able to lock all records
			m.lSuccess = TableUpdate(.T.,m.lOverwrite)
			IF m.lSuccess &&was able to update all records
				LOOP
			ENDIF	
			UNLOCK ALL
		ENDIF
	CASE m.lInDBC
		BEGIN TRANSACTION
		* Try to update all records in selected table
		m.lSuccess = TableUpdate(.T.,.F.)	&&successful update
		IF m.lSuccess
			END TRANSACTION
			LOOP
		ENDIF
		ROLLBACK
	ENDCASE

	* Handle errors
	nTotErr =AERROR(aErrors)
	DO CASE
	CASE nTotErr = 0
	CASE aErrors[1,1] = 1547				&& Unique primary key violation
		m.cErrorMessage = E_PRIMARYKEY_LOC
	CASE aErrors[1,1] = 1539				&& Trigger failed
		m.cErrorMessage = E_TRIGGERFAIL_LOC
	CASE aErrors[1,1] = 1581				&& Field doesn't accept NULL
		m.cErrorMessage = E_FIELDNULL_LOC
	CASE aErrors[1,1] = 1582				&& Field rule violated
		m.cErrorMessage = E_FIELDRULE_LOC
	CASE aErrors[1,1] = 1700				&& Record in use by another user
		m.cErrorMessage = E_RECORDLOCK_LOC
	CASE aErrors[1,1] = 1583				&& Row rule violated
		m.cErrorMessage = E_ROWRULE_LOC
	CASE aErrors[1,1] = 1884				&& Unique index violation
		m.cErrorMessage = E_UNIQUEINDEX_LOC
	CASE aErrors[1,1] = 1585				&& Record changed by another user

		IF m.lInDBC		&&handle free tables above
			* Display conflict alert
			IF MESSAGEBOX(E_DIRTYREC_LOC,4+48) = MSGBOX_YES
				*Try to force update
				BEGIN TRANSACTION				
				m.lSuccess = TABLEUPDATE(.T.,.T.)
				IF m.lSuccess
					END TRANSACTION
					LOOP
				ELSE
					ROLLBACK
					=MESSAGEBOX(E_NOFORCE_LOC)
				ENDIF			
			ENDIF
		ENDIF

	OTHERWISE
		IF !EMPTY(m.cErrorMessage)	&&for free table handling above
			m.cErrorMessage = E_PROMPT_LOC+aErrors[1,2]
		ENDIF
	ENDCASE

	* Had an error we couldn't handle
	=TABLEREVERT(.T.)  &&revert all records
	m.lSuccess = .F.
	IF !EMPTY(m.cErrorMessage)
		=MESSAGEBOX(E_FAIL_LOC+m.cErrorMessage)
	ENDIF

ENDFOR

UNLOCK ALL &&  New code

SELECT (m.nOldArea)
RETURN m.lSuccess

ENDPROC
PROCEDURE addrec
#DEFINE C_NOUPDATE_LOC	"You cannot add a new record because the view(s) selected does not send updates."

IF EMPTY(ALIAS())
	RETURN .F.
ENDIF

LOCAL lnSaveRec,lcSaveData,loAddRec,loCustom,cPapaKey

IF EOF() OR BOF()
	GO TOP
ENDIF
lnSaveRec = RECNO()

DO CASE
CASE CURSORGETPROP("SourceType")#3 AND ;
  !CURSORGETPROP("offline") AND ;
  !CURSORGETPROP("SendUpdates")
	MESSAGEBOX(C_NOUPDATE_LOC)
	RETURN .F.
CASE EMPTY(CURSORGETPROP("database")) 
	* Free table
	APPEND BLANK
CASE CURSORGETPROP("SourceType")#3
	* View
	APPEND BLANK
CASE CURSORGETPROP("buffering")#1 AND !THIS.lPromptKey
	* buffered data
	APPEND BLANK
OTHERWISE
	lcSaveData = SET("DATABASE")
	SET DATABASE TO CURSORGETPROP("database")
	cPapaKey = DBGETPROP(CURSORGETPROP("sourcename"),"Table","PrimaryKey")
	SET DATABASE TO &lcSaveData
	IF EMPTY(cPapakey)
		APPEND BLANK
	ELSE
		loAddRec=NewObject("AddRecord",THIS.ClassLibrary,"")
		loCustom = Create('custom')
		loAddRec.cKeyField = cPapaKey
		loAddRec.cKeyValue = EVAL(cPapaKey)
		loAddRec.oRetValue = loCustom
		loAddRec.Show()
		IF loCustom.nBtnAction=1
			INSERT INTO (ALIAS()) ((cPapaKey)) VALUES(loCustom.cKeyValue)
		ELSE
			THIS.HadError = .T.	
		ENDIF
	ENDIF
ENDCASE

IF THIS.HadError
	THIS.HadError = .F.
	GO lnSaveRec
	RETURN .F.
ENDIF

THISFORM.Refresh()
ENDPROC
PROCEDURE deleterec
#DEFINE MSGBOX_YES		6
#DEFINE C_MSGBOX1		36
#DEFINE C_DELETE_LOC	"Do you want to delete this record?"

IF EMPTY(ALIAS())
	RETURN .F.
ENDIF

IF MESSAGEBOX(C_DELETE_LOC,C_MSGBOX1) = MSGBOX_YES
	DELETE
	IF THIS.UpdateRows()  &&success
		* Success
		IF !EOF()
			SKIP 1
		ENDIF
		IF EOF() AND !BOF()
			SKIP -1
		ENDIF
	ENDIF
	THISFORM.REFRESH()
ENDIF

IF THISFORM.ShowWindow = 2
	Activate Window (THISFORM.Name)
ENDIF

ENDPROC
PROCEDURE checkerror
#DEFINE ERR_UNIQUEKEY3_LOC  "A unique key error violation has occurred. That record will be reverted."
#DEFINE ERR_RVIEWUPDATE_LOC "A problem occurred updating the remote data. That record will be reverted."

AERROR(aGetErrors)

IF aGetErrors[1] = 1884
	* Uniqueness ID error
	MESSAGEBOX(ERR_UNIQUEKEY3_LOC)
	TABLEREVERT(.T.)
	RETURN
ENDIF

IF CursorGetProp("sourcetype",.ALIAS)=2
	* If failed to update, check for remote view and revert
	MESSAGEBOX(ERR_RVIEWUPDATE_LOC)
	TABLEREVERT(.T.,.ALIAS)
	RETURN
ENDIF	

ENDPROC
PROCEDURE Destroy
* Restore various settings
LOCAL nTablesUsed,aTablesUsed,i,nDECursors,aDECursors,cDataEnvRef 
DIMENSION aTablesUsed[1]
nDECursors = 0

IF TYPE('THIS.Parent') # "O"
	RETURN
ENDIF

IF TYPE("THIS.oldTalk") = "C" AND THIS.oldTalk="ON"
	SET TALK ON
ENDIF

IF THIS.UseDataEnv
	DIMENSION aDECursors[1]
	DO CASE
	CASE TYPE("THISFORM.DataEnvironment") = "O"
		nDECursors = AMEMBERS(aDECursors,THISFORM.DataEnvironment,2)
		cDataEnvRef = "THISFORM.DataEnvironment"
	CASE TYPE("THISFORMSET.DataEnvironment") = "O"
		nDECursors = AMEMBERS(aDECursors,THISFORMSET.DataEnvironment,2)
		cDataEnvRef = "THISFORMSET.DataEnvironment"
	ENDCASE
	FOR i = 1 TO m.nDECursors
		WITH EVAL(m.cDataEnvRef + "." + aDECursors[m.i])
		
			IF USED(.ALIAS) AND ATC("CURSOR",.BaseClass)#0 AND ;
			  CursorGetProp("buffering",.ALIAS)>1
			  
				IF !TableUpdate(.T.,.T.,.ALIAS)  && update on exit						
					THIS.CheckError()
				ENDIF
			  	
				* If your form has General fields, there is a possibility
				* that certain OLE Servers supporting the General fields
				* can send data back to General fields even though they
				* are not in Edit Mode. If you experience problems in
				* closing the form because of thie, you might want to
				* uncomment the line below to resolve this. 
				*
				* CursorSetProp("buffering",1,.ALIAS)	&&optimistic table buffering
			ENDIF
		
		ENDWITH
	ENDFOR
ENDIF

* Skip if using preview mode
IF THIS.PreviewMode
	RETURN
ENDIF

IF THIS.oldSetDelete = "OFF"
	SET DELETED OFF
ENDIF
SET REPROCESS TO THIS.oldReprocess
SET MESSAGE TO
SELECT (THIS.nWorkArea)

IF THIS.UseDataEnv AND (!THIS.lAutoBuffer OR nDECursors#0)
	RETURN
ENDIF

IF THIS.oldBuffering#1
	RETURN
ENDIF

* The following code is here to support forms not using a DataEnvironment.
m.nTablesUsed = AUSED(aTablesUsed)
FOR i = 1 TO m.nTablesUsed
	IF CursorGetProp('sourcetype',aTablesUsed[m.i,1])=3	&&skip for views
		CursorSetProp("buffering",THIS.oldBuffering,aTablesUsed[m.i,1])	&&optimistic table buffering
	ENDIF
ENDFOR

IF THIS.oldMultiLocks = "OFF"
	SET MULTILOCKS OFF
ENDIF

IF THIS.oldSetFields = "ON"
	SET FIELDS ON
ENDIF

ENDPROC
PROCEDURE Error
#DEFINE ERR_UNIQUEKEY_LOC   "A unique key error violation has occurred."
#DEFINE ERR_UNIQUEKEY2_LOC  "Would you like to revert changes?"

Parameters nError, cMethod, nLine
LOCAL aFoxErr,nTotErr
DIMENSION aFoxErr[1]
nTotErr = AERROR(aFoxErr)
THIS.HadError = .T.


DO CASE
CASE INLIST(m.nError,1733,1734)  &&property not found -- traps SETALL()
	RETURN
CASE m.nError=1938  &&no parent
	RETURN
CASE m.nError=1938  &&no parent
	RETURN
CASE nToterr>0 AND aFoxErr[1,1] = 1420
	* Corrupt Ole object in General field.
	MESSAGEBOX(aFoxErr[1,2])
	RETURN
CASE nError = 5  &&record out of range
	IF EOF()
		GO BOTTOM
	ELSE
		GO TOP
	ENDIF
	RETURN
CASE nError = 1884
	* Uniqueness ID error
	IF CURSORGETPROP("buffering")=1
		MESSAGEBOX(ERR_UNIQUEKEY_LOC)
		RETURN
	ENDIF
	IF MESSAGEBOX(ERR_UNIQUEKEY_LOC+" "+ERR_UNIQUEKEY2_LOC,36)=6
		TABLEREVERT(.T.)
	ENDIF
	RETURN
ENDCASE

**** Error Dialog ******
MESSAGEBOX(MESSAGE(1)+CHR(13)+;
	"Error: "+STR(nError)+CHR(13)+;
	MESSAGE()+CHR(13)+;
	"Method: "+cMethod+CHR(13)+;
	"Line: "+STR(nLine))

RETURN

ENDPROC
PROCEDURE Init
#DEFINE C_WIZSTYLE			"WIZBTNS.VCX"
#DEFINE C_WIZDIR 			"WIZARDS\"
#DEFINE C_PROMPT1_LOC		"Find: "
#DEFINE E_NOSTYLE_LOC		"The class library (WIZBTNS.VCX) needed by this form could not be found. "+;
							"Please locate."

LOCAL cWizHomePath,separator,cWizStyFile


IF TYPE('THIS.Parent') # "O"
	RETURN
ENDIF

IF SET("TALK") = "ON"
	SET TALK OFF
	THIS.oldTalk = "ON"
ELSE
	THIS.oldTalk = "OFF"
ENDIF


IF ATC(C_WIZSTYLE,SET("CLASSLIB")) = 0
	* Returns just the pathname
	cWizHomePath = _WIZARD
	IF '\' $ cWizHomePath
	   cWizHomePath = SUBSTR(m.cWizHomePath,1,RAT('\',m.cWizHomePath))
	   IF RIGHT(m.cWizHomePath,1) = '\' AND LEN(m.cWizHomePath) > 1 ;
	            AND SUBSTR(m.cWizHomePath,LEN(m.cWizHomePath)-1,1) <> ':'
	         cWizHomePath = SUBSTR(m.cWizHomePath,1,LEN(m.cWizHomePath)-1)
	   ENDIF
	ELSE
	   cWizHomePath = ''
	ENDIF

	* Add a backslash unless there is one already there.
	separator = IIF(_MAC,":","\")
	IF !(RIGHT(m.cWizHomePath,1) $ '\:') AND !EMPTY(m.cWizHomePath)
	   m.cWizHomePath= m.cWizHomePath+ m.separator
	ENDIF

	DO CASE
	CASE FILE(C_WIZSTYLE)
		cWizFile = C_WIZSTYLE
	CASE FILE(m.cWizHomePath+C_WIZSTYLE)
		cWizFile = m.cWizHomePath+C_WIZSTYLE
	CASE FILE(m.cWizHomePath+C_WIZDIR+C_WIZSTYLE)
		cWizFile = m.cWizHomePath+C_WIZDIR+C_WIZSTYLE	
	CASE FILE(HOME()+C_WIZSTYLE)
		cWizFile = HOME()+C_WIZSTYLE
	CASE FILE(HOME()+C_WIZDIR+C_WIZSTYLE)
		cWizFile = HOME()+C_WIZDIR+C_WIZSTYLE
	OTHERWISE
		=MESSAGEBOX(E_NOSTYLE_LOC)
		cWizFile = GETFILE("VCX",C_PROMPT1_LOC+C_WIZSTYLE)
	ENDCASE
	
	IF ATC(C_WIZSTYLE,m.cWizFile)#0
		SET CLASS TO (m.cWizFile) ADDITIVE
	ELSE
		* Failed to get classlib file
		RETURN .F.
	ENDIF
	
ENDIF

THIS.InitVars()

IF !EMPTY(ALIAS()) AND ((EOF() OR BOF()) OR THIS.lStartTop)
	GO TOP
ENDIF

ENDPROC
PROCEDURE Refresh
**** Special Preview Mode Handling ****
IF THIS.PreviewMode AND THIS.PreviewInit
	THIS.PreviewInit = .F.
	THIS.cmdAdd.Enabled = .F.
	THIS.cmdDelete.Enabled = .F.
	THIS.cmdFind.Enabled = .F.
	THIS.cmdPrint.Enabled = .F.
	THIS.cmdExit.Enabled = .F.
	THIS.nWorkArea = SELECT()
ENDIF

ENDPROC