Produced by Araxis Merge on 4/16/2019 12:20:47 PM Central Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
# | Location | File | Last Modified |
---|---|---|---|
1 | C:\AraxisMergeCompare\Pri_un\CPRS_32_P2_PCE\OR_30_405V60_SRC\Cover Sheet | oGridPanelFunctions.pas | Wed Dec 12 14:04:36 2018 UTC |
2 | C:\AraxisMergeCompare\Pri_re\CPRS v32 P2 PCE Standardization-redacted\CPRS_32_P2_PCE\OR_30_405V60_SRC\Cover Sheet | oGridPanelFunctions.pas | Fri Apr 12 13:42:30 2019 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 2 | 778 |
Changed | 1 | 2 |
Inserted | 0 | 0 |
Removed | 0 | 0 |
Whitespace | |
---|---|
Character case | Differences in character case are significant |
Line endings | Differences in line endings (CR and LF characters) are ignored |
CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
1 | unit oGrid PanelFunct ions; | |
2 | { | |
3 | ======== ========== ========== ========== ========== ========== ========== ========== == | |
4 | * | |
5 | * Applicatio n: CPRS - Utilities | |
6 | * Developer: PII | |
7 | * Site: Salt L ake City I SC | |
8 | * Date: 2015-1 2-04 | |
9 | * | |
10 | * Descriptio n: Provid es a singl eton inter face to co mmon CPRS funtions | |
11 | * used w ith the TG ridPanel o bject. | |
12 | * | |
13 | * Notes: | |
14 | * | |
15 | ======== ========== ========== ========== ========== ========== ========== ========== == | |
16 | } | |
17 | ||
18 | interface | |
19 | ||
20 | uses | |
21 | System.C lasses, | |
22 | System.S ysUtils, | |
23 | Vcl.Cont rols, | |
24 | Vcl.ExtC trls, | |
25 | Vcl.Form s, | |
26 | iGridPan elIntf; | |
27 | ||
28 | type | |
29 | TGridPan elFunction s = class( TInterface dObject, I GridPanelF unctions) | |
30 | public | |
31 | functi on AddCove rSheetCont rol(aGridP anel: TGri dPanel; aC ontrol: TC ontrol; aC ol, aRow: integer; a Align: TAl ign = alNo ne): boole an; | |
32 | ||
33 | functi on AddRow( aGridPanel : TGridPan el; aSizeS tyle: TSiz eStyle; aV alue: doub le): integ er; | |
34 | functi on AddColu mn(aGridPa nel: TGrid Panel; aSi zeStyle: T SizeStyle; aValue: d ouble): in teger; | |
35 | functi on AddCont rol(aGridP anel: TGri dPanel; aC ontrol: TC ontrol; aC ol, aRow: integer; a Align: TAl ign = alNo ne): boole an; | |
36 | ||
37 | functi on AlignCo lumns(aGri dPanel: TG ridPanel): boolean; | |
38 | functi on AlignRo ws(aGridPa nel: TGrid Panel): bo olean; | |
39 | ||
40 | functi on ClearGr id(aGridPa nel: TGrid Panel): bo olean; | |
41 | functi on GetCont ents(aGrid Panel: TGr idPanel; a Output: TS trings): i nteger; | |
42 | functi on GetSize StyleName( aSizeStyle : TSizeSty le): strin g; | |
43 | ||
44 | functi on Collaps eRow(aCont rol: TCont rol; aColl apsedHeigh t: integer ): boolean ; | |
45 | functi on ExpandR ow(aContro l: TContro l; aHeight : double; aStyle: TS izeStyle): boolean; | |
46 | ||
47 | proced ure Format Rows(aGrid Panel: TGr idPanel; a Styles: ar ray of TSi zeStyle; a Values: ar ray of dou ble); | |
48 | end; | |
49 | ||
50 | implementa tion | |
51 | ||
52 | { TGridPan elFunction s } | |
53 | ||
54 | function T GridPanelF unctions.A ddColumn(a GridPanel: TGridPane l; aSizeSt yle: TSize Style; aVa lue: doubl e): intege r; | |
55 | begin | |
56 | { Make s ure row[0] exists } | |
57 | while aG ridPanel.R owCollecti on.Count < 1 do | |
58 | aGridP anel.RowCo llection.A dd; | |
59 | ||
60 | with aGr idPanel.Co lumnCollec tion.Add d o | |
61 | begin | |
62 | Size Style := a SizeStyle; | |
63 | Valu e := aValu e; | |
64 | end; | |
65 | ||
66 | Result : = aGridPan el.ColumnC ollection. Count; | |
67 | end; | |
68 | ||
69 | function T GridPanelF unctions.A ddControl( aGridPanel : TGridPan el; aContr ol: TContr ol; aCol, aRow: inte ger; aAlig n: TAlign) : boolean; | |
70 | begin | |
71 | try | |
72 | { Make sure col[ 0] exists } | |
73 | while aGridPanel .ColumnCol lection.Co unt < 1 do | |
74 | aGri dPanel.Col umnCollect ion.Add; | |
75 | ||
76 | { Make sure the row as aRo w exists } | |
77 | while aGridPanel .RowCollec tion.Count < (aRow + 1) do | |
78 | aGri dPanel.Row Collection .Add; | |
79 | ||
80 | aContr ol.Parent := aGridPa nel; | |
81 | ||
82 | aGridP anel.Contr olCollecti on.AddCont rol(aContr ol, aCol, aRow); | |
83 | aContr ol.Align : = aAlign; | |
84 | aContr ol.Show; | |
85 | Result := true; | |
86 | except | |
87 | Result := false; | |
88 | end; | |
89 | end; | |
90 | ||
91 | function T GridPanelF unctions.A ddCoverShe etControl( aGridPanel : TGridPan el; aContr ol: TContr ol; aCol, aRow: inte ger; aAlig n: TAlign) : boolean; | |
92 | var | |
93 | aGridPan elRow: TGr idPanel; | |
94 | begin | |
95 | try | |
96 | { Make sure col[ 0] exists } | |
97 | while aGridPanel .ColumnCol lection.Co unt < 1 do | |
98 | begi n | |
99 | aG ridPanel.C olumnColle ction.Add; | |
100 | Al ignColumns (aGridPane l); | |
101 | end; | |
102 | ||
103 | { Make sure the row as aRo w exists } | |
104 | while aGridPanel .RowCollec tion.Count < (aRow + 1) do | |
105 | begi n | |
106 | aG ridPanel.R owCollecti on.Add; | |
107 | aG ridPanelRo w := TGrid Panel.Crea te(aGridPa nel); | |
108 | aG ridPanelRo w.Name := Format('%s _Row_%d', [aGridPane lRow.Class Name, aGri dPanel.Row Collection .Count]); | |
109 | Cl earGrid(aG ridPanelRo w); | |
110 | aG ridPanelRo w.RowColle ction.Add; | |
111 | aG ridPanelRo w.ColumnCo llection.A dd; | |
112 | aG ridPanelRo w.Parent : = aGridPan el; | |
113 | aG ridPanelRo w.ShowCapt ion := fal se; | |
114 | aG ridPanelRo w.TabStop := false; | |
115 | aG ridPanelRo w.BorderSt yle := bsN one; | |
116 | aG ridPanelRo w.BevelInn er := bvNo ne; | |
117 | aG ridPanelRo w.BevelOut er := bvNo ne; | |
118 | aG ridPanelRo w.ParentCo lor := tru e; | |
119 | aG ridPanelRo w.Align := alClient; | |
120 | ||
121 | aG ridPanel.C ontrolColl ection.Add Control(aG ridPanelRo w, 0, aGri dPanel.Row Collection .Count - 1 ); | |
122 | ||
123 | end; | |
124 | ||
125 | AlignR ows(aGridP anel); | |
126 | ||
127 | { Sele ct the Gri dPane that is aRow } | |
128 | aGridP anelRow := TGridPane l(aGridPan el.Control Collection .Controls[ 0, aRow]); | |
129 | ||
130 | { Make sure the column exi sts } | |
131 | while aGridPanel Row.Column Collection .Count < ( aCol + 1) do | |
132 | with aGridPane lRow.Colum nCollectio n.Add do | |
133 | be gin | |
134 | Value := 2 0; | |
135 | SizeStyle := ssPerce nt; | |
136 | en d; | |
137 | ||
138 | AlignC olumns(aGr idPanelRow ); | |
139 | ||
140 | aContr ol.Parent := aGridPa nelRow; | |
141 | ||
142 | aGridP anelRow.Co ntrolColle ction.AddC ontrol(aCo ntrol, aCo l, 0); | |
143 | aContr ol.Align : = aAlign; | |
144 | aContr ol.Visible := true; | |
145 | ||
146 | Result := true; | |
147 | except | |
148 | Result := false; | |
149 | end; | |
150 | end; | |
151 | ||
152 | function T GridPanelF unctions.A ddRow(aGri dPanel: TG ridPanel; aSizeStyle : TSizeSty le; aValue : double): integer; | |
153 | begin | |
154 | { Make s ure col[0] exists } | |
155 | while aG ridPanel.C olumnColle ction.Coun t < 1 do | |
156 | aGridP anel.Colum nCollectio n.Add; | |
157 | ||
158 | aGridPan el.RowColl ection.Beg inUpdate; | |
159 | try | |
160 | with a GridPanel. RowCollect ion.Add do | |
161 | begi n | |
162 | Si zeStyle := aSizeStyl e; | |
163 | Va lue := aVa lue; | |
164 | end; | |
165 | finally | |
166 | aGridP anel.RowCo llection.E ndUpdate; | |
167 | end; | |
168 | ||
169 | Result : = aGridPan el.RowColl ection.Cou nt; | |
170 | end; | |
171 | ||
172 | function T GridPanelF unctions.A lignColumn s(aGridPan el: TGridP anel): boo lean; | |
173 | var | |
174 | i: integ er; | |
175 | j: integ er; | |
176 | begin | |
177 | aGridPan el.ColumnC ollection. BeginUpdat e; | |
178 | try | |
179 | j := 0 ; | |
180 | for i := 0 to aG ridPanel.C olumnColle ction.Coun t - 1 do | |
181 | if a GridPanel. ColumnColl ection[i]. SizeStyle = ssPercen t then | |
182 | in c(j); | |
183 | ||
184 | for i := 0 to aG ridPanel.C olumnColle ction.Coun t - 1 do | |
185 | if a GridPanel. ColumnColl ection[i]. SizeStyle = ssPercen t then | |
186 | aG ridPanel.C olumnColle ction[i].V alue := (1 00 / j); | |
187 | ||
188 | aGridP anel.Colum nCollectio n.EndUpdat e; | |
189 | Result := true; | |
190 | except | |
191 | aGridP anel.Colum nCollectio n.EndUpdat e; | |
192 | Result := false; | |
193 | end; | |
194 | end; | |
195 | ||
196 | function T GridPanelF unctions.A lignRows(a GridPanel: TGridPane l): boolea n; | |
197 | var | |
198 | i: integ er; | |
199 | j: integ er; | |
200 | begin | |
201 | aGridPan el.RowColl ection.Beg inUpdate; | |
202 | try | |
203 | j := 0 ; | |
204 | for i := 0 to aG ridPanel.R owCollecti on.Count - 1 do | |
205 | if a GridPanel. RowCollect ion[i].Siz eStyle = s sPercent t hen | |
206 | in c(j); | |
207 | ||
208 | for i := 0 to aG ridPanel.R owCollecti on.Count - 1 do | |
209 | if a GridPanel. RowCollect ion[i].Siz eStyle = s sPercent t hen | |
210 | aG ridPanel.R owCollecti on[i].Valu e := (100 / j); | |
211 | ||
212 | aGridP anel.RowCo llection.E ndUpdate; | |
213 | Result := true; | |
214 | except | |
215 | aGridP anel.RowCo llection.E ndUpdate; | |
216 | Result := false; | |
217 | end; | |
218 | end; | |
219 | ||
220 | function T GridPanelF unctions.C learGrid(a GridPanel: TGridPane l): boolea n; | |
221 | var | |
222 | aControl : TControl ; | |
223 | begin | |
224 | try | |
225 | while aGridPanel .ControlCo llection.C ount > 0 d o | |
226 | begi n | |
227 | aC ontrol := aGridPanel .ControlCo llection[0 ].control; | |
228 | if aControl is TGridPa nel then | |
229 | begin | |
230 | ClearGri d(TGridPan el(aContro l)); | |
231 | TGridPan el(aContro l).Control Collection .Clear; | |
232 | TGridPan el(aContro l).ColumnC ollection. Clear; | |
233 | TGridPan el(aContro l).RowColl ection.Cle ar; | |
234 | end; | |
235 | aG ridPanel.C ontrolColl ection.Rem oveControl (aControl) ; | |
236 | Fr eeAndNil(a Control); | |
237 | end; | |
238 | ||
239 | aGridP anel.Contr olCollecti on.Clear; | |
240 | aGridP anel.RowCo llection.C lear; | |
241 | aGridP anel.Colum nCollectio n.Clear; | |
242 | ||
243 | Result := true; | |
244 | except | |
245 | Result := false; | |
246 | end; | |
247 | end; | |
248 | ||
249 | function T GridPanelF unctions.C ollapseRow (aControl: TControl; aCollapse dHeight: i nteger): b oolean; | |
250 | var | |
251 | aGridPan el: TGridP anel; | |
252 | aIndex: integer; | |
253 | begin | |
254 | if aCont rol.Parent .ClassName Is('TGridP anel') the n | |
255 | begin | |
256 | aGri dPanel := TGridPanel (aControl. Parent); | |
257 | aInd ex := aGri dPanel.Con trolCollec tion.Index Of(aContro l); | |
258 | if a Index < 0 then | |
259 | ra ise Except ion.Create ('Control not in par ent contro l collecti on'); | |
260 | ||
261 | aGri dPanel.Row Collection .BeginUpda te; | |
262 | with aGridPane l do | |
263 | tr y | |
264 | RowCollect ion[aIndex ].SizeStyl e := ssAbs olute; | |
265 | RowCollect ion[aIndex ].Value := aCollapse dHeight; | |
266 | fi nally | |
267 | RowCollect ion.EndUpd ate; | |
268 | en d; | |
269 | Resu lt := true ; | |
270 | end | |
271 | else | |
272 | Result := false; | |
273 | end; | |
274 | ||
275 | function T GridPanelF unctions.E xpandRow(a Control: T Control; a Height: do uble; aSty le: TSizeS tyle): boo lean; | |
276 | var | |
277 | aGridPan el: TGridP anel; | |
278 | aIndex: integer; | |
279 | begin | |
280 | if aCont rol.Parent .ClassName Is('TGridP anel') the n | |
281 | begin | |
282 | aGri dPanel := TGridPanel (aControl. Parent); | |
283 | aInd ex := aGri dPanel.Con trolCollec tion.Index Of(aContro l); | |
284 | if a Index < 0 then | |
285 | ra ise Except ion.Create ('Control not in par ent contro l collecti on'); | |
286 | ||
287 | aGri dPanel.Row Collection .BeginUpda te; | |
288 | with aGridPane l do | |
289 | tr y | |
290 | RowCollect ion[aIndex ].SizeStyl e := aStyl e; | |
291 | RowCollect ion[aIndex ].Value := aHeight; | |
292 | fi nally | |
293 | RowCollect ion.EndUpd ate; | |
294 | en d; | |
295 | Resu lt := true ; | |
296 | end | |
297 | else | |
298 | Result := false; | |
299 | end; | |
300 | ||
301 | procedure TGridPanel Functions. FormatRows (aGridPane l: TGridPa nel; aStyl es: array of TSizeSt yle; aValu es: array of double) ; | |
302 | var | |
303 | i: integ er; | |
304 | begin | |
305 | aGridPan el.RowColl ection.Beg inUpdate; | |
306 | try | |
307 | if Hig h(aStyles) <> High(a Values) th en | |
308 | rais e Exceptio n.Create(' MisMatch i n number o f styles v s values.' ); | |
309 | ||
310 | if Hig h(aStyles) <> (aGrid Panel.RowC ollection. Count - 1) then | |
311 | rais e Exceptio n.Create(' MisMatch i n number o f styles/v alues vs r ows.'); | |
312 | ||
313 | for i := Low(aSt yles) to H igh(aStyle s) do | |
314 | begi n | |
315 | aG ridPanel.R owCollecti on[i].Size Style := a Styles[i]; | |
316 | aG ridPanel.R owCollecti on[i].Valu e := aValu es[i]; | |
317 | end; | |
318 | finally | |
319 | aGridP anel.RowCo llection.E ndUpdate; | |
320 | end; | |
321 | end; | |
322 | ||
323 | function T GridPanelF unctions.G etContents (aGridPane l: TGridPa nel; aOutp ut: TStrin gs): integ er; | |
324 | var | |
325 | i: integ er; | |
326 | aControl : TControl ; | |
327 | begin | |
328 | try | |
329 | aOutpu t.Add('Her e''s the s tats so fa r'); | |
330 | aOutpu t.Add(Form at('TGridP anel: %s ( Rows: %d, Cols: %d)' , [aGridPa nel.Name, aGridPanel .RowCollec tion.Count , aGridPan el.ColumnC ollection. Count])); | |
331 | ||
332 | aOutpu t.Add('Row s'); | |
333 | aOutpu t.Add('--- -'); | |
334 | ||
335 | for i := 0 to aG ridPanel.R owCollecti on.Count - 1 do | |
336 | begi n | |
337 | aO utput.Add( Format(' Row %d, Si zeStyle: % d', [i, or d(aGridPan el.RowColl ection[i]. SizeStyle) ])); | |
338 | aO utput.Add( Format(' Va lue : % 0.5f', [aG ridPanel.R owCollecti on[i].Valu e])); | |
339 | end; | |
340 | ||
341 | aOutpu t.Add('Col umns'); | |
342 | aOutpu t.Add('--- ----'); | |
343 | ||
344 | for i := 0 to aG ridPanel.C olumnColle ction.Coun t - 1 do | |
345 | begi n | |
346 | aO utput.Add( Format(' Col %d, Si zeStyle: % d', [i, or d(aGridPan el.ColumnC ollection[ i].SizeSty le)])); | |
347 | aO utput.Add( Format(' Va lue : % 0.5f', [aG ridPanel.C olumnColle ction[i].V alue])); | |
348 | end; | |
349 | ||
350 | aOutpu t.Add('Con trols'); | |
351 | aOutpu t.Add('--- -----'); | |
352 | ||
353 | for i := 0 to aG ridPanel.C ontrolColl ection.Cou nt - 1 do | |
354 | begi n | |
355 | aC ontrol := aGridPanel .ControlCo llection[i ].control; | |
356 | aO utput.Add( Format(' Control %d , ClassNam e: %s (Nam e: %s)', [ i, aContro l.ClassNam e, aContro l.Name])); | |
357 | wi th aGridPa nel.Contro lCollectio n[i] do | |
358 | aOutput.Ad d(Format(' Row: % d, Col: %d ', [row, c olumn])); | |
359 | ||
360 | if aControl. ClassNameI s(aGridPan el.ClassNa me) then | |
361 | begin | |
362 | aOutput. Add(' '); | |
363 | aOutput. Add(' Emb edded TGri dPanel'); | |
364 | aOutput. Add(' === ========== ======'); | |
365 | GetConte nts(TGridP anel(aCont rol), aOut put); | |
366 | aOutput. Add(' === ========== ======'); | |
367 | aOutput. Add(' Emb edded TGri dPanel'); | |
368 | aOutput. Add(' '); | |
369 | end; | |
370 | end; | |
371 | except | |
372 | on e: Exception do | |
373 | aOut put.Add(e. message); | |
374 | end; | |
375 | ||
376 | Result : = aOutput. Count; | |
377 | end; | |
378 | ||
379 | function T GridPanelF unctions.G etSizeStyl eName(aSiz eStyle: TS izeStyle): string; | |
380 | begin | |
381 | case aSi zeStyle of | |
382 | ssAbso lute: Resu lt := 'ssA bsolute'; | |
383 | ssPerc ent: Resul t := 'ssPe rcent'; | |
384 | ssauto : Result : = 'ssAuto' ; | |
385 | else | |
386 | Result := 'Unkno wn'; | |
387 | end; | |
388 | end; | |
389 | ||
390 | end. |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.