Module oPropertyGrid_Container.pkg
1Use Windows.pkg
2Use DFClient.pkg
3Use cSigCJDockingPane_Container.pkg
4Use cSigCJPropertyGrid.pkg
5Use GlobalFunctionsProcedures.pkg
6Use Sysfile1.DD
7Use Sysfile2.DD
8
9Object oPropertyGrid_Container is a cSigCJDockingPane_Container
10 Set Border_Style to Border_None
11 Set Size to 360 180
12 Set location to -1000 -1000
13
14 Object oSysfile2_DD is a Sysfile2_DataDictionary
15 Set Auto_Fill_State to True
16 Set In_Use_State to True
17 End_Object
18
19 Object oSysfile1_DD is a Sysfile1_DataDictionary
20 Set Auto_Fill_State to True
21 Set In_Use_State to True
22 End_Object
23
24 Object oSigCJPropertyGrid is a cSigCJPropertyGrid
25 Set Size to 311 175
26 Set Location to 1 1
27 Set piHelpHeight to 60
28 Set prSplitterPos to 0.5
29 Set peAnchors to anAll
30 Set pbVariableSplitterPos to True
31 Set phoMainContainerObjectID to (oPropertyGrid_Container(Self))
32
33 Object oCtgry_CompanyDetails is a cSigCJPropertyGridCategory
34 Set psLabel to "Company Details"
35 Set psHelpText to "Comany Details (Address, Telephone etc.)"
36 Set psImage to 'Icon3_16.bmp'
37
38 Object oItem_Name is a cSigCJPropertyGridItem
39 Set psLabel to "Name"
40 Set psHelpText to "Company Name"
41 Set psImage to 'Icon3_16.bmp'
42 Set psToolTip to "Images can be displayed"
43 Send BindToDataBase File_Field Sysfile1.Organisation
44 End_Object
45 Object oItem_Address1 is a cSigCJPropertyGridItem
46 Set psLabel to "Address Line 1"
47 Send BindToDataBase File_Field Sysfile1.Address1
48 End_Object
49 Object oItem_Address2 is a cSigCJPropertyGridItem
50 Set psLabel to "Address Line 2"
51 Send BindToDataBase File_Field Sysfile1.Address2
52 End_Object
53 Object oItem_Address3 is a cSigCJPropertyGridItem
54 Set psLabel to "Address Line 3"
55 Send BindToDataBase File_Field Sysfile1.Address3
56 End_Object
57 Object oItem_Address4 is a cSigCJPropertyGridItem
58 Set psLabel to "Address Line 4"
59 Send BindToDataBase File_Field Sysfile1.Address4
60 End_Object
61 Object oItem_Postcode is a cSigCJPropertyGridItem
62 Set psLabel to "Postcode"
63 Set psToolTip to "Should be uppercase - controlled by DD"
64 Send BindToDataBase File_Field Sysfile1.Postcode
65 End_Object
66 Object oItem_Country is a cSigCJPropertyGridComboFormItem
67 Set psLabel to "Country"
68 Send BindToDataBase File_Field Sysfile1.Country
69
70 Procedure OnAddLookupItems
71 Forward Send OnAddLookupItems
72 //Note we forward send before we associate images (so that the control is populated with data
73 //before we add the images)
74 Set LookupItemImage 1 to 'FlagDenmark_16.bmp'
75 Set LookupItemImage 2 to 'FlagNetherlands_16.bmp'
76 Set LookupItemImage 3 to 'FlagUK_16.bmp'
77 Set LookupItemImage 4 to 'FlagUSA_16.bmp'
78 Set LookupItemImage 5 to 'FlagCroatia_16.bmp'
79 End_Procedure
80
81 End_Object
82 Object oItem_Telephone is a cSigCJPropertyGridItem
83 Set psLabel to "Main Telephone"
84 Set psHelpText to "Main Telephone Number"
85 Send BindToDataBase File_Field Sysfile1.Telephone_No
86 End_Object
87 End_Object
88 Object oCtgry_SystemDate is a cSigCJPropertyGridCategory
89 Set psLabel to "System Date"
90 Object oItem_SystemDate is a cSigCJPropertyGridItem
91 Set psLabel to "System Date"
92 Send BindToDataBase File_Field Sysfile1.System_Date
93 End_Object
94 Object oItem_Allow_Amend_Date is a cSigCJPropertyGridItem
95 Set psLabel to "Allow Date Change?"
96 Send BindToDataBase File_Field Sysfile1.Amend_Date
97
98 Procedure ReadItemFromDatabase
99 Forward Send ReadItemFromDatabase
100 //ensure pbReadOnly state of oItem_SystemDate is set correctly..
101 Send OnChange
102 End_Procedure
103
104 Procedure OnChange
105 Variant vValue
106 Get pvValue to vValue
107 Set pbReadOnly of oItem_SystemDate to (vValue = "False")
108 End_Procedure
109 End_Object
110
111 End_Object
112 Object oCtgry_Counters is a cSigCJPropertyGridCategory
113 Set psLabel to "Counters"
114 Object oItem_Slider is a cSigCJPropertyGridSliderCtlItem
115 Set psLabel to "Slider"
116 Set psToolTip to "Range set from 1 to 999"
117 Send BindToDataBase File_Field Sysfile1.Counter1
118 Set piWidth to 100
119 Set piMinimum to 1
120 Set piMaximum to 999
121 End_Object
122 Object oItem_SpinForm is a cSigCJPropertyGridSpinFormItem
123 Set psLabel to "Spin Form"
124 Set psToolTip to "Range set from 1 to 100"
125 Send BindToDataBase File_Field Sysfile1.Counter2
126 Set piWidth to 20
127 Set piMinimum to 1
128 Set piMaximum to 100
129 End_Object
130 End_Object
131 Object oCtgry_Misc is a cSigCJPropertyGridCategory
132 Set psLabel to "Miscallaneous"
133 Object oItem_Default_Price is a cSigCJPropertyGridItem
134 Set psLabel to "Default Price"
135 Send BindToDataBase File_Field Sysfile1.Default_Price
136 End_Object
137 Object oItem_Admin_Password is a cSigCJPropertyGridItem
138 Set psLabel to "Admin Password"
139 Set pbPassword_State to True
140 Send BindToDataBase File_Field Sysfile2.Admin_Password
141 End_Object
142 Object oItem_Size is a cSigCJPropertyGridItem
143 Set psLabel to "Size"
144 Send BindToDataBase File_Field Sysfile2.Size
145 //but despite binding to a numberic field, set the item type to ePGItype_String
146 //because of the way we wish to display this
147 Set peItemType to ePGItype_String
148
149 //ReadItemFromDatabase
150 //Forward send (so that the raw data value is read into the control) and then split the value
151 //into HI/LOW values
152 Procedure ReadItemFromDatabase
153 Integer iHeight iWidth iSize
154
155 Forward Send ReadItemFromDatabase
156 Get pvValue to iSize
157 Move (Hi(iSize)) to iHeight
158 Move (Low(iSize)) to iWidth
159 Set pvInitialValue to (String(iHeight)-';'-String(iWidth))
160 Set pvInitialValue of oItem_Height to iHeight
161 Set pvInitialValue of oItem_Width to iWidth
162 End_Procedure
163
164 //MoveItemDataToDatabase
165 //Get the values of the Height/Width and calcuate (and set) the new size value
166 Procedure MoveItemDataToDatabase
167 Handle hoDD
168 Integer iField iSize iWidth iHeight iPos
169 String sVal
170
171 Get pvValue to sVal
172 Move (Pos(";",sVal)) to iPos
173 If (iPos<>0) Begin
174 Move (Left(sVal,iPos-1)) to iHeight
175 Move (Replace(String(iHeight)-';',sVal,"")) to iWidth
176 Move ((iHeight*65536)+iWidth) to iSize
177 End
178 Get Item_Server to hoDD
179 Get Item_Data_Field to iField
180 Set Field_changed_Value of hoDD iField to iSize
181 End_Procedure
182
183 //OnChange
184 //Need to allow for setting of size (height/width) elements through the size item
185 //and so need to update oItem_Height and oItem_Width accordingly
186 Procedure OnChange
187 String sVal
188 Integer iPos iHeight iWidth
189
190 Get pvValue to sVal
191 Move (Pos(";",sVal)) to iPos
192 If (iPos<>0) Begin
193 Move (Left(sVal,iPos-1)) to iHeight
194 Move (Replace(String(iHeight)-';',sVal,"")) to iWidth
195 End
196 Set pvValue of oItem_Height to iHeight
197 Set pvValue of oItem_Width to iWidth
198 End_Procedure
199
200 Object oItem_Height is a cSigCJPropertyGridItem
201 Set psLabel to "Height"
202 Set peItemType to ePGItype_Number
203
204 Procedure OnChange
205 Set pvValue of oItem_Size to (pvValue(Self)-';'-pvValue(oItem_Width(Self)))
206 Send MoveItemDataToDatabase of oItem_Size
207 End_Procedure
208 End_Object
209 Object oItem_Width is a cSigCJPropertyGridItem
210 Set psLabel to "Width"
211 Set peItemType to ePGItype_Number
212
213 Procedure OnChange
214 Set pvValue of oItem_Size to (pvValue(oItem_Height(Self))-';'-pvValue(Self))
215 Send MoveItemDataToDatabase of oItem_Size
216 End_Procedure
217 End_Object
218 End_Object
219 Object oItem_Customer_No is a cSigCJPropertyGridItem
220 Set psLabel to "Customer No."
221 Set pbReadOnly to True
222 Send BindToDataBase File_Field Sysfile2.Customer_No
223 End_Object
224 Object oItem_Order_No is a cSigCJPropertyGridItem
225 Set psLabel to "Order No."
226 Set pbReadOnly to True
227 Send BindToDataBase File_Field Sysfile2.Order_No
228 End_Object
229 Object oItem_Expand_Button is a cSigCJPropertyGridExpandBtnItem
230 Set psLabel to "Expand Button"
231 Set psHelpText to "Lookup Button - Click Me."
232 Send BindToDataBase File_Field Sysfile2.Text_Field_1
233
234 Procedure OnClick
235 Send ComAboutBox
236 End_Procedure
237 End_Object
238 End_Object
239
240 //Whenever any item changes, set the enabled_State of the apply button to true
241 Procedure OnItemChanged Handle hoItem
242 Set Enabled_State of oApply_btn to True
243 End_Procedure
244
245 Procedure OnMoveDataOut
246 Boolean bError
247
248 Get Request_Validate of oSysfile1_DD to bError
249 If (bError=False) Begin
250 Get Request_Validate of oSysfile2_DD to bError
251 End
252 If (bError=False) Begin
253 Send Request_Save of oSysfile1_DD
254 Send Request_Save of oSysfile2_DD
255 Send DoEnumerateAllPropertyGridItems Msg_ReadItemFromDatabase //which sets all the new defaults
256 Set Enabled_State of oApply_btn to False
257 End
258 End_Procedure
259
260 End_Object
261
262 Object oApply_btn is a Button
263 Set Location to 325 122
264 Set Label to "Apply"
265 Set peAnchors to anBottomRight
266 Set Enabled_State to False
267
268 Procedure OnClick
269 Send Apply of oSigCJPropertyGrid
270 End_Procedure
271
272 End_Object
273
274End_Object