Module cCJGrid.pkg
1Use Windows.pkg
2Use cCJReportControl.pkg
3Use cCJGridColumn.pkg
4Use cCJGridDataSource.pkg
5Use cCJGridFieldChooser.pkg
6Use cCJGridFieldChooserMenuItem.pkg
7Use cCJGridRestoreLayoutMenuItem.pkg
8Use cCJGridFreezeColumnMenuItem.pkg
9Use cCJGridSearchDialog.pkg
10Use GlobalFunctionsProcedures.pkg
11Use StdFont.pkg
12
13
14// See XTPReportFreezeColsDividerStyle in cCJReportControl.pkg. This is the default value
15// for freeze cols divider
16Define xtpReportFreezeColsDividerDefault for (xtpReportFreezeColsDividerThin + xtpReportFreezeColsDividerHeader + xtpReportFreezeColsDividerShade)
17
18Define OPERATION_MODE for |VI99 //status of data-sets in application (also defined in Data_set.pkg)
19
20Enum_List
21 Define ropTop for 0
22 Define ropBottom for -2
23 Define ropCenter for -1
24End_Enum_List
25
26Enum_List
27 Define gmsMouseStatusCleared
28 Define gmsMouseStatusDown
29 Define gmsMouseStatusMoved
30End_Enum_List
31
32{ Visibility=Private }
33Class cCJGridIdleHandler is a cIdleHandler
34 Procedure OnIdle
35 Delegate Send OnIdle
36 End_Procedure
37End_Class
38
39
40// cCJGrid
41// -------
42// Wraps the main grid control.
43
44{ DesignerClass=cDTCJGrid }
45{ CompositeClass=cCJGridColumn }
46{ OverrideProperty=Label DesignTime=False }
47{ OverrideProperty=Label_Col_Offset DesignTime=False }
48{ OverrideProperty=Label_Color DesignTime=False }
49{ OverrideProperty=Label_FontItalics DesignTime=False }
50{ OverrideProperty=Label_FontSize DesignTime=False }
51{ OverrideProperty=Label_FontUnderLine DesignTime=False }
52{ OverrideProperty=Label_FontWeight DesignTime=False }
53{ OverrideProperty=Label_Justification_Mode DesignTime=False }
54{ OverrideProperty=Label_Row_Offset DesignTime=False }
55{ OverrideProperty=Label_TextColor DesignTime=False }
56{ OverrideProperty=Label_TypeFace DesignTime=False }
57{ OverrideProperty=Border_Style DesignTime=False }
58{ OverrideProperty=psLicenseKey DesignTime=False }
59{ OverrideProperty=Attach_Parent_State DesignTime=False }
60{ OverrideProperty=Block_Mouse_State DesignTime=False }
61{ OverrideProperty=Client_Area_State DesignTime=False }
62{ OverrideProperty=Ring_State DesignTime=False }
63{ OverrideProperty=Scope_State DesignTime=False }
64{ OverrideProperty=Skip_State DesignTime=False }
65{ OverrideProperty=Visible_state DesignTime=False }
66{ OverrideProperty=pbBindValue DesignTime=False }
67{ OverrideProperty=psProgID DesignTime=False }
68{ OverrideProperty=peAutoCreate DesignTime=False }
69{ OverrideProperty=peNeighborhood DesignTime=False }
70{ OverrideProperty=Popup_State DesignTime=False }
71{ OverrideProperty=Search_Case DesignTime=False }
72
73Class cCJGrid is a cCJReportControl
74 Procedure Construct_Object
75 Handle hoFieldChooserPanel hoDataSource hoContextMenu
76
77 Forward Send Construct_Object
78
79 // Object handle properties....................
80 { DesignTime = False }
81 Property Handle phoDataSource 0 // cCJGridDataSource object
82 { DesignTime = False }
83 Property Handle phoFieldChooserPanel 0 // Field Chooser tool panel object
84 { DesignTime = False }
85 Property Handle phoHeaderContextMenu 0
86 { DesignTime = False }
87 Property Handle phoContextMenu 0
88 { DesignTime = False }
89 Property Handle phoContextMenuColumn 0 // column use for context menu
90 // makes it easier to bind com objects
91 { DesignTime = False }
92 Property Handle phoReportToolTipInfo (Create(Self, RefClass(cCJReportToolTipInfo)))
93 { DesignTime = False }
94 Property Handle phoToolTipContext (Create(Self, RefClass(cCJToolTipContext)))
95 { DesignTime = False }
96 Property Handle phoReportColumn (Create(Self, RefClass(cCJReportColumn)))
97 { DesignTime = False }
98 Property Handle phoReportColumns (Create(Self, RefClass(cCJReportColumns)))
99 { DesignTime = False }
100 Property Handle phoReportRecords (Create(Self, RefClass(cCJReportRecords)))
101 { DesignTime = False }
102 Property Handle phoReportRecord (Create(Self, RefClass(cCJReportRecord)))
103 { DesignTime = False }
104 Property Handle phoReportRecordItem (Create(Self, RefClass(cCJReportRecordItem)))
105 { DesignTime = False }
106 Property Handle phoReportRecordItemMetrics (Create(Self, RefClass(cCJReportRecordItemMetrics)))
107 { DesignTime = False }
108 Property Handle phoReportRow (Create(Self, RefClass(cCJReportRow)))
109 { DesignTime = False }
110 Property Handle phoReportRows (Create(Self, RefClass(cCJReportRows)))
111 { DesignTime = False }
112 Property Handle phoReportNavigator (Create(Self, RefClass(cCJReportNavigator)))
113 { DesignTime = False }
114 Property Handle phoReportPaintManager (Create(Self, RefClass(cCJReportPaintManager)))
115 { DesignTime = False }
116 Property Handle phoImageManagerIcons (Create(Self, RefClass(cCJImageManagerIcons)))
117 { Visibility=Private }
118 Property Handle[] phoColumnObjects // collection of report column objects
119
120 { Category=Behavior }
121 Property Boolean pbSelectTextOnEdit True // Determines if text is selected when cell goes into edit mode, see ReportRecordItemEditOptions.SelectTextOnEdit, we apply this setting to every column by default.
122 {Visibility = Private}
123 Property Variant private_pvSelectedFont (NullComObject()) // COM object pointer of the selected cell's Font. This is maintained in OnComBeforeDrawRow.
124 {Visibility = Private}
125 Property Integer private_piSelectedTextColor -1 // color of the selected cell's text. This is maintained in OnComBeforeDrawRow.
126 {Visibility = Private}
127 Property Integer private_Color clNone // see cReportPaintManager.BackColor
128 {Visibility = Private}
129 Property Boolean private_Enabled_State True // Gets or sets a value indicating whether the ReportControl can respond to user interaction., see ReportControl.Enabled
130 {Visibility = Private}
131 Property Boolean private_pbAllowColumnRemove True // Specifies whether ReportColumns can be removed from the ReportControl, see ReportControl.AllowColumnRemove
132 {Visibility = Private}
133 Property Boolean private_pbAllowColumnReorder True // Specifies whether ReportColumns can be reordered in the ReportControl, see ReportControl.AllowColumnReorder
134 {Visibility = Private}
135 Property Boolean private_pbAllowColumnResize True // Specifies whether ReportColumns can be resized, see ReportControl.AllowColumnResize
136 {Visibility = Private}
137 Property Boolean private_pbAllowEdit True // Allows the text in all ReportRecordItems to be edited, see cReportControl.AllowEdit.
138 {Visibility = Private}
139 Property Boolean private_pbAutoColumnSizing True // Specifies If AutoColumnSizing should be used. see ReportControl.AutoColumnSizing
140 {Visibility = Private}
141 Property Boolean private_pbEditOnClick False // Determine whether a ReportRecorditem can be edited by single-clicking on the item., see ReportControl.EditOnClick
142 {Visibility = Private}
143 Property Integer private_pbFixedInplaceButtonHeight False // Specifies whether the paint manager supports fixed height of in-place buttons, see ReportControl.FixedInplaceButtonHeight
144 {Visibility = Private}
145 Property Boolean private_pbFullColumnScrolling False // Specifies whether full column scrolling will be used., see ReportControl.FullColumnScrolling
146 {Visibility = Private}
147 Property Boolean private_pbDrawGridForEmptySpace True // Gets or sets wether grid lines will be drawn after the body of rows to fill the empty space. See ReportPaintManager.DrawGridForEmptySpace.
148 {Visibility = Private}
149 Property Boolean private_pbGrayIfDisable True // Specifies whether to draw the report using "normal" colors or standard Windows disabled colors when the report control disabled. See ReportPaintManager.GrayIfDisable.
150 {Visibility = Private}
151 Property Boolean private_pbHideSelection False // Determines whether the currently selected rows will remain shaded when the ReportControl loses focus. See ReportPaintManager.HideSelection.
152 {Visibility = Private}
153 Property Boolean private_pbHotTracking False // Gets\Set whether hot tracking is used While moving the mouse over the column header when using the "Explorer" or "Office 2003" column styles. See ReportPaintManager.HotTracking.
154 {Visibility = Private}
155 Property Boolean private_pbInitialSelectionEnable True // Specifies whether the first row in the report will become selected when initially populated., see ReportControl.InitialSelectionEnable
156 {Visibility = Private}
157 Property Boolean private_pbMultipleSelection False // Specifies whether multiple ReportRows can be selected at the same Time in the grid, see cReportControl.MultipleSelection
158 {Visibility = Private}
159 Property Boolean private_pbMultiSelectionMode False // Enables/disables the multiple selection mode for the control., see ReportControl.MultiSelectionMode
160 {Visibility = Private}
161 Property Boolean private_pbSelectionEnable False // Gets or sets whether rows will become selected when clicked or navigated with the arrow keys., see ReportControl.SelectionEnable
162 {Visibility = Private}
163 Property Boolean private_pbShowFooter False // Shows\Hides the report column footer., see ReportControl.ShowFooter
164 {Visibility = Private}
165 Property Boolean private_pbShowHeader True // The ShowHeader Property is used to hide or display the Column Headers in the Report Control., see ReportControl.ShowHeader
166 {Visibility = Private}
167 Property Boolean private_pbShowNonActiveInPlaceButton False // Specifies whether to Show NonActive InPlace Buttons (Combo, Expand, Spin) all the Time. See ReportPaintManager.ShowNonActiveInPlaceButton.
168 {Visibility = Private}
169 Property Boolean private_pbShowRowFocus False // Specifies whether to draw a focus rectangle around the focused row, see cReportControl.ShowRowFocus
170 {Visibility = Private}
171 Property Boolean private_pbUseAlternateRowBackgroundColor False // Specifies whether to use the piAlternateRowBackgroundColor to color the background of every second row. See ReportPaintManager.UseAlternativeBackground.
172 {Visibility = Private}
173 Property Boolean private_pbUseColumnTextAlignment True // The UseColumnTextAlignment Property specifies whether the text in the column header will Use the ReportColumn.Alignment setting to align the header caption. See ReportPaintManager.UseColumnTextAlignment.
174 {Visibility = Private}
175 Property Boolean private_pbUseEditTextAlignment True // Specifies whether the ReportColumn.Alignment setting is automatically applied to items when in edit mode. See ReportPaintManager.UseEditTextAlignment.
176
177 {Visibility = Private}
178 Property XTPReportBorderStyle private_peBorderStyle xtpBorderThemedFrame // The type of border style that is placed around the ReportControl, see ReportControl.BorderStyle
179 {Visibility = Private}
180 Property XTPReportColumnStyle private_peColumnStyle xtpColumnExplorer // Stores the style used to display ReportColumn headers. See ReportPaintManager.ColumnStyle.
181 {Visibility = Private}
182 Property XTPReportFreezeColsDividerStyle private_peFreezeColsDividerStyle xtpReportFreezeColsDividerDefault // Style of the freeze column divider. See ReportPaintManager.FreezeColsDividerStyle.
183 {Visibility = Private}
184 Property XTPReportGridStyle private_peHorizontalGridStyle xtpGridSolid // Style used to draw horizontal grid lines. See ReportPaintManager.HorizontalGridStyle.
185 {Visibility = Private}
186 Property XTPToolTipStyle private_peTooltipStyle xtpToolTipStandard // The Style Property gets\sets the style of the tool tip window. See TooltipContext.Style
187 {Visibility = Private}
188 Property XTPReportGridStyle private_peVerticalGridStyle xtpGridSolid // see cReportPaintManager.VerticalGridStyle
189 {Visibility = Private}
190 Property XTPReportWatermarkAlignment private_peWatermarkAlignment xtpReportWatermarkStretch // Gets or sets the alignment of the watermark., see ReportControl.WatermarkAlignment
191
192 {Visibility = Private}
193 Property Integer private_piAlternateRowBackgroundColor clNone // The background color of every second grid row. See ReportPaintManager.AlternativeBackgroundColor
194 {Visibility = Private}
195 Property Integer piDefaultAlternateRowBackColor clNone // Used to store the COM Object's default. This is a workaround as setting this COM property to -1 does not work.
196 {Visibility = Private}
197 Property Integer private_piHScrollStep 7 // Gets\sets the amount of pixels the report is scrolled when the horizontal scroll bar buttons are clicked., see ReportControl.HScrollStep
198 {Visibility = Private}
199 Property Integer private_piCaptionBackColor clNone // The background color of the column headers. See ReportPaintManager.CaptionBackColor.
200 {Visibility = Private}
201 Property Integer private_piCaptionBackGradientColorDark clNone // The "Dark" color in the color gradient used for the background color of "normal" column headers. See ReportPaintManager.CaptionBackGradientColorDark.
202 {Visibility = Private}
203 Property Integer private_piCaptionBackGradientColorLight clNone // The "Light" color in the color gradient used for the background color of "normal" column headers. See ReportPaintManager.CaptionBackGradientColorLight.
204 {Visibility = Private}
205 Property Integer private_piCaptionForeColor clNone // The forecolor\caption color of the column headers. See ReportPaintManager.CaptionForeColor.
206 {Visibility = Private}
207 Property Integer private_piColumnHotGradientColorDark clNone // The "Dark" color in the color gradient used for the background color of "hot" column headers. See ReportPaintManager.ColumnHotGradientColorDark.
208 {Visibility = Private}
209 Property Integer private_piColumnHotGradientColorLight clNone // The "Light" color in the color gradient used for the background color of "hot" column headers. See ReportPaintManager.ColumnHotGradientColorLight.
210 {Visibility = Private}
211 Property Integer private_piColumnPushedGradientColorDark clNone // The "Dark" color in the color gradient used for the background color of "pushed" column headers. See ReportPaintManager.ColumnPushedGradientColorDark.
212 {Visibility = Private}
213 Property Integer private_piColumnPushedGradientColorLight clNone // The "Light" color in the color gradient used for the background color of "pushed" column headers. See ReportPaintManager.ColumnPushedGradientColorLight.
214 {Visibility = Private}
215 Property Integer private_piHeaderHeightMultiplier -1 // number of fixed header rows (overrides cCJGridColumn.pbMultiLine), -1 or 0 = ignore.
216 {Visibility = Private}
217 Property Integer private_piFreezeColsDividerColor clNone // Color of the freeze column divider. See ReportPaintManager.FreezeColsDividerColor.
218 {Visibility = Private}
219 Property Integer private_piFreezeColumnsCount 0 // Gets\Sets the Number of columns that are frozen when the report is scrolled horizontally., see ReportControl.FreezeColumnsCount
220 {Visibility = Private}
221 Property Integer private_piGridLineColor clNone // The color used to draw grid lines. See ReportPaintManager.GridLineColor.
222 {Visibility = Private}
223 Property Integer private_piHighlightBackColor clNone // The background color of selected rows. See ReportPaintManager.HighlightBackColor.
224 {Visibility = Private}
225 Property Integer private_piHighlightForeColor clNone // The text color of selected rows. See ReportPaintManager.HighlightForeColor.
226 {Visibility = Private}
227 Property Integer private_piSelectedRowBackColor clNone // The background color of selected rows when grid doees not have the focus. See ReportPaintManager.SelectedRowBackColor.
228 {Visibility = Private}
229 Property Integer private_piSelectedRowForeColor clNone // The text color of selected rows when grid does not have the focus. See ReportPaintManager.SelectedRowForeColor.
230 {Visibility = Private}
231 Property Integer private_piHotDividerColor clNone // Gets\sets the color of the arrows used to Show where a column can be dropped when dragging a column header. See ReportPaintManager.HotDividerColor.
232 {Visibility = Private}
233 Property Integer private_piTooltipBkColor clNone // Gets\sets the background color of the tool tip window. See TooltipContext.TipBkColor
234 {Visibility = Private }
235 Property Integer private_piTooltipMaxWidth -1 // The MaxTipWidth Property gets\sets the maximum tool tip width in pixels. See TooltipContext.MaxTipWidth
236 {Visibility = Private}
237 Property Integer private_piTooltipTextColor clNone // Gets\sets the color of the text that is displayed in the tool tip window. See TooltipContext.TipTextColor
238
239 {Visibility = Private}
240 Property String private_psNoFieldsAvailableText "" // The "No Fields Available" text message displayed in the Field Chooser when no Column Headers are present. See ReportPaintManager.NoFieldsAvailableText.
241 {Visibility = Private}
242 Property String private_psNoItemsText "" // The "No Items" text message displayed in the ReportControl when there are no visible rows. See ReportPaintManager.NoItemsText.
243
244 {Visibility = Private}
245 Property Integer private_TextColor clNone // Default grid text color. see cReportPaintManager.ForeColor
246 {Visibility = Private}
247 Property Integer private_piShadeSortColor clNone // Default sorted column background. see cReportPaintManager.ShadeSortColor
248 {Visibility = Private}
249 Property Boolean private_pbShadeSortColumn False
250 {Visibility = Private}
251 Property XTPReportDrawSortTriangleStyle private_peDrawSortTriangleStyle xtpReportDrawSortTriangleAlways
252
253
254 // pbNavigateOutOfEditMode: Internal - Used to determine if the Tab, Shift Tab or Enter keys
255 // were used to navigate out of a cell that was being edited. This property is used to stop
256 // the navigated to cell from going into edit mode. See OnComRequestEdit.
257 {Visibility = Private}
258 Property Boolean pbNavigateOutOfEditMode False
259
260 {Visibility = Private }
261 Property Integer piLastImageId 0 // Used to assign sequential image IDs in the ImageManagerIcons object
262 {Visibility = Private }
263 Property Integer piTooltipMarginTop -1
264 {Visibility = Private }
265 Property Integer piTooltipMarginLeft -1
266 {Visibility = Private }
267 Property Integer piTooltipMarginBottom -1
268 {Visibility = Private }
269 Property Integer piTooltipMarginRight -1
270
271 {Visibility = Private }
272 Property Integer piBeginEditLockCount 0
273
274 {Visibility = Private}
275 Property String psWatermark "" // Internal: Used to set up the grid's watermark during OnCreate.
276 {Visibility = Private}
277 Property Integer piWatermarkTransparency -1 // Internal: Used to set up the grid's watermark during OnCreate.
278
279 Get CreateDataSource to hoDataSource
280 Set phoDataSource to hoDataSource
281
282 Get CreateFieldChooserPanel to hoFieldChooserPanel
283 Set phoFieldChooserPanel to hoFieldChooserPanel
284
285 Get CreateHeaderContextMenu to hoContextMenu
286 Set phoHeaderContextMenu to hoContextMenu
287
288 Get CreateContextMenu to hoContextMenu
289 Set phoContextMenu to hoContextMenu
290
291 Set peNeighborhood to nhNo
292 Set pbBindValue to False // don't attempt to bind to the Value property
293
294 { Category = "Behavior" }
295 Property Boolean pbValidateOnNext True
296 { DesignTime = False }
297 Property Boolean pbVirtualMode True
298 { Visibility = Private }
299 Property Handle phoCustomEdit 0
300
301 {Visibility = Private}
302 Property Handle phoIdleHandler (Create(Self, RefClass(cCJGridIdleHandler)))
303 {Visibility = Private}
304 Property Integer piLastTopRowIndex -1 // last topindex. Used to determine if scrolling in paint
305 {Visibility = Private}
306 Property Integer piLastVisibleRowCount -1 // last visible row count. Used to determine if scrolling in paint
307 {Visibility = Private}
308 Property Integer piSelectedColumn -1
309 {Visibility = Private}
310 Property Integer piLastKey 0
311 {Visibility = Private}
312 Property Integer piLastKey2 0
313 { Visibility=Private}
314 Property Integer private_pbFocusSubItems True
315 { Visibility=Private}
316 Property Integer private_pbEditOnKeyNavigation False
317 { Visibility=Private}
318 Property Boolean pbInRowFocusChanging False
319 { Visibility=Private}
320 Property Handle phoDeferredFocusColumn 0
321 { Visibility=Private}
322 Property Integer piDeferredRemoveRow -1
323 { Visibility=Private}
324 Property Boolean pbNoFocusChangeCheck False
325 { Visibility=Private}
326 Property Boolean pbNeedsRedraw False
327
328 { Category=Colors PropertyType=Color }
329 { EnumList= "clNone, clScrollBar, clBackground, clActiveCaption, clInactiveCaption, clMenu, clWindow, clWindowFrame, clMenuText, clWindowText, clCaptionText, clActiveBorder, clInactiveBorder" }
330 { EnumList+="clAppWorkSpace, clHighlight, clHighlightText, clBtnFace, clBtnShadow, clGrayText, clBtnText, clInactiveCaptionText, clBtnHighlight, cl3DDkShadow, cl3DLight, clInfoText, clInfoBk, clDefault" }
331 { EnumList+="clAqua, clBlack, clBlue, clDkGray, clFuchsia, clGray, clGreen, clLime, clLtGray, clMaroon, clNavy, clOlive, clPurple, clRed, clSilver, clTeal, clWhite, clYellow" }
332 Property Integer piFocusCellBackColor clNone // (RGB(217,222,243)) // Background color of the focused cell. clNone means that if pbSelectionEnable is true then piSelectedRowBackColor is used.
333
334 { Category=Colors PropertyType=Color }
335 { EnumList= "clNone, clScrollBar, clBackground, clActiveCaption, clInactiveCaption, clMenu, clWindow, clWindowFrame, clMenuText, clWindowText, clCaptionText, clActiveBorder, clInactiveBorder" }
336 { EnumList+="clAppWorkSpace, clHighlight, clHighlightText, clBtnFace, clBtnShadow, clGrayText, clBtnText, clInactiveCaptionText, clBtnHighlight, cl3DDkShadow, cl3DLight, clInfoText, clInfoBk, clDefault" }
337 { EnumList+="clAqua, clBlack, clBlue, clDkGray, clFuchsia, clGray, clGreen, clLime, clLtGray, clMaroon, clNavy, clOlive, clPurple, clRed, clSilver, clTeal, clWhite, clYellow" }
338 Property Integer piFocusCellForeColor clNone // clBlack // text color of the focused cell. clNone means that if pbSelectionEnable is true then piSelectedRowForeColor is used.
339
340 { Category=Colors PropertyType=Color }
341 { EnumList= "clScrollBar, clBackground, clActiveCaption, clInactiveCaption, clMenu, clWindow, clWindowFrame, clMenuText, clWindowText, clCaptionText, clActiveBorder, clInactiveBorder" }
342 { EnumList+="clAppWorkSpace, clHighlight, clHighlightText, clBtnFace, clBtnShadow, clGrayText, clBtnText, clInactiveCaptionText, clBtnHighlight, cl3DDkShadow, cl3DLight, clInfoText, clInfoBk, clDefault, clNone" }
343 { EnumList+="clAqua, clBlack, clBlue, clDkGray, clFuchsia, clGray, clGreen, clLime, clLtGray, clMaroon, clNavy, clOlive, clPurple, clRed, clSilver, clTeal, clWhite, clYellow" }
344 Property Integer piFocusCellRectangleColor 13138532 // pen color of the focused cell rectangle. See pbUseFocusCellRectangle
345
346 { Category = "Appearance" }
347 Property Boolean pbUseFocusCellRectangle True // draw focus rectangle of selected cell. See piFocusCellRectangleColor.
348 { Visibility=Private }
349 Property Boolean pbUseFocusCellColors True // draw focus cell background using piFocusCellBackColor & piFocusCellForeColor
350 { Category = "Behavior" }
351 Property Boolean pbReadOnly False // can change rows: in-place edit, save, delete, insert or append
352 { Category = "Behavior" }
353 Property Boolean pbAllowDeleteRow True // can delete rows
354 { Category = "Behavior" }
355 Property Boolean pbAutoSave True // attempt save on row change
356 { Category = "Behavior" }
357 Property Boolean pbAutoAppend True // append new rows when in add mode
358 { Category = "Behavior" }
359 Property Boolean pbAllowAppendRow True // can append a row to the end
360 { Category = "Behavior" }
361 Property Boolean pbAllowInsertRow True // can insert rows
362 { Category = "Behavior" }
363 Property String psLayoutSection '' // the developer must provide a unique string id for this.
364 { Category = "Behavior" }
365 Property Boolean pbRestoreLayout False
366 { Category = "Behavior" }
367 Property Integer piLayoutBuild 1
368 { Visibility=Private }
369 Property String psOriginalLayout ''
370 { Visibility=Private }
371 Property String psInstanceLayout ''
372 { Category=Behavior }
373 Property Boolean pbHeaderReorders False // click on header reorders
374 { Category=Behavior }
375 Property Boolean pbHeaderTogglesDirection False // click on header changes order direction
376 { Category=Behavior }
377 Property Boolean pbHeaderSelectsColumn False // click on header sets this as the selected column
378 { Category=Behavior }
379 Property Boolean pbHeaderPrompts False // click on header executes prompt if one exists
380 { Visibility=Private }
381 Property Boolean private_pbReverseOrdering False // current direction of ordering
382 { Visibility=Private }
383 Property Integer peGridMouseStatus gmsMouseStatusCleared // determines mouse down, up, moved status
384 { Visibility=Private }
385 Property Integer private_piSortColumn -1 // tracks current sort column
386 { DesignTime=False }
387 Property Integer piCurrentEditColumn -1 // tracks last column edited (including current edit)
388 { DesignTime=False }
389 Property Handle phoPriorScopeFocus 0
390 { DesignTime=False }
391 Property Handle pbNeedPostEntering False
392 { Category=Behavior }
393 Property Boolean pbEditOnTyping True
394 { Visibility=Private }
395 Property Boolean pbBeginEditOnIdle False // when set true, OnIdle will start edit-mode if appropriate
396
397 On_Key Key_Enter Send Default_Key // no behavior by default
398 On_Key Key_Up_Arrow Send Default_Key // no behavior by default
399 On_Key Key_Down_Arrow Send Default_Key // no behavior by default
400
401 On_Key Key_Ctrl+Key_Enter Send ToggleEdit
402 On_Key Key_Ctrl+Key_End Send MovetoLastRow
403 On_Key Key_Ctrl+Key_Home Send MovetoFirstRow
404 On_Key Key_Tab Send Next
405 On_Key Key_Shift+Key_Tab Send Previous
406 On_Key kSave_Record Send Request_Save
407 On_Key kDelete_Record Send Request_Delete
408 On_Key kClear Send Request_Clear
409 On_Key kAdd_Mode Send Request_InsertRow // shift F10 - insert or append row
410 On_Key kPrompt Send Prompt
411
412 End_Procedure // Construct_Object
413
414 // ------------------------------------------------------------------------
415 // Property Get/Set Methods................................................
416 // ------------------------------------------------------------------------
417
418 // Color
419
420 // The background color of the grid, see ReportPaintManager.BackColor
421 { MethodType=Property InitialValue=clNone }
422 { Category=Colors PropertyType=Color }
423 { EnumList= "clScrollBar, clBackground, clActiveCaption, clInactiveCaption, clMenu, clWindow, clWindowFrame, clMenuText, clWindowText, clCaptionText, clActiveBorder, clInactiveBorder" }
424 { EnumList+="clAppWorkSpace, clHighlight, clHighlightText, clBtnFace, clBtnShadow, clGrayText, clBtnText, clInactiveCaptionText, clBtnHighlight, cl3DDkShadow, cl3DLight, clInfoText, clInfoBk, clDefault, clNone" }
425 { EnumList+="clAqua, clBlack, clBlue, clDkGray, clFuchsia, clGray, clGreen, clLime, clLtGray, clMaroon, clNavy, clOlive, clPurple, clRed, clSilver, clTeal, clWhite, clYellow" }
426 Procedure Set Color Integer iValue
427 Handle hoPaintManager
428 Set Private_Color to iValue
429
430 If (IsComObjectCreated(Self)) Begin
431 Get ConvertSystemColor iValue to iValue
432 Get phoReportPaintManager to hoPaintManager
433 Set ComBackColor of hoPaintManager to iValue
434 Send DeferredRedraw // ComRedraw
435 End
436 End_Procedure
437
438 Function Color Returns Integer
439 Integer iValue
440 Handle hoPaintManager
441
442 If (IsComObjectCreated(Self)) Begin
443 Get phoReportPaintManager to hoPaintManager
444 Get ComBackColor of hoPaintManager to iValue
445 End
446 Else Begin
447 Get private_Color to iValue
448 End
449 Function_Return iValue
450 End_Function
451
452 // Enabled_State
453
454 // Augmented to set/return ReportControl.Enabled
455 Procedure Set Enabled_State Integer bValue
456 Set private_Enabled_State to bValue
457 If (IsComObjectCreated(Self)) Begin
458 Set ComEnabled to bValue
459 End
460 End_Procedure
461
462 Function Enabled_State Returns Integer
463 Boolean bValue
464 If (IsComObjectCreated(Self)) Begin
465 Get ComEnabled to bValue
466 End
467 Else Begin
468 Get private_Enabled_State to bValue
469 End
470 Function_Return bValue
471 End_Function
472
473 // pbAllowColumnRemove
474
475 // Specifies whether ReportColumns can be removed from the ReportControl, see ReportControl.AllowColumnRemove
476 { MethodType=Property InitialValue=True }
477 { Category=Behavior }
478 Procedure Set pbAllowColumnRemove Boolean bValue
479 Set private_pbAllowColumnRemove to bValue
480 If (IsComObjectCreated(Self)) Begin
481 Set ComAllowColumnRemove to bValue
482 End
483 End_Procedure
484
485 { MethodType=Property }
486 Function pbAllowColumnRemove Returns Boolean
487 Boolean bValue
488 If (IsComObjectCreated(Self)) Begin
489 Get ComAllowColumnRemove to bValue
490 End
491 Else Begin
492 Get private_pbAllowColumnRemove to bValue
493 End
494 Function_Return bValue
495 End_Function
496
497 // pbAllowColumnReorder
498
499 // Specifies whether ReportColumns can be reordered in the ReportControl, see ReportControl.AllowColumnReorder
500 { MethodType=Property InitialValue=True }
501 { Category=Behavior }
502 Procedure Set pbAllowColumnReorder Boolean bValue
503 Set private_pbAllowColumnReorder to bValue
504 If (IsComObjectCreated(Self)) Begin
505 Set ComAllowColumnReorder to bValue
506 End
507 End_Procedure
508
509 { MethodType=Property }
510 Function pbAllowColumnReorder Returns Boolean
511 Boolean bValue
512 If (IsComObjectCreated(Self)) Begin
513 Get ComAllowColumnReorder to bValue
514 End
515 Else Begin
516 Get private_pbAllowColumnReorder to bValue
517 End
518 Function_Return bValue
519 End_Function
520
521 // pbAllowColumnResize
522
523 // Specifies whether ReportColumns can be resized, see ReportControl.AllowColumnResize
524 { MethodType=Property InitialValue=True }
525 { Category=Behavior }
526 Procedure Set pbAllowColumnResize Boolean bValue
527 Set private_pbAllowColumnResize to bValue
528 If (IsComObjectCreated(Self)) Begin
529 Set ComAllowColumnResize to bValue
530 End
531 End_Procedure
532
533 { MethodType=Property }
534 Function pbAllowColumnResize Returns Boolean
535 Boolean bValue
536 If (IsComObjectCreated(Self)) Begin
537 Get ComAllowColumnResize to bValue
538 End
539 Else Begin
540 Get private_pbAllowColumnResize to bValue
541 End
542 Function_Return bValue
543 End_Function
544
545 // pbAllowEdit:
546
547 // Allows the text in all cells to be edited by default. see cReportControl.AllowEdit
548 { MethodType=Property InitialValue=True }
549 { Category=Behavior }
550 Procedure Set pbAllowEdit Boolean bValue
551 Set private_pbAllowEdit to bValue
552 If (IsComObjectCreated(Self)) Begin
553 Set ComAllowEdit to bValue
554 End
555 End_Procedure
556
557 { MethodType=Property }
558 Function pbAllowEdit Returns Boolean
559 Boolean bValue
560 If (IsComObjectCreated(Self)) Begin
561 Get ComAllowEdit to bValue
562 End
563 Else Begin
564 Get private_pbAllowEdit to bValue
565 End
566 Function_Return bValue
567 End_Function
568
569 // pbAutoColumnSizing
570
571 // Specifies If AutoColumnSizing should be used, see ReportControl.AutoColumnSizing
572 { MethodType=Property InitialValue=True }
573 { Category=Appearance }
574 Procedure Set pbAutoColumnSizing Boolean bValue
575 Set private_pbAutoColumnSizing to bValue
576 If (IsComObjectCreated(Self)) Begin
577 Set ComAutoColumnSizing to bValue
578 End
579 End_Procedure
580
581 { MethodType=Property }
582 Function pbAutoColumnSizing Returns Boolean
583 Boolean bValue
584 If (IsComObjectCreated(Self)) Begin
585 Get ComAutoColumnSizing to bValue
586 End
587 Else Begin
588 Get private_pbAutoColumnSizing to bValue
589 End
590 Function_Return bValue
591 End_Function
592
593 // pbDrawGridForEmptySpace
594
595 // Gets or sets wether grid lines will be drawn after the body of rows to fill the empty space. See ReportPaintManager.DrawGridForEmptySpace.
596 { MethodType=Property InitialValue=True }
597 { Category=Appearance }
598 Procedure Set pbDrawGridForEmptySpace Boolean bValue
599 Handle hoPaintManager
600 Set private_pbDrawGridForEmptySpace to bValue
601
602 If (IsComObjectCreated(Self)) Begin
603 Get phoReportPaintManager to hoPaintManager
604 Set ComDrawGridForEmptySpace of hoPaintManager to bValue
605 End
606 End_Procedure
607
608 { MethodType=Property }
609 Function pbDrawGridForEmptySpace Returns Boolean
610 Boolean bValue
611 Handle hoPaintManager
612
613 If (IsComObjectCreated(Self)) Begin
614 Get phoReportPaintManager to hoPaintManager
615 Get ComDrawGridForEmptySpace of hoPaintManager to bValue
616 End
617 Else Begin
618 Get private_pbDrawGridForEmptySpace to bValue
619 End
620 Function_Return bValue
621 End_Function
622
623 // pbEditOnClick
624
625 // Determine whether a ReportRecorditem can be edited by single-clicking on the item., see ReportControl.EditOnClick
626 { MethodType=Property InitialValue=False }
627 { Category=Behavior }
628 Procedure Set pbEditOnClick Boolean bValue
629 Set private_pbEditOnClick to bValue
630 If (IsComObjectCreated(Self)) Begin
631 Set ComEditOnClick to bValue
632 End
633 End_Procedure
634
635 { MethodType=Property }
636 Function pbEditOnClick Returns Boolean
637 Boolean bValue
638 If (IsComObjectCreated(Self)) Begin
639 Get ComEditOnClick to bValue
640 End
641 Else Begin
642 Get private_pbEditOnClick to bValue
643 End
644 Function_Return bValue
645 End_Function
646
647 // pbFixedInplaceButtonHeight
648
649 // Specifies whether the paint manager supports fixed height of in-place buttons, see ReportControl.FixedInplaceButtonHeight
650 { MethodType=Property InitialValue=False }
651 { Category=Appearance }
652 Procedure Set pbFixedInplaceButtonHeight Boolean bValue
653 Handle hoPaintManager
654 Set private_pbFixedInplaceButtonHeight to bValue
655
656 If (IsComObjectCreated(Self)) Begin
657 Get phoReportPaintManager to hoPaintManager
658 Set ComFixedInplaceButtonHeight of hoPaintManager to bValue
659 End
660 End_Procedure
661
662 { MethodType=Property }
663 Function pbFixedInplaceButtonHeight Returns Boolean
664 Boolean bValue
665 Handle hoPaintManager
666
667 If (IsComObjectCreated(Self)) Begin
668 Get phoReportPaintManager to hoPaintManager
669 Get ComFixedInplaceButtonHeight of hoPaintManager to bValue
670 End
671 Else Begin
672 Get private_pbFixedInplaceButtonHeight to bValue
673 End
674 Function_Return bValue
675 End_Function
676
677 // pbFocusSubItems:
678
679 // If True, when a cell is clicked, the entire row will become highlighted except the individual cell that was clicked.
680 // If False, the entire row will become highlighted when an item is clicked, including the item that was clicked.
681 // Also controls the ability of the grid control to address individual cells.
682 // See cReportControl.FocusSubItems
683 { MethodType=Property InitialValue=True }
684 { Category=Behavior }
685 Procedure Set pbFocusSubItems Boolean bValue
686 Set private_pbFocusSubItems to bValue
687 If (IsComObjectCreated(Self)) Begin
688 Set ComFocusSubItems to bValue
689 // if columns cannot be focused, set column to -1
690 If (not(bValue)) Begin
691 Send NewColumn -1
692 End
693 End
694 End_Procedure
695
696 { MethodType=Property }
697 Function pbFocusSubItems Returns Boolean
698 Boolean bValue
699 If (IsComObjectCreated(Self)) Begin
700 Get ComFocusSubItems to bValue
701 End
702 Else Begin
703 Get private_pbFocusSubItems to bValue
704 End
705 Function_Return bValue
706 End_Function
707
708 // pbFullColumnScrolling
709
710 // Specifies whether full column scrolling will be used., see ReportControl.FullColumnScrolling
711 { MethodType=Property InitialValue=False}
712 { Category=Behavior }
713 Procedure Set pbFullColumnScrolling Boolean bValue
714 Set private_pbFullColumnScrolling to bValue
715 If (IsComObjectCreated(Self)) Begin
716 Set ComFullColumnScrolling to bValue
717 End
718 End_Procedure
719
720 { MethodType=Property }
721 Function pbFullColumnScrolling Returns Boolean
722 Boolean bValue
723 If (IsComObjectCreated(Self)) Begin
724 Get ComFullColumnScrolling to bValue
725 End
726 Else Begin
727 Get private_pbFullColumnScrolling to bValue
728 End
729 Function_Return bValue
730 End_Function
731
732 // pbGrayIfDisable
733
734 // Specifies whether to draw the report using "normal" colors or standard Windows disabled colors when the report control disabled. See ReportPaintManager.GrayIfDisable.
735 { MethodType=Property InitialValue=True }
736 { Category=Appearance }
737 Procedure Set pbGrayIfDisable Boolean bValue
738 Handle hoPaintManager
739 Set private_pbGrayIfDisable to bValue
740
741 If (IsComObjectCreated(Self)) Begin
742 Get phoReportPaintManager to hoPaintManager
743 Set ComGrayIfDisable of hoPaintManager to bValue
744 End
745 End_Procedure
746
747 { MethodType=Property }
748 Function pbGrayIfDisable Returns Boolean
749 Boolean bValue
750 Handle hoPaintManager
751
752 If (IsComObjectCreated(Self)) Begin
753 Get phoReportPaintManager to hoPaintManager
754 Get ComGrayIfDisable of hoPaintManager to bValue
755 End
756 Else Begin
757 Get private_pbGrayIfDisable to bValue
758 End
759 Function_Return bValue
760 End_Function
761
762 // pbHideSelection
763
764 // Determines whether the currently selected rows will remain shaded when the ReportControl loses focus. See ReportPaintManager.HideSelection.
765 { MethodType=Property InitialValue=False }
766 { Category=Appearance }
767 Procedure Set pbHideSelection Boolean bValue
768 Handle hoPaintManager
769 Set private_pbHideSelection to bValue
770
771 If (IsComObjectCreated(Self)) Begin
772 Get phoReportPaintManager to hoPaintManager
773 Set ComHideSelection of hoPaintManager to bValue
774 End
775 End_Procedure
776
777 { MethodType=Property }
778 Function pbHideSelection Returns Boolean
779 Boolean bValue
780 Handle hoPaintManager
781
782 If (IsComObjectCreated(Self)) Begin
783 Get phoReportPaintManager to hoPaintManager
784 Get ComHideSelection of hoPaintManager to bValue
785 End
786 Else Begin
787 Get private_pbHideSelection to bValue
788 End
789 Function_Return bValue
790 End_Function
791
792 // pbHotTracking
793
794 // Gets\Set whether hot tracking is used While moving the mouse over the column header when using the "Explorer" or "Office 2003" column styles. See ReportPaintManager.HotTracking.
795 { MethodType=Property InitialValue=False }
796 { Category=Appearance }
797 Procedure Set pbHotTracking Boolean bValue
798 Handle hoPaintManager
799 Set private_pbHotTracking to bValue
800
801 If (IsComObjectCreated(Self)) Begin
802 Get phoReportPaintManager to hoPaintManager
803 Set ComHotTracking of hoPaintManager to bValue
804 End
805 End_Procedure
806
807 { MethodType=Property }
808 Function pbHotTracking Returns Boolean
809 Boolean bValue
810 Handle hoPaintManager
811
812 If (IsComObjectCreated(Self)) Begin
813 Get phoReportPaintManager to hoPaintManager
814 Get ComHotTracking of hoPaintManager to bValue
815 End
816 Else Begin
817 Get private_pbHotTracking to bValue
818 End
819 Function_Return bValue
820 End_Function
821
822 // pbInitialSelectionEnable
823
824 // Specifies whether the first row in the report will become selected when initially populated., see ReportControl.InitialSelectionEnable
825 { MethodType=Property InitialValue=True }
826 { Category=Behavior }
827 Procedure Set pbInitialSelectionEnable Boolean bValue
828 Set private_pbInitialSelectionEnable to bValue
829 If (IsComObjectCreated(Self)) Begin
830 Set ComInitialSelectionEnable to bValue
831 End
832 End_Procedure
833
834 { MethodType=Property }
835 Function pbInitialSelectionEnable Returns Boolean
836 Boolean bValue
837 If (IsComObjectCreated(Self)) Begin
838 Get ComInitialSelectionEnable to bValue
839 End
840 Else Begin
841 Get private_pbInitialSelectionEnable to bValue
842 End
843 Function_Return bValue
844 End_Function
845
846 // pbMultipleSelection:
847
848 // Specifies whether multiple rows can be selected at the same time, see cReportControl.MultipleSelection
849 { MethodType=Property InitialValue=False }
850 { Category=Behavior }
851 Procedure Set pbMultipleSelection Boolean bValue
852 Set private_pbMultipleSelection to bValue
853 If (IsComObjectCreated(Self)) Begin
854 Set ComMultipleSelection to bValue
855 End
856 End_Procedure
857
858 { MethodType=Property }
859 Function pbMultipleSelection Returns Boolean
860 Boolean bValue
861 If (IsComObjectCreated(Self)) Begin
862 Get ComMultipleSelection to bValue
863 End
864 Else Begin
865 Get private_pbMultipleSelection to bValue
866 End
867 Function_Return bValue
868 End_Function
869
870 // pbMultiSelectionMode
871
872 // Enables/disables the multiple selection mode for the control., see ReportControl.MultiSelectionMode
873 { MethodType=Property InitialValue=False }
874 { Category=Behavior }
875 Procedure Set pbMultiSelectionMode Boolean bValue
876 Set private_pbMultiSelectionMode to bValue
877 If (IsComObjectCreated(Self)) Begin
878 Set ComMultiSelectionMode to bValue
879 End
880 End_Procedure
881
882 { MethodType=Property }
883 Function pbMultiSelectionMode Returns Boolean
884 Boolean bValue
885 If (IsComObjectCreated(Self)) Begin
886 Get ComMultiSelectionMode to bValue
887 End
888 Else Begin
889 Get private_pbMultiSelectionMode to bValue
890 End
891 Function_Return bValue
892 End_Function
893
894 // pbSelectionEnable
895
896 // Gets or sets whether rows will become selected when clicked or navigated with the arrow keys., see ReportControl.SelectionEnable
897 { MethodType=Property InitialValue=False }
898 { Category=Behavior }
899 Procedure Set pbSelectionEnable Boolean bValue
900 Set private_pbSelectionEnable to bValue
901 If (IsComObjectCreated(Self)) Begin
902 Set ComSelectionEnable to bValue
903 End
904 End_Procedure
905
906 { MethodType=Property }
907 Function pbSelectionEnable Returns Boolean
908 Boolean bValue
909 If (IsComObjectCreated(Self)) Begin
910 Get ComSelectionEnable to bValue
911 End
912 Else Begin
913 Get private_pbSelectionEnable to bValue
914 End
915 Function_Return bValue
916 End_Function
917
918 // pbShowNonActiveInPlaceButton
919
920 // Specifies whether to Show NonActive InPlace Buttons (Combo, Expand, Spin) all the Time. See ReportPaintManager.ShowNonActiveInPlaceButton.
921 { MethodType=Property InitialValue=False }
922 { Category=Appearance }
923 Procedure Set pbShowNonActiveInPlaceButton Boolean bValue
924 Handle hoPaintManager
925 Set private_pbShowNonActiveInPlaceButton to bValue
926
927 If (IsComObjectCreated(Self)) Begin
928 Get phoReportPaintManager to hoPaintManager
929 Set ComShowNonActiveInPlaceButton of hoPaintManager to bValue
930 End
931 End_Procedure
932
933 { MethodType=Property }
934 Function pbShowNonActiveInPlaceButton Returns Boolean
935 Boolean bValue
936 Handle hoPaintManager
937
938 If (IsComObjectCreated(Self)) Begin
939 Get phoReportPaintManager to hoPaintManager
940 Get ComShowNonActiveInPlaceButton of hoPaintManager to bValue
941 End
942 Else Begin
943 Get private_pbShowNonActiveInPlaceButton to bValue
944 End
945 Function_Return bValue
946 End_Function
947
948 // pbShowRowFocus:
949
950 // Specifies whether to draw a focus rectangle around the focused row, see cReportControl.ShowRowFocus
951 { MethodType=Property InitialValue=False }
952 { Category=Appearance }
953 Procedure Set pbShowRowFocus Boolean bValue
954 Set private_pbShowRowFocus to bValue
955 If (IsComObjectCreated(Self)) Begin
956 Set ComShowRowFocus to bValue
957 End
958 End_Procedure
959
960 { MethodType=Property }
961 Function pbShowRowFocus Returns Boolean
962 Boolean bValue
963 If (IsComObjectCreated(Self)) Begin
964 Get ComShowRowFocus to bValue
965 End
966 Else Begin
967 Get private_pbShowRowFocus to bValue
968 End
969 Function_Return bValue
970 End_Function
971
972 // pbShowFooter
973
974 // Shows\Hides the report column footer., see ReportControl.ShowFooter
975 { MethodType=Property InitialValue=False }
976 { Category=Appearance }
977 Procedure Set pbShowFooter Boolean bValue
978 Set private_pbShowFooter to bValue
979 If (IsComObjectCreated(Self)) Begin
980 Set ComShowFooter to bValue
981 End
982 End_Procedure
983
984 { MethodType=Property }
985 Function pbShowFooter Returns Boolean
986 Boolean bValue
987 If (IsComObjectCreated(Self)) Begin
988 Get ComShowFooter to bValue
989 End
990 Else Begin
991 Get private_pbShowFooter to bValue
992 End
993 Function_Return bValue
994 End_Function
995
996 // pbShowHeader
997
998 // The ShowHeader Property is used to hide or display the Column Headers in the Report Control., see ReportControl.ShowHeader
999 { MethodType=Property InitialValue=True }
1000 { Category=Appearance }
1001 Procedure Set pbShowHeader Boolean bValue
1002 Set private_pbShowHeader to bValue
1003 If (IsComObjectCreated(Self)) Begin
1004 Set ComShowHeader to bValue
1005 End
1006 End_Procedure
1007
1008 { MethodType=Property }
1009 Function pbShowHeader Returns Boolean
1010 Boolean bValue
1011 If (IsComObjectCreated(Self)) Begin
1012 Get ComShowHeader to bValue
1013 End
1014 Else Begin
1015 Get private_pbShowHeader to bValue
1016 End
1017 Function_Return bValue
1018 End_Function
1019
1020 // pbEditOnKeyNavigation
1021
1022 // Determines the behavior of Tab Key Navigation. When False, the default Grid control behavior is applied. When True,
1023 // the appication can trap the Tab key to alter its behavior.
1024 // See cReportControl.TrapTabKey
1025 { MethodType=Property InitialValue=False }
1026 { Category=Behavior }
1027 Procedure Set pbEditOnKeyNavigation Boolean bValue
1028 Set private_pbEditOnKeyNavigation to bValue
1029 If (IsComObjectCreated(Self)) Begin
1030 Set ComTrapTabKey to (not(bValue))
1031// If (bValue) Begin
1032// Send NewColumn -1
1033// End
1034 End
1035 End_Procedure
1036
1037 { MethodType=Property }
1038 Function pbEditOnKeyNavigation Returns Boolean
1039 Boolean bValue
1040 If (IsComObjectCreated(Self)) Begin
1041 Get ComTrapTabKey to bValue
1042 Move (not(bValue)) to bValue
1043 End
1044 Else Begin
1045 Get private_pbEditOnKeyNavigation to bValue
1046 End
1047 Function_Return bValue
1048 End_Function
1049
1050 // pbUseAlternateRowBackgroundColor
1051
1052 // Specifies whether to use the piAlternateRowBackgroundColor to color the background of every second row. See ReportPaintManager.UseAlternativeBackground.
1053 { MethodType=Property InitialValue=False }
1054 { Category=Appearance }
1055 Procedure Set pbUseAlternateRowBackgroundColor Boolean bValue
1056 Handle hoPaintManager
1057 Set private_pbUseAlternateRowBackgroundColor to bValue
1058
1059 If (IsComObjectCreated(Self)) Begin
1060 Get phoReportPaintManager to hoPaintManager
1061 Set ComUseAlternativeBackground of hoPaintManager to bValue
1062 End
1063 End_Procedure
1064
1065 { MethodType=Property }
1066 Function pbUseAlternateRowBackgroundColor Returns Boolean
1067 Boolean bValue
1068 Handle hoPaintManager
1069
1070 If (IsComObjectCreated(Self)) Begin
1071 Get phoReportPaintManager to hoPaintManager
1072 Get ComUseAlternativeBackground of hoPaintManager to bValue
1073 End
1074 Else Begin
1075 Get private_pbUseAlternateRowBackgroundColor to bValue
1076 End
1077 Function_Return bValue
1078 End_Function
1079
1080 // pbUseColumnTextAlignment
1081
1082 // The UseColumnTextAlignment Property specifies whether the text in the column header will Use the ReportColumn.Alignment setting to align the header caption. See ReportPaintManager.UseColumnTextAlignment.
1083 { MethodType=Property InitialValue=True }
1084 { Category=Appearance }
1085 Procedure Set pbUseColumnTextAlignment Boolean bValue
1086 Handle hoPaintManager
1087 Set private_pbUseColumnTextAlignment to bValue
1088
1089 If (IsComObjectCreated(Self)) Begin
1090 Get phoReportPaintManager to hoPaintManager
1091 Set ComUseColumnTextAlignment of hoPaintManager to bValue
1092 End
1093 End_Procedure
1094
1095 { MethodType=Property }
1096 Function pbUseColumnTextAlignment Returns Boolean
1097 Boolean bValue
1098 Handle hoPaintManager
1099
1100 If (IsComObjectCreated(Self)) Begin
1101 Get phoReportPaintManager to hoPaintManager
1102 Get ComUseColumnTextAlignment of hoPaintManager to bValue
1103 End
1104 Else Begin
1105 Get private_pbUseColumnTextAlignment to bValue
1106 End
1107 Function_Return bValue
1108 End_Function
1109
1110 // pbUseEditTextAlignment
1111
1112 // Specifies whether the ReportColumn.Alignment setting is automatically applied to items when in edit mode. See ReportPaintManager.UseEditTextAlignment.
1113 { MethodType=Property InitialValue=True }
1114 { Category=Appearance }
1115 Procedure Set pbUseEditTextAlignment Boolean bValue
1116 Handle hoPaintManager
1117 Set private_pbUseEditTextAlignment to bValue
1118
1119 If (IsComObjectCreated(Self)) Begin
1120 Get phoReportPaintManager to hoPaintManager
1121 Set ComUseEditTextAlignment of hoPaintManager to bValue
1122 End
1123 End_Procedure
1124
1125 { MethodType=Property }
1126 Function pbUseEditTextAlignment Returns Boolean
1127 Boolean bValue
1128 Handle hoPaintManager
1129
1130 If (IsComObjectCreated(Self)) Begin
1131 Get phoReportPaintManager to hoPaintManager
1132 Get ComUseEditTextAlignment of hoPaintManager to bValue
1133 End
1134 Else Begin
1135 Get private_pbUseEditTextAlignment to bValue
1136 End
1137 Function_Return bValue
1138 End_Function
1139
1140 // peBorderStyle
1141
1142 // The type of border style that is placed around the ReportControl, see ReportControl.BorderStyle
1143 { MethodType=Property InitialValue=xtpBorderThemedFrame }
1144 { Category=Appearance }
1145 { EnumList="xtpBorderNone, xtpBorderFlat, xtpBorderStaticEdge, xtpBorderClientEdge, xtpBorderFrame, xtpBorderThemedFrame" }
1146 Procedure Set peBorderStyle XTPReportBorderStyle eValue
1147 Set private_peBorderStyle to eValue
1148 If (IsComObjectCreated(Self)) Begin
1149 Set ComBorderStyle to eValue
1150 End
1151 End_Procedure
1152
1153 { MethodType=Property }
1154 Function peBorderStyle Returns XTPReportBorderStyle
1155 XTPReportBorderStyle eValue
1156 If (IsComObjectCreated(Self)) Begin
1157 Get ComBorderStyle to eValue
1158 End
1159 Else Begin
1160 Get private_peBorderStyle to eValue
1161 End
1162 Function_Return eValue
1163 End_Function
1164
1165 // peColumnStyle
1166
1167 // Stores the style used to display ReportColumn headers. See ReportPaintManager.ColumnStyle.
1168 { MethodType=Property InitialValue=xtpColumnExplorer }
1169 { Category=Appearance }
1170 { EnumList="xtpColumnShaded, xtpColumnFlat, xtpColumnExplorer, xtpColumnOffice2003, xtpColumnOffice2007" }
1171 Procedure Set peColumnStyle XTPReportColumnStyle iValue
1172 Handle hoPaintManager
1173 Set private_peColumnStyle to iValue
1174
1175 If (IsComObjectCreated(Self)) Begin
1176 Get phoReportPaintManager to hoPaintManager
1177 Set ComColumnStyle of hoPaintManager to iValue
1178 Send DeferredRedraw // ComRedraw
1179 End
1180 End_Procedure
1181
1182 { MethodType=Property }
1183 Function peColumnStyle Returns XTPReportColumnStyle
1184 XTPReportColumnStyle iValue
1185 Handle hoPaintManager
1186
1187 If (IsComObjectCreated(Self)) Begin
1188 Get phoReportPaintManager to hoPaintManager
1189 Get ComColumnStyle of hoPaintManager to iValue
1190 End
1191 Else Begin
1192 Get private_peColumnStyle to iValue
1193 End
1194 Function_Return iValue
1195 End_Function
1196
1197 // peFreezeColsDividerStyle
1198
1199 // Style of the freeze column divider. See ReportPaintManager.FreezeColsDividerStyle.
1200 { MethodType=Property InitialValue=xtpReportFreezeColsDividerDefault }
1201 { Category=Appearance }
1202 { EnumList="xtpReportFreezeColsDividerDefault, xtpReportFreezeColsDividerThin, xtpReportFreezeColsDividerBold, xtpReportFreezeColsDividerHeader, xtpReportFreezeColsDividerShade, xtpReportFreezeColsDividerShowAlways" }
1203 Procedure Set peFreezeColsDividerStyle XTPReportFreezeColsDividerStyle iValue
1204 Handle hoPaintManager
1205 Set private_peFreezeColsDividerStyle to iValue
1206
1207 If (IsComObjectCreated(Self)) Begin
1208 Get phoReportPaintManager to hoPaintManager
1209 Set ComFreezeColsDividerStyle of hoPaintManager to iValue
1210 Send DeferredRedraw // ComRedraw
1211 End
1212 End_Procedure
1213
1214 { MethodType=Property }
1215 Function peFreezeColsDividerStyle Returns XTPReportFreezeColsDividerStyle
1216 XTPReportFreezeColsDividerStyle iValue
1217 Handle hoPaintManager
1218
1219 If (IsComObjectCreated(Self)) Begin
1220 Get phoReportPaintManager to hoPaintManager
1221 Get ComFreezeColsDividerStyle of hoPaintManager to iValue
1222 End
1223 Else Begin
1224 Get private_peFreezeColsDividerStyle to iValue
1225 End
1226 Function_Return iValue
1227 End_Function
1228
1229 // peHorizontalGridStyle:
1230
1231 // Style used to draw horizontal grid lines. See ReportPaintManager.HorizontalGridStyle.
1232 { MethodType=Property InitialValue=xtpGridSolid }
1233 { Category=Appearance }
1234 { EnumList="xtpGridSolid, xtpGridNoLines, xtpGridSmallDots , xtpGridLargeDots, xtpGridDashes" }
1235 Procedure Set peHorizontalGridStyle XTPReportGridStyle iValue
1236 Handle hoPaintManager
1237 Set private_peHorizontalGridStyle to iValue
1238
1239 If (IsComObjectCreated(Self)) Begin
1240 Get phoReportPaintManager to hoPaintManager
1241 Set ComHorizontalGridStyle of hoPaintManager to iValue
1242 Send DeferredRedraw // ComRedraw
1243 End
1244 End_Procedure
1245
1246 { MethodType=Property }
1247 Function peHorizontalGridStyle Returns XTPReportGridStyle
1248 Integer iValue
1249 Handle hoPaintManager
1250
1251 If (IsComObjectCreated(Self)) Begin
1252 Get phoReportPaintManager to hoPaintManager
1253 Get ComHorizontalGridStyle of hoPaintManager to iValue
1254 End
1255 Else Begin
1256 Get private_peHorizontalGridStyle to iValue
1257 End
1258 Function_Return iValue
1259 End_Function
1260
1261 // peTooltipStyle
1262
1263 // The Style Property gets\sets the style of the tool tip window. See TooltipContext.Style.
1264 { MethodType=Property InitialValue=xtpToolTipStandard }
1265 { Category="Tooltip" }
1266 { EnumList="xtpToolTipStandard, xtpToolTipBalloon, xtpToolTipOffice, xtpToolTipRTF, xtpToolTipLuna, xtpToolTipOffice2007, xtpToolTipHTML, xtpToolTipMarkup" }
1267 Procedure Set peTooltipStyle XTPToolTipStyle iValue
1268 Handle hoTooltipContext
1269 Set private_peTooltipStyle to iValue
1270
1271 If (IsComObjectCreated(Self)) Begin
1272 Get phoToolTipContext to hoTooltipContext
1273 Set ComStyle of hoTooltipContext to iValue
1274 End
1275 End_Procedure
1276
1277 { MethodType=Property }
1278 Function peTooltipStyle Returns XTPToolTipStyle
1279 Integer iValue
1280 Handle hoToolTipContext
1281
1282 If (IsComObjectCreated(Self)) Begin
1283 Get phoToolTipContext to hoTooltipContext
1284 Get ComStyle of hoTooltipContext to iValue
1285 End
1286 Else Begin
1287 Get private_peTooltipStyle to iValue
1288 End
1289 Function_Return iValue
1290 End_Function
1291
1292 // peVerticalGridStyle:
1293
1294 // Style used to draw vertical grid lines, see cReportPaintManager.VerticalGridStyle
1295 { MethodType=Property InitialValue=xtpGridSolid }
1296 { Category=Appearance }
1297 { EnumList="xtpGridSolid, xtpGridNoLines, xtpGridSmallDots , xtpGridLargeDots, xtpGridDashes" }
1298 Procedure Set peVerticalGridStyle XTPReportGridStyle iValue
1299 Handle hoPaintManager
1300 Set private_peVerticalGridStyle to iValue
1301
1302 If (IsComObjectCreated(Self)) Begin
1303 Get phoReportPaintManager to hoPaintManager
1304 Set ComVerticalGridStyle of hoPaintManager to iValue
1305 Send DeferredRedraw // ComRedraw
1306 End
1307 End_Procedure
1308
1309 { MethodType=Property }
1310 Function peVerticalGridStyle Returns XTPReportGridStyle
1311 Integer iValue
1312 Handle hoPaintManager
1313
1314 If (IsComObjectCreated(Self)) Begin
1315 Get phoReportPaintManager to hoPaintManager
1316 Get ComVerticalGridStyle of hoPaintManager to iValue
1317 End
1318 Else Begin
1319 Get private_peVerticalGridStyle to iValue
1320 End
1321 Function_Return iValue
1322 End_Function
1323
1324 // peWatermarkAlignment
1325
1326 // Gets or sets the alignment of the watermark., see ReportControl.WatermarkAlignment
1327 { MethodType=Property InitialValue=xtpReportWatermarkStretch }
1328 { Category=Appearance }
1329 { EnumList = "xtpReportWatermarkUnknown, xtpReportWatermarkLeft, xtpReportWatermarkCenter, xtpReportWatermarkRight" }
1330 { EnumList +="xtpReportWatermarkTop, xtpReportWatermarkVCenter, xtpReportWatermarkBottom, xtpReportWatermarkStretch" }
1331 Procedure Set peWatermarkAlignment XTPReportWatermarkAlignment eValue
1332 Set private_peWatermarkAlignment to eValue
1333 If (IsComObjectCreated(Self)) Begin
1334 Set ComWatermarkAlignment to eValue
1335 End
1336 End_Procedure
1337
1338 { MethodType=Property }
1339 Function peWatermarkAlignment Returns XTPReportWatermarkAlignment
1340 XTPReportWatermarkAlignment eValue
1341 If (IsComObjectCreated(Self)) Begin
1342 Get ComWatermarkAlignment to eValue
1343 End
1344 Else Begin
1345 Get private_peWatermarkAlignment to eValue
1346 End
1347 Function_Return eValue
1348 End_Function
1349
1350 // piAlternateRowBackgroundColor
1351
1352 // The background color of every second grid row. See ReportPaintManager.AlternativeBackgroundColor
1353 { MethodType=Property InitialValue=clNone }
1354 { Category=Colors PropertyType=Color }
1355 { EnumList= "clScrollBar, clBackground, clActiveCaption, clInactiveCaption, clMenu, clWindow, clWindowFrame, clMenuText, clWindowText, clCaptionText, clActiveBorder, clInactiveBorder" }
1356 { EnumList+="clAppWorkSpace, clHighlight, clHighlightText, clBtnFace, clBtnShadow, clGrayText, clBtnText, clInactiveCaptionText, clBtnHighlight, cl3DDkShadow, cl3DLight, clInfoText, clInfoBk, clDefault, clNone" }
1357 { EnumList+="clAqua, clBlack, clBlue, clDkGray, clFuchsia, clGray, clGreen, clLime, clLtGray, clMaroon, clNavy, clOlive, clPurple, clRed, clSilver, clTeal, clWhite, clYellow" }
1358 Procedure Set piAlternateRowBackgroundColor Integer iValue
1359 Handle hoPaintManager
1360 Set private_piAlternateRowBackgroundColor to iValue
1361
1362 If (IsComObjectCreated(Self)) Begin
1363 // If setting to Default color read the color from piDefaultAlternateRowBackColor. This is a workaround
1364 // because the normal default value of -1 does not work with this property.
1365 If (iValue = clNone or iValue = clDefault) Begin
1366 Get piDefaultAlternateRowBackColor to iValue
1367 End
1368 Else Begin
1369 Get ConvertSystemColor iValue to iValue
1370 End
1371 Get phoReportPaintManager to hoPaintManager
1372 Set ComAlternativeBackgroundColor of hoPaintManager to iValue
1373 Send DeferredRedraw // ComRedraw
1374 End
1375 End_Procedure
1376
1377 { MethodType=Property }
1378 Function piAlternateRowBackgroundColor Returns Integer
1379 Integer iValue
1380 Handle hoPaintManager
1381
1382 If (IsComObjectCreated(Self)) Begin
1383 Get phoReportPaintManager to hoPaintManager
1384 Get ComAlternativeBackgroundColor of hoPaintManager to iValue
1385 End
1386 Else Begin
1387 Get private_piAlternateRowBackgroundColor to iValue
1388 End
1389 Function_Return iValue
1390 End_Function
1391
1392 // piCaptionBackColor
1393
1394 // The background color of the column headers. See ReportPaintManager.CaptionBackColor.
1395 { MethodType=Property InitialValue=clNone }
1396 { Category=Colors PropertyType=Color }
1397 { EnumList= "clScrollBar, clBackground, clActiveCaption, clInactiveCaption, clMenu, clWindow, clWindowFrame, clMenuText, clWindowText, clCaptionText, clActiveBorder, clInactiveBorder" }
1398 { EnumList+="clAppWorkSpace, clHighlight, clHighlightText, clBtnFace, clBtnShadow, clGrayText, clBtnText, clInactiveCaptionText, clBtnHighlight, cl3DDkShadow, cl3DLight, clInfoText, clInfoBk, clDefault, clNone" }
1399 { EnumList+="clAqua, clBlack, clBlue, clDkGray, clFuchsia, clGray, clGreen, clLime, clLtGray, clMaroon, clNavy, clOlive, clPurple, clRed, clSilver, clTeal, clWhite, clYellow" }
1400 Procedure Set piCaptionBackColor Integer iValue
1401 Handle hoPaintManager
1402 Set private_piCaptionBackColor to iValue
1403
1404 If (IsComObjectCreated(Self)) Begin
1405 Get ConvertSystemColor iValue to iValue
1406 Get phoReportPaintManager to hoPaintManager
1407 Set ComCaptionBackColor of hoPaintManager to iValue
1408 Send DeferredRedraw // ComRedraw
1409 End
1410 End_Procedure
1411
1412 { MethodType=Property }
1413 Function piCaptionBackColor Returns Integer
1414 Integer iValue
1415 Handle hoPaintManager
1416
1417 If (IsComObjectCreated(Self)) Begin
1418 Get phoReportPaintManager to hoPaintManager
1419 Get ComCaptionBackColor of hoPaintManager to iValue
1420 End
1421 Else Begin
1422 Get private_piCaptionBackColor to iValue
1423 End
1424 Function_Return iValue
1425 End_Function
1426
1427 // piCaptionBackGradientColorDark
1428
1429 // The "Dark" color in the color gradient used for the background color of "normal" column headers. See ReportPaintManager.CaptionBackGradientColorDark.
1430 { MethodType=Property InitialValue=clNone }
1431 { Category=Colors PropertyType=Color }
1432 { EnumList= "clScrollBar, clBackground, clActiveCaption, clInactiveCaption, clMenu, clWindow, clWindowFrame, clMenuText, clWindowText, clCaptionText, clActiveBorder, clInactiveBorder" }
1433 { EnumList+="clAppWorkSpace, clHighlight, clHighlightText, clBtnFace, clBtnShadow, clGrayText, clBtnText, clInactiveCaptionText, clBtnHighlight, cl3DDkShadow, cl3DLight, clInfoText, clInfoBk, clDefault, clNone" }
1434 { EnumList+="clAqua, clBlack, clBlue, clDkGray, clFuchsia, clGray, clGreen, clLime, clLtGray, clMaroon, clNavy, clOlive, clPurple, clRed, clSilver, clTeal, clWhite, clYellow" }
1435 Procedure Set piCaptionBackGradientColorDark Integer iValue
1436 Handle hoPaintManager
1437 Set private_piCaptionBackGradientColorDark to iValue
1438
1439 If (IsComObjectCreated(Self)) Begin
1440 Get ConvertSystemColor iValue to iValue
1441 Get phoReportPaintManager to hoPaintManager
1442 Set ComCaptionBackGradientColorDark of hoPaintManager to iValue
1443 Send DeferredRedraw // ComRedraw
1444 End
1445 End_Procedure
1446
1447 { MethodType=Property }
1448 Function piCaptionBackGradientColorDark Returns Integer
1449 Integer iValue
1450 Handle hoPaintManager
1451
1452 If (IsComObjectCreated(Self)) Begin
1453 Get phoReportPaintManager to hoPaintManager
1454 Get ComCaptionBackGradientColorDark of hoPaintManager to iValue
1455 End
1456 Else Begin
1457 Get private_piCaptionBackGradientColorDark to iValue
1458 End
1459 Function_Return iValue
1460 End_Function
1461
1462 // piCaptionBackGradientColorLight
1463
1464 // The "Light" color in the color gradient used for the background color of "normal" column headers. See ReportPaintManager.CaptionBackGradientColorLight.
1465 { MethodType=Property InitialValue=clNone }
1466 { Category=Colors PropertyType=Color }
1467 { EnumList= "clScrollBar, clBackground, clActiveCaption, clInactiveCaption, clMenu, clWindow, clWindowFrame, clMenuText, clWindowText, clCaptionText, clActiveBorder, clInactiveBorder" }
1468 { EnumList+="clAppWorkSpace, clHighlight, clHighlightText, clBtnFace, clBtnShadow, clGrayText, clBtnText, clInactiveCaptionText, clBtnHighlight, cl3DDkShadow, cl3DLight, clInfoText, clInfoBk, clDefault, clNone" }
1469 { EnumList+="clAqua, clBlack, clBlue, clDkGray, clFuchsia, clGray, clGreen, clLime, clLtGray, clMaroon, clNavy, clOlive, clPurple, clRed, clSilver, clTeal, clWhite, clYellow" }
1470 Procedure Set piCaptionBackGradientColorLight Integer iValue
1471 Handle hoPaintManager
1472 Set private_piCaptionBackGradientColorLight to iValue
1473
1474 If (IsComObjectCreated(Self)) Begin
1475 Get ConvertSystemColor iValue to iValue
1476 Get phoReportPaintManager to hoPaintManager
1477 Set ComCaptionBackGradientColorLight of hoPaintManager to iValue
1478 Send DeferredRedraw // ComRedraw
1479 End
1480 End_Procedure
1481
1482 { MethodType=Property }
1483 Function piCaptionBackGradientColorLight Returns Integer
1484 Integer iValue
1485 Handle hoPaintManager
1486
1487 If (IsComObjectCreated(Self)) Begin
1488 Get phoReportPaintManager to hoPaintManager
1489 Get ComCaptionBackGradientColorLight of hoPaintManager to iValue
1490 End
1491 Else Begin
1492 Get private_piCaptionBackGradientColorLight to iValue
1493 End
1494 Function_Return iValue
1495 End_Function
1496
1497 // piCaptionForeColor
1498
1499 // The forecolor\caption color of the column headers. See ReportPaintManager.CaptionForeColor.
1500 { MethodType=Property InitialValue=clNone }
1501 { Category=Colors PropertyType=Color }
1502 { EnumList= "clScrollBar, clBackground, clActiveCaption, clInactiveCaption, clMenu, clWindow, clWindowFrame, clMenuText, clWindowText, clCaptionText, clActiveBorder, clInactiveBorder" }
1503 { EnumList+="clAppWorkSpace, clHighlight, clHighlightText, clBtnFace, clBtnShadow, clGrayText, clBtnText, clInactiveCaptionText, clBtnHighlight, cl3DDkShadow, cl3DLight, clInfoText, clInfoBk, clDefault, clNone" }
1504 { EnumList+="clAqua, clBlack, clBlue, clDkGray, clFuchsia, clGray, clGreen, clLime, clLtGray, clMaroon, clNavy, clOlive, clPurple, clRed, clSilver, clTeal, clWhite, clYellow" }
1505 Procedure Set piCaptionForeColor Integer iValue
1506 Handle hoPaintManager
1507 Set private_piCaptionForeColor to iValue
1508
1509 If (IsComObjectCreated(Self)) Begin
1510 Get ConvertSystemColor iValue to iValue
1511 Get phoReportPaintManager to hoPaintManager
1512 Set ComCaptionForeColor of hoPaintManager to iValue
1513 Send DeferredRedraw // ComRedraw
1514 End
1515 End_Procedure
1516
1517 { MethodType=Property }
1518 Function piCaptionForeColor Returns Integer
1519 Integer iValue
1520 Handle hoPaintManager
1521
1522 If (IsComObjectCreated(Self)) Begin
1523 Get phoReportPaintManager to hoPaintManager
1524 Get ComCaptionForeColor of hoPaintManager to iValue
1525 End
1526 Else Begin
1527 Get private_piCaptionForeColor to iValue
1528 End
1529 Function_Return iValue
1530 End_Function
1531
1532 // piColumnHotGradientColorDark
1533
1534 // The "Dark" color in the color gradient used for the background color of "hot" column headers. See ReportPaintManager.ColumnHotGradientColorDark.
1535 { MethodType=Property InitialValue=clNone }
1536 { Category=Colors PropertyType=Color }
1537 { EnumList= "clScrollBar, clBackground, clActiveCaption, clInactiveCaption, clMenu, clWindow, clWindowFrame, clMenuText, clWindowText, clCaptionText, clActiveBorder, clInactiveBorder" }
1538 { EnumList+="clAppWorkSpace, clHighlight, clHighlightText, clBtnFace, clBtnShadow, clGrayText, clBtnText, clInactiveCaptionText, clBtnHighlight, cl3DDkShadow, cl3DLight, clInfoText, clInfoBk, clDefault, clNone" }
1539 { EnumList+="clAqua, clBlack, clBlue, clDkGray, clFuchsia, clGray, clGreen, clLime, clLtGray, clMaroon, clNavy, clOlive, clPurple, clRed, clSilver, clTeal, clWhite, clYellow" }
1540 Procedure Set piColumnHotGradientColorDark Integer iValue
1541 Handle hoPaintManager
1542 Set private_piColumnHotGradientColorDark to iValue
1543
1544 If (IsComObjectCreated(Self)) Begin
1545 Get ConvertSystemColor iValue to iValue
1546 Get phoReportPaintManager to hoPaintManager
1547 Set ComColumnHotGradientColorDark of hoPaintManager to iValue
1548 Send DeferredRedraw // ComRedraw
1549 End
1550 End_Procedure
1551
1552 { MethodType=Property }
1553 Function piColumnHotGradientColorDark Returns Integer
1554 Integer iValue
1555 Handle hoPaintManager
1556
1557 If (IsComObjectCreated(Self)) Begin
1558 Get phoReportPaintManager to hoPaintManager
1559 Get ComColumnHotGradientColorDark of hoPaintManager to iValue
1560 End
1561 Else Begin
1562 Get private_piColumnHotGradientColorDark to iValue
1563 End
1564 Function_Return iValue
1565 End_Function
1566
1567 // piColumnHotGradientColorLight
1568
1569 // The "Light" color in the color gradient used for the background color of "hot" column headers. See ReportPaintManager.ColumnHotGradientColorLight.
1570 { MethodType=Property InitialValue=clNone }
1571 { Category=Colors PropertyType=Color }
1572 { EnumList= "clScrollBar, clBackground, clActiveCaption, clInactiveCaption, clMenu, clWindow, clWindowFrame, clMenuText, clWindowText, clCaptionText, clActiveBorder, clInactiveBorder" }
1573 { EnumList+="clAppWorkSpace, clHighlight, clHighlightText, clBtnFace, clBtnShadow, clGrayText, clBtnText, clInactiveCaptionText, clBtnHighlight, cl3DDkShadow, cl3DLight, clInfoText, clInfoBk, clDefault, clNone" }
1574 { EnumList+="clAqua, clBlack, clBlue, clDkGray, clFuchsia, clGray, clGreen, clLime, clLtGray, clMaroon, clNavy, clOlive, clPurple, clRed, clSilver, clTeal, clWhite, clYellow" }
1575 Procedure Set piColumnHotGradientColorLight Integer iValue
1576 Handle hoPaintManager
1577 Set private_piColumnHotGradientColorLight to iValue
1578
1579 If (IsComObjectCreated(Self)) Begin
1580 Get ConvertSystemColor iValue to iValue
1581 Get phoReportPaintManager to hoPaintManager
1582 Set ComColumnHotGradientColorLight of hoPaintManager to iValue
1583 Send DeferredRedraw // ComRedraw
1584 End
1585 End_Procedure
1586
1587 { MethodType=Property }
1588 Function piColumnHotGradientColorLight Returns Integer
1589 Integer iValue
1590 Handle hoPaintManager
1591
1592 If (IsComObjectCreated(Self)) Begin
1593 Get phoReportPaintManager to hoPaintManager
1594 Get ComColumnHotGradientColorLight of hoPaintManager to iValue
1595 End
1596 Else Begin
1597 Get private_piColumnHotGradientColorLight to iValue
1598 End
1599 Function_Return iValue
1600 End_Function
1601
1602 // piColumnPushedGradientColorDark
1603
1604 // The "Dark" color in the color gradient used for the background color of "pushed" column headers. See ReportPaintManager.ColumnPushedGradientColorDark.
1605 { MethodType=Property InitialValue=clNone }
1606 { Category=Colors PropertyType=Color }
1607 { EnumList= "clScrollBar, clBackground, clActiveCaption, clInactiveCaption, clMenu, clWindow, clWindowFrame, clMenuText, clWindowText, clCaptionText, clActiveBorder, clInactiveBorder" }
1608 { EnumList+="clAppWorkSpace, clHighlight, clHighlightText, clBtnFace, clBtnShadow, clGrayText, clBtnText, clInactiveCaptionText, clBtnHighlight, cl3DDkShadow, cl3DLight, clInfoText, clInfoBk, clDefault, clNone" }
1609 { EnumList+="clAqua, clBlack, clBlue, clDkGray, clFuchsia, clGray, clGreen, clLime, clLtGray, clMaroon, clNavy, clOlive, clPurple, clRed, clSilver, clTeal, clWhite, clYellow" }
1610 Procedure Set piColumnPushedGradientColorDark Integer iValue
1611 Handle hoPaintManager
1612 Set private_piColumnPushedGradientColorDark to iValue
1613
1614 If (IsComObjectCreated(Self)) Begin
1615 Get ConvertSystemColor iValue to iValue
1616 Get phoReportPaintManager to hoPaintManager
1617 Set ComColumnPushedGradientColorDark of hoPaintManager to iValue
1618 Send DeferredRedraw // ComRedraw
1619 End
1620 End_Procedure
1621
1622 { MethodType=Property }
1623 Function piColumnPushedGradientColorDark Returns Integer
1624 Integer iValue
1625 Handle hoPaintManager
1626
1627 If (IsComObjectCreated(Self)) Begin
1628 Get phoReportPaintManager to hoPaintManager
1629 Get ComColumnPushedGradientColorDark of hoPaintManager to iValue
1630 End
1631 Else Begin
1632 Get private_piColumnPushedGradientColorDark to iValue
1633 End
1634 Function_Return iValue
1635 End_Function
1636
1637 // piColumnPushedGradientColorLight
1638
1639 // The "Light" color in the color gradient used for the background color of "pushed" column headers. See ReportPaintManager.ColumnPushedGradientColorLight.
1640 { MethodType=Property InitialValue=clNone }
1641 { Category=Colors PropertyType=Color }
1642 { EnumList= "clScrollBar, clBackground, clActiveCaption, clInactiveCaption, clMenu, clWindow, clWindowFrame, clMenuText, clWindowText, clCaptionText, clActiveBorder, clInactiveBorder" }
1643 { EnumList+="clAppWorkSpace, clHighlight, clHighlightText, clBtnFace, clBtnShadow, clGrayText, clBtnText, clInactiveCaptionText, clBtnHighlight, cl3DDkShadow, cl3DLight, clInfoText, clInfoBk, clDefault, clNone" }
1644 { EnumList+="clAqua, clBlack, clBlue, clDkGray, clFuchsia, clGray, clGreen, clLime, clLtGray, clMaroon, clNavy, clOlive, clPurple, clRed, clSilver, clTeal, clWhite, clYellow" }
1645 Procedure Set piColumnPushedGradientColorLight Integer iValue
1646 Handle hoPaintManager
1647 Set private_piColumnPushedGradientColorLight to iValue
1648
1649 If (IsComObjectCreated(Self)) Begin
1650 Get ConvertSystemColor iValue to iValue
1651 Get phoReportPaintManager to hoPaintManager
1652 Set ComColumnPushedGradientColorLight of hoPaintManager to iValue
1653 Send DeferredRedraw // ComRedraw
1654 End
1655 End_Procedure
1656
1657 { MethodType=Property }
1658 Function piColumnPushedGradientColorLight Returns Integer
1659 Integer iValue
1660 Handle hoPaintManager
1661
1662 If (IsComObjectCreated(Self)) Begin
1663 Get phoReportPaintManager to hoPaintManager
1664 Get ComColumnPushedGradientColorLight of hoPaintManager to iValue
1665 End
1666 Else Begin
1667 Get private_piColumnPushedGradientColorLight to iValue
1668 End
1669 Function_Return iValue
1670 End_Function
1671
1672 // piHeaderHeightMultiplier
1673
1674 // Determines the height of the report header section in lines of text. See ReportFormulaMulDivC.Multiplier.
1675 // If this value = -1 or 0 then it is ignored and the header height is one text line by default,
1676 // unless one of the grid columns has pbMultiLine set to True in which case the header height
1677 // is determined by the tallest column header.
1678 { MethodType=Property InitialValue=-1 }
1679 { Category=Appearance }
1680 Procedure Set piHeaderHeightMultiplier Integer iValue
1681 Handle hoPaintManager hoFormula
1682 Variant vFormula
1683 Boolean bMultiLineHeader
1684
1685 Set private_piHeaderHeightMultiplier to iValue
1686
1687 If (IsComObjectCreated(Self) and iValue > 0) Begin
1688 Get phoReportPaintManager to hoPaintManager
1689 Get ComHeaderHeightFormula of hoPaintManager to vFormula
1690 Get Create (RefClass(cCJFormulaMulDivC)) to hoFormula
1691 Set pvComObject of hoFormula to vFormula
1692 Set ComMultiplier of hoFormula to iValue
1693 Set ComDivisor of hoFormula to 1
1694 Send ComRefreshMetrics of hoPaintManager
1695 Send Destroy of hoFormula
1696 Send DeferredRedraw // ComRedraw
1697 End
1698 End_Procedure
1699
1700 { MethodType=Property }
1701 Function piHeaderHeightMultiplier Returns Integer
1702 Integer iValue
1703 Get private_piHeaderHeightMultiplier to iValue
1704 Function_Return iValue
1705 End_Function
1706
1707 // piFreezeColsDividerColor
1708
1709 // Color of the freeze column divider. See ReportPaintManager.FreezeColsDividerColor.
1710 { MethodType=Property InitialValue=clNone }
1711 { Category=Colors PropertyType=Color }
1712 { EnumList= "clScrollBar, clBackground, clActiveCaption, clInactiveCaption, clMenu, clWindow, clWindowFrame, clMenuText, clWindowText, clCaptionText, clActiveBorder, clInactiveBorder" }
1713 { EnumList+="clAppWorkSpace, clHighlight, clHighlightText, clBtnFace, clBtnShadow, clGrayText, clBtnText, clInactiveCaptionText, clBtnHighlight, cl3DDkShadow, cl3DLight, clInfoText, clInfoBk, clDefault, clNone" }
1714 { EnumList+="clAqua, clBlack, clBlue, clDkGray, clFuchsia, clGray, clGreen, clLime, clLtGray, clMaroon, clNavy, clOlive, clPurple, clRed, clSilver, clTeal, clWhite, clYellow" }
1715 Procedure Set piFreezeColsDividerColor Integer iValue
1716 Handle hoPaintManager
1717 Set private_piFreezeColsDividerColor to iValue
1718
1719 If (IsComObjectCreated(Self)) Begin
1720 Get ConvertSystemColor iValue to iValue
1721 Get phoReportPaintManager to hoPaintManager
1722 Set ComFreezeColsDividerColor of hoPaintManager to iValue
1723 Send DeferredRedraw // ComRedraw
1724 End
1725 End_Procedure
1726
1727 { MethodType=Property }
1728 Function piFreezeColsDividerColor Returns Integer
1729 Integer iValue
1730 Handle hoPaintManager
1731
1732 If (IsComObjectCreated(Self)) Begin
1733 Get phoReportPaintManager to hoPaintManager
1734 Get ComFreezeColsDividerColor of hoPaintManager to iValue
1735 End
1736 Else Begin
1737 Get private_piFreezeColsDividerColor to iValue
1738 End
1739 Function_Return iValue
1740 End_Function
1741
1742 // piFreezeColumnsCount
1743
1744 // Gets\Sets the Number of columns that are frozen when the report is scrolled horizontally., see ReportControl.FreezeColumnsCount
1745 { MethodType=Property InitialValue=0 }
1746 { Category=Behavior }
1747 Procedure Set piFreezeColumnsCount Integer iValue
1748 Set private_piFreezeColumnsCount to iValue
1749 If (IsComObjectCreated(Self)) Begin
1750 Set ComFreezeColumnsCount to iValue
1751 End
1752 End_Procedure
1753
1754 { MethodType=Property }
1755 Function piFreezeColumnsCount Returns Integer
1756 Integer iValue
1757 If (IsComObjectCreated(Self)) Begin
1758 Get ComFreezeColumnsCount to iValue
1759 End
1760 Else Begin
1761 Get private_piFreezeColumnsCount to iValue
1762 End
1763 Function_Return iValue
1764 End_Function
1765
1766 // piGridLineColor
1767
1768 // The color used to draw grid lines. See ReportPaintManager.GridLineColor.
1769 { MethodType=Property InitialValue=clNone }
1770 { Category=Colors PropertyType=Color }
1771 { EnumList= "clScrollBar, clBackground, clActiveCaption, clInactiveCaption, clMenu, clWindow, clWindowFrame, clMenuText, clWindowText, clCaptionText, clActiveBorder, clInactiveBorder" }
1772 { EnumList+="clAppWorkSpace, clHighlight, clHighlightText, clBtnFace, clBtnShadow, clGrayText, clBtnText, clInactiveCaptionText, clBtnHighlight, cl3DDkShadow, cl3DLight, clInfoText, clInfoBk, clDefault, clNone" }
1773 { EnumList+="clAqua, clBlack, clBlue, clDkGray, clFuchsia, clGray, clGreen, clLime, clLtGray, clMaroon, clNavy, clOlive, clPurple, clRed, clSilver, clTeal, clWhite, clYellow" }
1774 Procedure Set piGridLineColor Integer iValue
1775 Handle hoPaintManager
1776 Set private_piGridLineColor to iValue
1777
1778 If (IsComObjectCreated(Self)) Begin
1779 Get ConvertSystemColor iValue to iValue
1780 Get phoReportPaintManager to hoPaintManager
1781 Set ComGridLineColor of hoPaintManager to iValue
1782 Send DeferredRedraw // ComRedraw
1783 End
1784 End_Procedure
1785
1786 { MethodType=Property }
1787 Function piGridLineColor Returns Integer
1788 Integer iValue
1789 Handle hoPaintManager
1790
1791 If (IsComObjectCreated(Self)) Begin
1792 Get phoReportPaintManager to hoPaintManager
1793 Get ComGridLineColor of hoPaintManager to iValue
1794 End
1795 Else Begin
1796 Get private_piGridLineColor to iValue
1797 End
1798 Function_Return iValue
1799 End_Function
1800
1801 // piHighlightBackColor
1802
1803 // The background color of selected rows. See ReportPaintManager.HighlightBackColor.
1804 { MethodType=Property InitialValue=clNone }
1805 { Category=Colors PropertyType=Color }
1806 { EnumList= "clScrollBar, clBackground, clActiveCaption, clInactiveCaption, clMenu, clWindow, clWindowFrame, clMenuText, clWindowText, clCaptionText, clActiveBorder, clInactiveBorder" }
1807 { EnumList+="clAppWorkSpace, clHighlight, clHighlightText, clBtnFace, clBtnShadow, clGrayText, clBtnText, clInactiveCaptionText, clBtnHighlight, cl3DDkShadow, cl3DLight, clInfoText, clInfoBk, clDefault, clNone" }
1808 { EnumList+="clAqua, clBlack, clBlue, clDkGray, clFuchsia, clGray, clGreen, clLime, clLtGray, clMaroon, clNavy, clOlive, clPurple, clRed, clSilver, clTeal, clWhite, clYellow" }
1809 Procedure Set piHighlightBackColor Integer iValue
1810 Handle hoPaintManager
1811 Integer iSelectedRowColor
1812 Set private_piHighlightBackColor to iValue
1813
1814 If (IsComObjectCreated(Self)) Begin
1815 Get ConvertSystemColor iValue to iValue
1816 Get phoReportPaintManager to hoPaintManager
1817 Set ComHighlightBackColor of hoPaintManager to iValue
1818
1819 // check if we need to synchronize the selected row color....
1820 Get private_piSelectedRowBackColor to iSelectedRowColor
1821 If (iSelectedRowColor = clNone) Begin
1822 Set ComSelectedRowBackColor of hoPaintManager to iValue
1823 End
1824 Send DeferredRedraw // ComRedraw
1825 End
1826 End_Procedure
1827
1828 { MethodType=Property }
1829 Function piHighlightBackColor Returns Integer
1830 Integer iValue
1831 Handle hoPaintManager
1832
1833 If (IsComObjectCreated(Self)) Begin
1834 Get phoReportPaintManager to hoPaintManager
1835 Get ComHighlightBackColor of hoPaintManager to iValue
1836 End
1837 Else Begin
1838 Get private_piHighlightBackColor to iValue
1839 End
1840 Function_Return iValue
1841 End_Function
1842
1843 // piHighlightForeColor
1844
1845 // The text color of selected rows. See ReportPaintManager.HighlightForeColor.
1846 { MethodType=Property InitialValue=clNone }
1847 { Category=Colors PropertyType=Color }
1848 { EnumList= "clScrollBar, clBackground, clActiveCaption, clInactiveCaption, clMenu, clWindow, clWindowFrame, clMenuText, clWindowText, clCaptionText, clActiveBorder, clInactiveBorder" }
1849 { EnumList+="clAppWorkSpace, clHighlight, clHighlightText, clBtnFace, clBtnShadow, clGrayText, clBtnText, clInactiveCaptionText, clBtnHighlight, cl3DDkShadow, cl3DLight, clInfoText, clInfoBk, clDefault, clNone" }
1850 { EnumList+="clAqua, clBlack, clBlue, clDkGray, clFuchsia, clGray, clGreen, clLime, clLtGray, clMaroon, clNavy, clOlive, clPurple, clRed, clSilver, clTeal, clWhite, clYellow" }
1851 Procedure Set piHighlightForeColor Integer iValue
1852 Handle hoPaintManager
1853 Integer iSelectedRowColor
1854 Set private_piHighlightForeColor to iValue
1855
1856 If (IsComObjectCreated(Self)) Begin
1857 Get ConvertSystemColor iValue to iValue
1858 Get phoReportPaintManager to hoPaintManager
1859 Set ComHighlightForeColor of hoPaintManager to iValue
1860
1861 // check if we need to synchronize the selected row color....
1862 Get private_piSelectedRowForeColor to iSelectedRowColor
1863 If (iSelectedRowColor = clNone) Begin
1864 Set ComSelectedRowForeColor of hoPaintManager to iValue
1865 End
1866 Send DeferredRedraw // ComRedraw
1867 End
1868 End_Procedure
1869
1870 { MethodType=Property }
1871 Function piHighlightForeColor Returns Integer
1872 Integer iValue
1873 Handle hoPaintManager
1874
1875 If (IsComObjectCreated(Self)) Begin
1876 Get phoReportPaintManager to hoPaintManager
1877 Get ComHighlightForeColor of hoPaintManager to iValue
1878 End
1879 Else Begin
1880 Get private_piHighlightForeColor to iValue
1881 End
1882 Function_Return iValue
1883 End_Function
1884
1885 // piSelectedRowBackColor
1886
1887 // The background color of selected rows when grid doees not have the focus. See ReportPaintManager.SelectedRowBackColor.
1888 { MethodType=Property InitialValue=clNone }
1889 { Category=Colors PropertyType=Color }
1890 { EnumList= "clScrollBar, clBackground, clActiveCaption, clInactiveCaption, clMenu, clWindow, clWindowFrame, clMenuText, clWindowText, clCaptionText, clActiveBorder, clInactiveBorder" }
1891 { EnumList+="clAppWorkSpace, clHighlight, clHighlightText, clBtnFace, clBtnShadow, clGrayText, clBtnText, clInactiveCaptionText, clBtnHighlight, cl3DDkShadow, cl3DLight, clInfoText, clInfoBk, clDefault, clNone" }
1892 { EnumList+="clAqua, clBlack, clBlue, clDkGray, clFuchsia, clGray, clGreen, clLime, clLtGray, clMaroon, clNavy, clOlive, clPurple, clRed, clSilver, clTeal, clWhite, clYellow" }
1893 Procedure Set piSelectedRowBackColor Integer iValue
1894 Handle hoPaintManager
1895 Set private_piSelectedRowBackColor to iValue
1896
1897 If (IsComObjectCreated(Self)) Begin
1898 // If setting the value to clNone then re-apply the Highlight row color....
1899 Get phoReportPaintManager to hoPaintManager
1900 If (iValue = clNone) Begin
1901 Get ComHighlightBackColor of hoPaintManager to iValue
1902 End
1903 Get ConvertSystemColor iValue to iValue
1904 Set ComSelectedRowBackColor of hoPaintManager to iValue
1905 Send DeferredRedraw // ComRedraw
1906 End
1907 End_Procedure
1908
1909 { MethodType=Property }
1910 Function piSelectedRowBackColor Returns Integer
1911 Integer iValue
1912 Handle hoPaintManager
1913
1914 If (IsComObjectCreated(Self)) Begin
1915 Get phoReportPaintManager to hoPaintManager
1916 Get ComSelectedRowBackColor of hoPaintManager to iValue
1917 End
1918 Else Begin
1919 Get private_piSelectedRowBackColor to iValue
1920 End
1921 Function_Return iValue
1922 End_Function
1923
1924 // piSelectedRowForeColor
1925
1926 // The text color of selected rows when grid does not have the focus. See ReportPaintManager.SelectedRowForeColor.
1927 { MethodType=Property InitialValue=clNone }
1928 { Category=Colors PropertyType=Color }
1929 { EnumList= "clScrollBar, clBackground, clActiveCaption, clInactiveCaption, clMenu, clWindow, clWindowFrame, clMenuText, clWindowText, clCaptionText, clActiveBorder, clInactiveBorder" }
1930 { EnumList+="clAppWorkSpace, clHighlight, clHighlightText, clBtnFace, clBtnShadow, clGrayText, clBtnText, clInactiveCaptionText, clBtnHighlight, cl3DDkShadow, cl3DLight, clInfoText, clInfoBk, clDefault, clNone" }
1931 { EnumList+="clAqua, clBlack, clBlue, clDkGray, clFuchsia, clGray, clGreen, clLime, clLtGray, clMaroon, clNavy, clOlive, clPurple, clRed, clSilver, clTeal, clWhite, clYellow" }
1932 Procedure Set piSelectedRowForeColor Integer iValue
1933 Handle hoPaintManager
1934 Set private_piSelectedRowForeColor to iValue
1935
1936 If (IsComObjectCreated(Self)) Begin
1937 // If setting the value to clNone then re-apply the Highlight row color....
1938 Get phoReportPaintManager to hoPaintManager
1939 If (iValue = clNone) Begin
1940 Get ComHighlightForeColor of hoPaintManager to iValue
1941 End
1942 Get ConvertSystemColor iValue to iValue
1943 Set ComSelectedRowForeColor of hoPaintManager to iValue
1944 Send DeferredRedraw // ComRedraw
1945 End
1946 End_Procedure
1947
1948 { MethodType=Property }
1949 Function piSelectedRowForeColor Returns Integer
1950 Integer iValue
1951 Handle hoPaintManager
1952
1953 If (IsComObjectCreated(Self)) Begin
1954 Get phoReportPaintManager to hoPaintManager
1955 Get ComSelectedRowForeColor of hoPaintManager to iValue
1956 End
1957 Else Begin
1958 Get private_piSelectedRowForeColor to iValue
1959 End
1960 Function_Return iValue
1961 End_Function
1962
1963 // piHotDividerColor
1964
1965 // Gets\sets the color of the arrows used to Show where a column can be dropped when dragging a column header. See ReportPaintManager.HotDividerColor.
1966 { MethodType=Property InitialValue=clNone }
1967 { Category=Colors PropertyType=Color }
1968 { EnumList= "clScrollBar, clBackground, clActiveCaption, clInactiveCaption, clMenu, clWindow, clWindowFrame, clMenuText, clWindowText, clCaptionText, clActiveBorder, clInactiveBorder" }
1969 { EnumList+="clAppWorkSpace, clHighlight, clHighlightText, clBtnFace, clBtnShadow, clGrayText, clBtnText, clInactiveCaptionText, clBtnHighlight, cl3DDkShadow, cl3DLight, clInfoText, clInfoBk, clDefault, clNone" }
1970 { EnumList+="clAqua, clBlack, clBlue, clDkGray, clFuchsia, clGray, clGreen, clLime, clLtGray, clMaroon, clNavy, clOlive, clPurple, clRed, clSilver, clTeal, clWhite, clYellow" }
1971 Procedure Set piHotDividerColor Integer iValue
1972 Handle hoPaintManager
1973 Set private_piHotDividerColor to iValue
1974
1975 If (IsComObjectCreated(Self)) Begin
1976 Get ConvertSystemColor iValue to iValue
1977 Get phoReportPaintManager to hoPaintManager
1978 Set ComHotDividerColor of hoPaintManager to iValue
1979 Send DeferredRedraw // ComRedraw
1980 End
1981 End_Procedure
1982
1983 { MethodType=Property }
1984 Function piHotDividerColor Returns Integer
1985 Integer iValue
1986 Handle hoPaintManager
1987
1988 If (IsComObjectCreated(Self)) Begin
1989 Get phoReportPaintManager to hoPaintManager
1990 Get ComHotDividerColor of hoPaintManager to iValue
1991 End
1992 Else Begin
1993 Get private_piHotDividerColor to iValue
1994 End
1995 Function_Return iValue
1996 End_Function
1997
1998 // piHScrollStep
1999
2000 // Gets\sets the amount of pixels the report is scrolled when the horizontal scroll bar buttons are clicked., see ReportControl.HScrollStep
2001 { MethodType=Property InitialValue=7 }
2002 { Category=Behavior }
2003 Procedure Set piHScrollStep Integer iValue
2004 Set private_piHScrollStep to iValue
2005 If (IsComObjectCreated(Self)) Begin
2006 Set ComHScrollStep to iValue
2007 End
2008 End_Procedure
2009
2010 { MethodType=Property }
2011 Function piHScrollStep Returns Integer
2012 Integer iValue
2013 If (IsComObjectCreated(Self)) Begin
2014 Set ComHScrollStep to iValue
2015 End
2016 Else Begin
2017 Get private_piHScrollStep to iValue
2018 End
2019 Function_Return iValue
2020 End_Function
2021
2022 // piTooltipBkColor
2023
2024 // Gets\sets the background color of the tool tip window. See TooltipContext.TipBkColor
2025 { MethodType=Property InitialValue=clNone }
2026 { PropertyType=Color Category=Tooltip }
2027 { EnumList= "clScrollBar, clBackground, clActiveCaption, clInactiveCaption, clMenu, clWindow, clWindowFrame, clMenuText, clWindowText, clCaptionText, clActiveBorder, clInactiveBorder" }
2028 { EnumList+="clAppWorkSpace, clHighlight, clHighlightText, clBtnFace, clBtnShadow, clGrayText, clBtnText, clInactiveCaptionText, clBtnHighlight, cl3DDkShadow, cl3DLight, clInfoText, clInfoBk, clDefault, clNone" }
2029 { EnumList+="clAqua, clBlack, clBlue, clDkGray, clFuchsia, clGray, clGreen, clLime, clLtGray, clMaroon, clNavy, clOlive, clPurple, clRed, clSilver, clTeal, clWhite, clYellow" }
2030 Procedure Set piTooltipBkColor Integer iValue
2031 Handle hoTooltipContext
2032 Set private_piTooltipBkColor to iValue
2033
2034 If (IsComObjectCreated(Self)) Begin
2035 Get ConvertSystemColor iValue to iValue
2036 Get phoToolTipContext to hoTooltipContext
2037 Set ComTipBkColor of hoTooltipContext to iValue
2038 End
2039 End_Procedure
2040
2041 { MethodType=Property }
2042 Function piTooltipBkColor Returns Integer
2043 Integer iValue
2044 Handle hoTooltipContext
2045
2046 If (IsComObjectCreated(Self)) Begin
2047 Get phoToolTipContext to hoTooltipContext
2048 Get ComTipBkColor of hoTooltipContext to iValue
2049 End
2050 Else Begin
2051 Get private_piTooltipBkColor to iValue
2052 End
2053 Function_Return iValue
2054 End_Function
2055
2056 // piTooltipMaxWidth
2057
2058 // The MaxTipWidth Property gets\sets the maximum tool tip width in pixels. See TooltipContext.MaxTipWidth.
2059 { MethodType=Property InitialValue=-1 }
2060 { Category=Tooltip }
2061 Procedure Set piTooltipMaxWidth Integer iValue
2062 Handle hoTooltipContext
2063 Set private_piTooltipMaxWidth to iValue
2064
2065 If (IsComObjectCreated(Self)) Begin
2066 Get phoToolTipContext to hoTooltipContext
2067 Set ComMaxTipWidth of hoTooltipContext to iValue
2068 End
2069 End_Procedure
2070
2071 { MethodType=Property }
2072 Function piTooltipMaxWidth Returns Integer
2073 Integer iValue
2074 Handle hoTooltipContext
2075
2076 If (IsComObjectCreated(Self)) Begin
2077 Get phoToolTipContext to hoTooltipContext
2078 Get ComMaxTipWidth of hoTooltipContext to iValue
2079 End
2080 Else Begin
2081 Get private_piTooltipMaxWidth to iValue
2082 End
2083 Function_Return iValue
2084 End_Function
2085
2086 // piTooltipTextColor
2087
2088 // Gets\sets the color of the text that is displayed in the tool tip window. See TooltipContext.TipTextColor.
2089 { MethodType=Property InitialValue=clNone }
2090 { PropertyType=Color Category=Tooltip }
2091 { EnumList= "clScrollBar, clBackground, clActiveCaption, clInactiveCaption, clMenu, clWindow, clWindowFrame, clMenuText, clWindowText, clCaptionText, clActiveBorder, clInactiveBorder" }
2092 { EnumList+="clAppWorkSpace, clHighlight, clHighlightText, clBtnFace, clBtnShadow, clGrayText, clBtnText, clInactiveCaptionText, clBtnHighlight, cl3DDkShadow, cl3DLight, clInfoText, clInfoBk, clDefault, clNone" }
2093 { EnumList+="clAqua, clBlack, clBlue, clDkGray, clFuchsia, clGray, clGreen, clLime, clLtGray, clMaroon, clNavy, clOlive, clPurple, clRed, clSilver, clTeal, clWhite, clYellow" }
2094 Procedure Set piTooltipTextColor Integer iValue
2095 Handle hoTooltipContext
2096 Set private_piTooltipTextColor to iValue
2097
2098 If (IsComObjectCreated(Self)) Begin
2099 Get ConvertSystemColor iValue to iValue
2100 Get phoToolTipContext to hoTooltipContext
2101 Set ComTipTextColor of hoTooltipContext to iValue
2102 End
2103 End_Procedure
2104
2105 { MethodType=Property }
2106 Function piTooltipTextColor Returns Integer
2107 Integer iValue
2108 Handle hoTooltipContext
2109
2110 If (IsComObjectCreated(Self)) Begin
2111 Get phoToolTipContext to hoTooltipContext
2112 Get ComTipTextColor of hoTooltipContext to iValue
2113 End
2114 Else Begin
2115 Get private_piTooltipTextColor to iValue
2116 End
2117 Function_Return iValue
2118 End_Function
2119
2120 // psNoFieldsAvailableText
2121
2122 // The "No Fields Available" text message displayed in the Field Chooser when no Column Headers are present. See ReportPaintManager.NoFieldsAvailableText.
2123 { MethodType=Property InitialValue="" }
2124 { Category=Appearance }
2125 Procedure Set psNoFieldsAvailableText String sValue
2126 Handle hoPaintManager
2127 Set private_psNoFieldsAvailableText to sValue
2128
2129 If (IsComObjectCreated(Self)) Begin
2130 Get phoReportPaintManager to hoPaintManager
2131 Set ComNoFieldsAvailableText of hoPaintManager to sValue
2132 Send DeferredRedraw // ComRedraw
2133 End
2134 End_Procedure
2135
2136 { MethodType=Property }
2137 Function psNoFieldsAvailableText Returns String
2138 String sValue
2139 Handle hoPaintManager
2140
2141 If (IsComObjectCreated(Self)) Begin
2142 Get phoReportPaintManager to hoPaintManager
2143 Get ComNoFieldsAvailableText of hoPaintManager to sValue
2144 End
2145 Else Begin
2146 Get private_psNoFieldsAvailableText to sValue
2147 End
2148 Function_Return sValue
2149 End_Function
2150
2151 // psNoItemsText
2152
2153 // The "No Items" text message displayed in the ReportControl when there are no visible rows. See ReportPaintManager.NoItemsText.
2154 { MethodType=Property InitialValue="" }
2155 { Category=Appearance }
2156 Procedure Set psNoItemsText String sValue
2157 Handle hoPaintManager
2158 Set private_psNoItemsText to sValue
2159
2160 If (IsComObjectCreated(Self)) Begin
2161 Get phoReportPaintManager to hoPaintManager
2162 Set ComNoItemsText of hoPaintManager to sValue
2163 Send DeferredRedraw // ComRedraw
2164 End
2165 End_Procedure
2166
2167 { MethodType=Property }
2168 Function psNoItemsText Returns String
2169 String sValue
2170 Handle hoPaintManager
2171
2172 If (IsComObjectCreated(Self)) Begin
2173 Get phoReportPaintManager to hoPaintManager
2174 Get ComNoItemsText of hoPaintManager to sValue
2175 End
2176 Else Begin
2177 Get private_psNoItemsText to sValue
2178 End
2179 Function_Return sValue
2180 End_Function
2181
2182 // TextColor:
2183
2184 // The foreground\text color of the grid, see ReportPaintManager.ForeColor
2185 { MethodType=Property InitialValue=clNone }
2186 { Category=Colors PropertyType=Color }
2187 { EnumList= "clScrollBar, clBackground, clActiveCaption, clInactiveCaption, clMenu, clWindow, clWindowFrame, clMenuText, clWindowText, clCaptionText, clActiveBorder, clInactiveBorder" }
2188 { EnumList+="clAppWorkSpace, clHighlight, clHighlightText, clBtnFace, clBtnShadow, clGrayText, clBtnText, clInactiveCaptionText, clBtnHighlight, cl3DDkShadow, cl3DLight, clInfoText, clInfoBk, clDefault, clNone" }
2189 { EnumList+="clAqua, clBlack, clBlue, clDkGray, clFuchsia, clGray, clGreen, clLime, clLtGray, clMaroon, clNavy, clOlive, clPurple, clRed, clSilver, clTeal, clWhite, clYellow" }
2190 Procedure Set TextColor Integer iValue
2191 Handle hoPaintManager
2192 Set Private_TextColor to iValue
2193
2194 If (IsComObjectCreated(Self)) Begin
2195 Get ConvertSystemColor iValue to iValue
2196 Get phoReportPaintManager to hoPaintManager
2197 Set ComForeColor of hoPaintManager to iValue
2198 Send DeferredRedraw // ComRedraw
2199 End
2200 End_Procedure
2201
2202 { MethodType=Property }
2203 Function TextColor Returns Integer
2204 Integer iValue
2205 Handle hoPaintManager
2206
2207 If (IsComObjectCreated(Self)) Begin
2208 Get phoReportPaintManager to hoPaintManager
2209 Get ComForeColor of hoPaintManager to iValue
2210 End
2211 Else Begin
2212 Get private_TextColor to iValue
2213 End
2214 Function_Return iValue
2215 End_Function
2216
2217 // piShadeSortColor:
2218
2219 { MethodType=Property InitialValue=clNone }
2220 { Category=Colors }
2221 { EnumList= "clScrollBar, clBackground, clActiveCaption, clInactiveCaption, clMenu, clWindow, clWindowFrame, clMenuText, clWindowText, clCaptionText, clActiveBorder, clInactiveBorder" }
2222 { EnumList+="clAppWorkSpace, clHighlight, clHighlightText, clBtnFace, clBtnShadow, clGrayText, clBtnText, clInactiveCaptionText, clBtnHighlight, cl3DDkShadow, cl3DLight, clInfoText, clInfoBk, clDefault, clNone" }
2223 { EnumList+="clAqua, clBlack, clBlue, clDkGray, clFuchsia, clGray, clGreen, clLime, clLtGray, clMaroon, clNavy, clOlive, clPurple, clRed, clSilver, clTeal, clWhite, clYellow" }
2224 Procedure Set piShadeSortColor Integer iValue
2225 Handle hoPaintManager
2226 Set Private_piShadeSortColor to iValue
2227
2228 If (IsComObjectCreated(Self)) Begin
2229 Get ConvertSystemColor iValue to iValue
2230 Get phoReportPaintManager to hoPaintManager
2231 Set ComShadeSortColor of hoPaintManager to iValue
2232 Send DeferredRedraw // ComRedraw
2233 End
2234 End_Procedure
2235
2236 { MethodType=Property }
2237 Function piShadeSortColor Returns Integer
2238 Integer iValue
2239 Handle hoPaintManager
2240
2241 If (IsComObjectCreated(Self)) Begin
2242 Get phoReportPaintManager to hoPaintManager
2243 Get ComShadeSortColor of hoPaintManager to iValue
2244 End
2245 Else Begin
2246 Get private_piShadeSortColor to iValue
2247 End
2248 Function_Return iValue
2249 End_Function
2250
2251 // pbShadeSortColumn:
2252
2253 { MethodType=Property InitialValue=False }
2254 { Category=Appearance }
2255 Procedure Set pbShadeSortColumn Boolean bValue
2256 Handle hoPaintManager
2257 Set Private_pbShadeSortColumn to bValue
2258
2259 If (IsComObjectCreated(Self)) Begin
2260 Get phoReportPaintManager to hoPaintManager
2261 Set ComShadeSortColumn of hoPaintManager to bValue
2262 Send DeferredRedraw // ComRedraw
2263 End
2264 End_Procedure
2265
2266 { MethodType=Property }
2267 Function pbShadeSortColumn Returns Boolean
2268 Boolean bValue
2269 Handle hoPaintManager
2270
2271 If (IsComObjectCreated(Self)) Begin
2272 Get phoReportPaintManager to hoPaintManager
2273 Get ComShadeSortColumn of hoPaintManager to bValue
2274 End
2275 Else Begin
2276 Get private_pbShadeSortColumn to bValue
2277 End
2278 Function_Return bValue
2279 End_Function
2280
2281
2282 // peDrawSortTriangleStyle:
2283
2284 { MethodType=Property InitialValue=xtpReportDrawSortTriangleAlways }
2285 { Category=Appearance }
2286 { EnumList="xtpReportDrawSortTriangleAlways, xtpReportDrawSortTriangleNever, xtpReportDrawSortTriangleDefault" }
2287 Procedure Set peDrawSortTriangleStyle XTPReportDrawSortTriangleStyle eStyle
2288 Handle hoPaintManager
2289 Set private_peDrawSortTriangleStyle to eStyle
2290
2291 If (IsComObjectCreated(Self)) Begin
2292 Get phoReportPaintManager to hoPaintManager
2293 Set ComDrawSortTriangleStyle of hoPaintManager to eStyle
2294 End
2295 End_Procedure
2296
2297 { MethodType=Property }
2298 Function peDrawSortTriangleStyle Returns XTPReportDrawSortTriangleStyle
2299 XTPReportDrawSortTriangleStyle eStyle
2300 Handle hoPaintManager
2301
2302 If (IsComObjectCreated(Self)) Begin
2303 Get phoReportPaintManager to hoPaintManager
2304 Get ComDrawSortTriangleStyle of hoPaintManager to eStyle
2305 End
2306 Else Begin
2307 Get private_peDrawSortTriangleStyle to eStyle
2308 End
2309 Function_Return eStyle
2310 End_Function
2311
2312
2313 // ------------------------------------------------------------------------
2314 // Methods.................................................................
2315 // ------------------------------------------------------------------------
2316
2317 {Visibility=Private}
2318 Function ConvertSystemColor Integer iColor Returns Integer
2319 Integer iSysColor
2320 If (iColor = clDefault or iColor = clNone) Begin // If default color then use -1
2321 Move clNone to iColor
2322 End
2323 Else If (iColor < 0) Begin // If it is a system color (<0) then convert this into an RGB value
2324 Move (iColor iand |CI$7FFFFFFF) to iSysColor // extract the system color constant
2325 Move (GetSysColor(iSysColor)) to iColor
2326 End
2327 Function_Return iColor
2328 End_Function
2329
2330 // ActivateFieldChooser:
2331
2332 // Send this message to popup a field chooser object.
2333 Procedure ActivateFieldChooser
2334 Handle hoFieldChooserPanel
2335
2336 // Set the tool panel's caption....
2337 Get phoFieldChooserPanel to hoFieldChooserPanel
2338
2339 // Activate the field chooser....
2340 Send Popup to hoFieldChooserPanel
2341 End_Procedure // ActivateFieldChooser
2342
2343 // AddImageType:
2344
2345 // Adds an image to imagelist. Pass if bmp or icon, the image name and the Id and image type (normal, disabled, etc.)
2346 // With Bitmaps this will first look for the resource then search for the file in the file path.
2347 // With Icons it checks for the file first (explained below)
2348 // return Image Id if success
2349 Function AddImageType Boolean bIsIcon String sImage Integer iId Returns Integer
2350 Handle hBitmap
2351 Variant vIcons
2352 Handle hoIcons
2353 Integer iVoid
2354 Boolean bOk
2355 String sFileImage
2356
2357 If (iId = 0) Begin
2358 Get piLastImageId to iId
2359 Increment iId
2360 Set piLastImageId to iId
2361 End
2362
2363 Move False to bOK
2364 Get phoImageManagerIcons to hoIcons
2365 Get ComIcons to vIcons
2366 Set pvComObject of hoIcons to vIcons
2367
2368 // if an icon we will always try to load from a file first. Loading from a file works better than
2369 // the internal resource load because the internal load only finds the first image. If the ico has
2370 // multiple images (which CJ can use) all of the extra images are lost
2371
2372 // if an Icon - load from file first then load from resource
2373 If bIsIcon Begin
2374 Get_File_Path sImage to sFileImage // find path in DFPATH, if appropriate
2375
2376 If (sFileImage <> "") Begin
2377 Send ComLoadIcon of hoIcons sFileImage iId xtpImageNormal
2378 Move True to bOk
2379 End
2380 Else Begin
2381 Move (LoadImage(GetModuleHandle(0), sImage, IMAGE_ICON, 0, 0, 0)) to hBitmap
2382
2383 If hBitmap Begin
2384 // this works with alpha blends - even when passed false
2385 Send ComAddIcon to hoIcons hBitmap iId xtpImageNormal False
2386 Move (DestroyIcon(hBitmap)) to iVoid
2387 Move True to bOk
2388 End
2389 End
2390 End
2391 // if a bitmap - load from resource first then from file
2392 Else Begin
2393 Get_File_Path sImage to sFileImage // find path in DFPATH, if appropriate
2394
2395 If (sFileImage <> "") Begin // The image was found!
2396 Send ComLoadBitmap of hoIcons sFileImage iId xtpImageNormal
2397 Move True to bOk
2398 End
2399 End
2400
2401 Function_Return (If(bOk, iId, 0))
2402 End_Function // AddImageType
2403
2404 // AddImage
2405
2406 // Adds an image to imagelist.
2407 // We assume that this is an icon unless the .bmp extension is passed.
2408 // return True if success
2409 Function AddImage String sImage Integer iId Returns Integer
2410 Boolean bIsIcon
2411 Move (Pos(".bmp", Lowercase(sImage)) = 0) to bIsIcon
2412 Get AddImageType bIsIcon sImage iId to iId
2413 Function_Return iId
2414 End_Procedure // AddImage
2415
2416 // AllowMultiLineCells
2417
2418 // Send this message to enable multi line cells in the grid. (usually this message is sent by a column object
2419 // when it's pbMultiLine property is set to true.
2420 { Visibility=Private }
2421 Procedure AllowMultiLineCells
2422 Handle hoPaintManager
2423 Get phoReportPaintManager to hoPaintManager
2424 Set ComFixedRowHeight of hoPaintManager to False // makes painting slower
2425 End_Procedure
2426
2427
2428 // CreateDataSource
2429
2430 // Called by constructor to create a datasource
2431 Function CreateDataSource Returns Boolean
2432 Handle hoDataSource
2433 Get Create (RefClass(cCJGridDataSource)) to hoDataSource
2434 Function_Return hoDataSource
2435 End_Function
2436
2437 // CreateHeaderContextMenu
2438
2439 // Called by constructor to create a header context menu. Can be augmented
2440 // create a different object or none at all
2441 Function CreateHeaderContextMenu Returns Handle
2442 Handle hoMenu hoMenu1
2443 Get Create (RefClass(cCJContextMenu)) to hoMenu
2444 Get Create of hoMenu (RefClass(cCJGridFieldChooserMenuItem)) to hoMenu1
2445 Get Create of hoMenu (RefClass(cCJGridRestoreLayoutMenuItem)) to hoMenu1
2446 Set pbControlBeginGroup of hoMenu1 to True
2447 Get Create of hoMenu (RefClass(cCJGridFreezeColumnMenuItem)) to hoMenu1
2448 Set pbControlBeginGroup of hoMenu1 to True
2449 Function_Return hoMenu
2450 End_Function
2451
2452 // CreateContextMenu
2453
2454 // Called by constructor to create a regular context grid menu. Can be augmented
2455 // create a different object or none at all. By default this creates nothing
2456 Function CreateContextMenu Returns Handle
2457 Function_Return 0
2458 End_Function
2459
2460
2461 // CreateFieldChooserPanel
2462
2463 // Called by constructor to create a field chooser panel. Can be augmented
2464 // create a different object or none at all
2465 Function CreateFieldChooserPanel Returns Handle
2466 Handle hoFieldChooserPanel
2467 Get Create (RefClass(cCJGridFieldChooserPanel)) to hoFieldChooserPanel
2468 Set phoGridObject of hoFieldChooserPanel to Self
2469 Function_Return hoFieldChooserPanel
2470 End_Function
2471
2472 // AttachFieldChooser
2473
2474 // Send this message to attach a field chooser object to the Grid. See ReportControl.FieldChooser
2475 // hoFieldChooser - is the object handle of the cCJGridFieldChooser control. The field chooser's COM object
2476 // should be already created before sending this message.
2477 Procedure AttachFieldChooser Handle hoFieldChooser Boolean bAttach
2478 Variant vFieldChooser
2479
2480 If (IsComObjectCreated(Self) and hoFieldChooser <> 0) Begin
2481 If bAttach Begin
2482 Get pvComObject of hoFieldChooser to vFieldChooser
2483 End
2484 Else Begin
2485 Move (NullComObject()) to vFieldChooser
2486 End
2487 Set ComFieldChooser to vFieldChooser
2488 End
2489 End_Procedure // AttachFieldChooser
2490
2491 // CanCopy
2492
2493 // Indicates whether a Copy operation can be performed., see ReportControl.CanCopy
2494 { NoDoc=True }
2495 Function CanCopy Returns Boolean
2496 Boolean bValue
2497 Get ComCanCopy to bValue
2498 Function_Return bValue
2499 End_Function
2500
2501 // CanCut
2502
2503 // Indicates whether a Cut operation can be performed., see ReportControl.CanCut
2504 { NoDoc=True }
2505 Function CanCut Returns Boolean
2506 Boolean bValue
2507 Get ComCanCut to bValue
2508 Function_Return bValue
2509 End_Function
2510
2511 // CanPaste
2512
2513 // Indicates whether a Paste operation can be performed., see ReportControl.CanPaste
2514 { NoDoc=True }
2515 Function CanPaste Returns Boolean
2516 Boolean bValue
2517 Get ComCanPaste to bValue
2518 Function_Return bValue
2519 End_Function
2520
2521
2522 // Dynamic_Colors
2523
2524 // We need to kill this procedure, else the procedures
2525 // Set Color and Set TextColor wont work. (Internal VDF behaviour).
2526 { Visibility=Private }
2527 Procedure Set Dynamic_Colors Integer i1 Integer i2
2528 End_Procedure
2529
2530 // OnComBeforeDrawRow
2531
2532 Procedure OnComBeforeDrawRow Variant llRow Variant llItem Variant llMetrics
2533 Handle hoItem hoRow hoMetrics
2534 Integer iSize iTop iLastTop iRowOffset iLastRowOffset iLastVisibleRowCount iVisRows
2535 Integer iRow iCol iSelectedRow iSelectedCol iBackColor iForeColor iFocusedColumnIndex
2536 String sValue
2537 Handle hoDataSource hoColumn hoFocus
2538 Boolean bCheckbox bChecked bFocusable bUseFocusCell bSelectionEnable bGridIsFocus bHideSelection bSelected
2539 Boolean bFauxSelection bCustomEdit
2540 Variant vFont
2541 Handle hoEdit
2542 Integer iSizeX iSizeY iLocX iLocY iGuiLoc iGuiLocX iGuiSize iGuiSizeX
2543
2544 Forward Send OnComBeforeDrawRow llRow llItem llMetrics
2545
2546 Get phoDataSource to hoDataSource
2547
2548 Get phoReportRow to hoRow
2549 Get phoReportRecordItem to hoItem
2550 Get phoReportRecordItemMetrics to hoMetrics
2551 Set pvComObject of hoRow to llRow
2552 Set pvComObject of hoItem to llItem
2553 Set pvComObject of hoMetrics to llMetrics
2554 Get ComIndex of hoItem to iCol
2555 Get ComIndex of hoRow to iRow
2556
2557 // if the top row changes, we make sure the data is paged in
2558 Get ComTopRowIndex to iTop
2559 Get piLastTopRowIndex to iLastTop
2560 Get piLastVisibleRowCount to iLastVisibleRowCount
2561 If (iLastVisibleRowCount=-1 or iLastTop<>iTop) Begin
2562 If (iLastVisibleRowCount=-1) Begin
2563 Get EstimateVisibleRowCount hoRow llItem to iVisRows
2564 Set piLastVisibleRowCount to iVisRows
2565 End
2566 // see below about closing the edit. If lasttop or lastvisible are -1
2567 // it indicates that things have been reset so there is no need to end this edit
2568 Get IsCustomEditMode to bCustomEdit
2569 If (bCustomEdit and iLastTop<>-1 and iLastVisibleRowCount<>-1) Begin
2570 Send EndEdit
2571 End
2572 Send PageData iTop
2573 Set piLastTopRowIndex to iTop
2574 End
2575
2576 Get SelectedColumn to iSelectedCol
2577 Get SelectedRow of hoDataSource to iSelectedRow
2578
2579 // as of CJ13.4.2 they no longer do any kind of focus change notification when you scroll via scrollbars
2580 // If the custom edit is active, it will just stay in place. So we need to check for a vertical or horizontal change
2581 // We do the veritcal above. Horizontal is harder. If the cell painted is the selected cell we can check to see if
2582 // the X location has changed. If so, we can assume this is a scroll and we will end the edit. The built in CJ edit seems
2583 // to already do this. We want to keep this change as small and local as possible
2584 Get IsCustomEditMode to bCustomEdit // this must be tested here again.
2585 If (bCustomEdit and iRow=iSelectedRow and iCol=iSelectedCol) Begin
2586 // return byref what the GUI location should be.
2587 Send GetCustomEditSizeAndLocation hoRow llItem (&iSizeY) (&iSizeX) (&iLocY) (&iLocX)
2588 Get phoCustomEdit to hoEdit
2589 // get the edit control's actual gui X location
2590 Get GuiLocation of hoEdit to iGuiLoc // First get the gui X location
2591 Move (Low(iGuiLoc)) to iGuiLocX
2592 Move (Cast(iGuiLocX, Short)) to iGuiLocX // cast to a short signed integer, this preserves -ve locations
2593 // Size can change when edit size is adjusted down to fit within scrolled within scrolled area
2594 Get GuiSize of hoEdit to iGuiSize
2595 Move (Low(iGuiSize)) to iGuiSizeX
2596
2597 If (iLocX <> iGuiLocX or iSizeX<>iGuiSizeX) Begin
2598 Send EndEdit
2599 End
2600 End
2601
2602 Get DataForCell of hoDataSource iRow iCol to sValue
2603 Get ColumnObject iCol to hoColumn
2604 Send DrawCell of hoColumn hoRow hoItem hoMetrics iRow sValue
2605
2606 Get GetFocusedColumnIndex to iFocusedColumnIndex // we want item order (not display)
2607 // If subfocus is allowed, the grid will always have a focus column even if we
2608 // set SelectedColumn to -1. This matters when row selection is enabled. The control
2609 // paints focus cell in the regular color, which is one of the things we are
2610 // trying to stop here. So SelectedColumn is -1 and there is a focus cell we
2611 // want to paint that focus cell in the selected row color and not the focus
2612 // cell color, because from our point of view it is not focused. This is most likely
2613 // to happen when the grid does not have the focus since giving the grid the focus
2614 // sets a SelectedColumn. We are not forcing a SelectedColumn because doing that
2615 // sends entering messages that may not make sense when the grid does not have the
2616 // focus
2617 If (iFocusedColumnIndex>=0 and iSelectedCol<>iFocusedColumnIndex) Begin
2618 If (iFocusedColumnIndex>=0 and iSelectedCol=-1) Begin
2619 Move iFocusedColumnIndex to iSelectedCol
2620 // tells us the control has a selection but SelectedColumn is actually -1
2621 Move True to bFauxSelection
2622 End
2623 Else Begin
2624 // It can actually get here. When multi-row columns is supported this message can get set when
2625 // our SelectedColumn and the COM focus column are different, such as in OnExit. This should not cause
2626 // problems because whatever painting of a COM focus cell that occurs is eventually repainted with the right color
2627 // (at least that is what I am seeing).
2628 End
2629 End
2630
2631 If (iSelectedCol<>-1 and iRow = iSelectedRow and iCol = iSelectedCol) Begin
2632 // If Row & Column match the selected cell then save the font....
2633 Get ComFont of hoMetrics to vFont
2634 Get ComForeColor of hoMetrics to iForeColor
2635 Set private_pvSelectedFont to vFont
2636 Set private_piSelectedTextColor to iForeColor
2637
2638 // draw the focused cell colors....
2639 Get pbUseFocusCellColors to bUseFocusCell
2640 Get pbSelectionEnable to bSelectionEnable
2641
2642 If (bUseFocusCell or bFauxSelection) Begin
2643 Get Focus to hoFocus
2644 Move (hoFocus = Self) to bGridIsFocus
2645
2646 // Get the focus cell colors....
2647 If bFauxSelection Begin
2648 // if a false cell selection using clNone will make it use whatever the
2649 // highlight color is supposed to be (i.e. same as the rest of the selected row)
2650 Move clNone to iBackColor
2651 Move clNone to iForeColor
2652 End
2653 Else Begin
2654 Get piFocusCellBackColor to iBackColor
2655 Get piFocusCellForeColor to iForeColor
2656 End
2657
2658 // it is possible for the selected row to not be a "selection". Can happen with multi-select
2659 Get ComSelected of hoRow to bSelected
2660 If bSelected Begin
2661 // get the highlight row background color. This is applied if the focus color is clNone
2662 // or the grid does not have the focus....
2663 If ((iBackColor = clNone or not(bGridIsFocus)) and bSelectionEnable) Begin // clNone = use Selected row color
2664 If (bGridIsFocus) Begin
2665 Get piHighlightBackColor to iBackColor
2666 End
2667 Else Begin
2668 Get piSelectedRowBackColor to iBackColor
2669 End
2670 End
2671
2672 // get the highlight row text color. This is applied if the focus color is clNone
2673 // or the grid does not have the focus....
2674 If ((iForeColor = clNone or not(bGridIsFocus)) and bSelectionEnable) Begin // clNone = use Selected row color
2675 If (bGridIsFocus) Begin
2676 Get piHighlightForeColor to iForeColor
2677 End
2678 Else Begin
2679 Get piSelectedRowForeColor to iForeColor
2680 End
2681 End
2682 End
2683
2684 // Apply the focus colors, but only if the grid has the focus, or if the grid does not have the focus and
2685 // selected row highlighting is enabled...
2686 Get pbHideSelection to bHideSelection
2687 If (bGridIsFocus or (bSelectionEnable and not(bGridIsFocus) and not(bHideSelection))) Begin
2688 If (iBackColor <> clNone and iBackColor <> clDefault) Begin
2689 Get ConvertSystemColor iBackColor to iBackColor
2690 Set ComBackColor of hoMetrics to iBackColor
2691 End
2692
2693 If (iForeColor <> clNone and iForeColor <> clDefault) Begin
2694 Get ConvertSystemColor iForeColor to iForeColor
2695 Set ComForeColor of hoMetrics to iForeColor
2696 End
2697 End
2698 End
2699 End
2700
2701 End_Procedure // OnComBeforeDrawRow
2702
2703 // OnComRowRClick
2704
2705 // Augmented to handle popping up a context menu....
2706 Procedure OnComRowRClick Variant llRow Variant llItem
2707 Handle hoReportRow hoReportItem
2708 Integer iRow iCol
2709 Boolean bPostEntering
2710
2711 Forward Send OnComRowRClick llRow llItem
2712 If (IsNullComObject(llRow)) Begin
2713 Procedure_Return
2714 End
2715 Get pbNeedPostEntering to bPostEntering
2716 If bPostEntering Begin
2717 Procedure_Return
2718 End
2719
2720 Get phoReportRow to hoReportRow
2721 Set pvComObject of hoReportRow to llRow
2722 Get ComIndex of hoReportRow to iRow
2723
2724 If (IsNullComObject(llItem)) Begin
2725 Move -1 to iCol
2726 End
2727 Else Begin
2728 Get phoReportRecordItem to hoReportItem
2729 Set pvComObject of hoReportItem to llItem
2730 Get ComIndex of hoReportItem to iCol
2731 End
2732
2733 Send OnRowRightClick iRow iCol
2734 End_Procedure
2735
2736 // Augmented to send OnRowDoubleClick
2737 Procedure OnComRowDblClick Variant llRow Variant llItem
2738 Handle hoReportRow hoReportItem
2739 Integer iRow iCol
2740
2741 Forward Send OnComRowRClick llRow llItem
2742
2743 Get phoReportRow to hoReportRow
2744 Set pvComObject of hoReportRow to llRow
2745 Get ComIndex of hoReportRow to iRow
2746
2747 Get phoReportRecordItem to hoReportItem
2748 Set pvComObject of hoReportItem to llItem
2749 Get ComIndex of hoReportItem to iCol
2750
2751 Send OnRowDoubleClick iRow iCol
2752 End_Procedure
2753
2754 // OnComDrawItem
2755
2756 // Augmented to draw a rectangle around the "focused cell".
2757 Procedure OnComDrawItem Variant llRow Variant llColumn Variant llItem OLE_HANDLE hDC ;
2758 Integer iLeft Integer iTop Integer iRight Integer iBottom Boolean ByRef llDoDefault
2759 Variant vFocusedColumn vFocusedRow vRow
2760 Boolean bVoid bUseFocusCell bContainsFocus
2761 Integer eHorizontalGrid eVerticalGrid
2762 Integer iVoid iRow iFocusedRow iFocusedCol iCol iPenColor
2763 Handle hPen hPenOld
2764 Handle hoRow hoRowCollection hoItem hoDataSource
2765 Pointer lpOrigin
2766 tWinPoint Origin
2767 tWinRect ARect
2768
2769 // not forwarded on purpose. It doesn't work
2770
2771 Get pbUseFocusCellRectangle to bUseFocusCell
2772 Get SelectedColumn to iFocusedCol
2773 Get ContainsFocus to bContainsFocus
2774
2775 If (bContainsFocus and bUseFocusCell and iFocusedCol<>-1) Begin
2776 Get phoReportRow to hoRow
2777 Set pvComObject of hoRow to llRow
2778 Get ComIndex of hoRow to iRow
2779 Get phoReportRecordItem to hoItem
2780 Set pvComObject of hoItem to llItem
2781 Get ComIndex of hoItem to iCol
2782
2783 Get phoDataSource to hoDataSource
2784 Get SelectedRow of hoDataSource to iFocusedRow
2785
2786 If (iRow = iFocusedRow and iCol = iFocusedCol ) Begin
2787
2788 Send ComGetItemRect of hoRow llItem (&iLeft) (&iTop) (&iRight) (&iBottom)
2789 // If grid lines are not present then we must adjust the item rectangle....
2790 Get peHorizontalGridStyle to eHorizontalGrid
2791 Get peVerticalGridStyle to eVerticalGrid
2792 If (eHorizontalGrid = xtpGridNoLines) Begin
2793 Increment iBottom
2794 End
2795 If (eVerticalGrid = xtpGridNoLines) Begin
2796 Increment iRight
2797 End
2798
2799 // Draw a special rectangle the also goes around the checkbox without filling it in....
2800 Get piFocusCellRectangleColor to iPenColor
2801 Move (CreatePen(PS_SOLID, 1, iPenColor)) to hPen
2802 Move (SelectObject(hDC, hPen)) to hPenOld
2803 Move (AddressOf(Origin)) to lpOrigin
2804 Move (MoveTo(hDC, iLeft, iTop, lpOrigin)) to bVoid
2805 Move (LineTo(hdc, iRight-2, iTop)) to bVoid
2806 Move (LineTo(hdc, iRight-2, iBottom-2)) to bVoid
2807 Move (LineTo(hdc, iLeft, iBottom-2)) to bVoid
2808 Move (LineTo(hdc, iLeft, iTop)) to bVoid
2809 Move (SelectObject(hDC, hPenOld)) to iVoid
2810 Move (DeleteObject(hPen)) to iVoid
2811 End
2812 End
2813 End_Procedure // OnComDrawItem
2814
2815 // OnComFocusChanging
2816
2817 // use this to synch the focus row with the datasource's selectrow
2818 // Thi gets called first to move to column (if needed) and then it is called to move the row (if needed). If col
2819 // is canceled, it is called to mvoe the row with the current column.
2820 Procedure OnComFocusChanging Variant llNewRow Variant llNewColumn Variant llNewItem Boolean ByRef llCancel
2821 Integer iIndex iOldRow iOldCol iCol
2822 Handle hoReportRow hoItem
2823 Boolean bSelect bInFocusChanging bNoFocusChangeCheck bPostEntering bEdit
2824 Handle hoDataSource
2825 Handle hoRows
2826 Variant vRows
2827
2828 Forward Send OnComFocusChanging llNewRow llNewColumn llNewItem (&llCancel)
2829
2830 // the control does not always kill the edit before calling the event. This can happen when
2831 // a right mouse click changes rows. This can result in the focus being changed after the
2832 // navigation change, which causes problems. If the edit is still active, we will cancel the
2833 // focus change. We handle the focus change ourselves in OnRowRightClick so cancelling here does
2834 // not cause a problem
2835 Get IsEditMode to bEdit
2836 If bEdit Begin
2837 Move True to llCancel
2838 Procedure_Return
2839 End
2840
2841 Get pbInRowFocusChanging to bInFocusChanging
2842 If bInFocusChanging Begin
2843 Error DFERR_PROGRAM "Assert: OnComFocusChanging recursion"
2844 Procedure_Return
2845 End
2846 Get pbNoFocusChangeCheck to bNoFocusChangeCheck
2847 If (bNoFocusChangeCheck) Begin
2848 Procedure_Return
2849 End
2850 Get pbNeedPostEntering to bPostEntering
2851 If bPostEntering Begin
2852 Move True to llCancel
2853 Procedure_Return
2854 End
2855
2856 Set pbInRowFocusChanging to True
2857
2858 // get column index
2859 Move -1 to iCol
2860 Get phoDataSource to hoDataSource
2861 Get phoReportRow to hoReportRow
2862 // there may be no column info (sub-focus not enabled)
2863 If (not(IsNullComObject(llNewItem))) Begin
2864 Get phoReportRecordItem to hoItem
2865 Set pvComObject of hoItem to llNewItem
2866 Get ComIndex of hoItem to iCol
2867 End
2868 // get row index
2869 Set pvComObject of hoReportRow to llNewRow
2870 Get ComIndex of hoReportRow to iIndex
2871
2872 // handle any row change notification
2873 Get RowChange iIndex to llCancel
2874 If (not(llCancel)) Begin
2875 // handle any column change notification
2876 Get ColumnChange iCol to llCancel
2877 End
2878
2879 // make sure the row points to original pointer. This can change.
2880 Get phoReportRows to hoRows
2881 Get ComRows to vRows
2882 Set pvComObject of hoRows to vRows
2883 Get ComRow of hoRows iIndex to llNewRow
2884
2885 Set pbInRowFocusChanging to False
2886 End_Procedure // OnComFocusChanging
2887
2888 // OnComGetToolTipInfo
2889
2890 // Send tooltip event to the appropriate column object.
2891 Procedure OnComGetToolTipInfo Variant lltoolTipInfo
2892 Variant vRow vItem vColumn
2893 Handle hoTooltipInfo hoColumnObject hoRow hoItem
2894 String sText sValue
2895 Integer iRow iItemIndex
2896
2897 Forward Send OnComGetToolTipInfo lltoolTipInfo
2898
2899 // read the tooltip properties....
2900 Get phoReportToolTipInfo to hoTooltipInfo
2901 Set pvComObject of hoTooltipInfo to lltoolTipInfo
2902 Get ComItem of hoTooltipInfo to vItem
2903 Get ComRow of hoTooltipInfo to vRow
2904 Get ComText of hoTooltipInfo to sText
2905
2906 // Find the row number....
2907 Get phoReportRow to hoRow
2908 If (IsComObject(vRow)) Begin
2909 Set pvComObject of hoRow to vRow
2910 Get ComIndex of hoRow to iRow
2911 End
2912
2913 // find the item's column object....
2914 Move -1 to iItemIndex
2915 Get phoReportRecordItem to hoItem
2916 If (IsComObject(vItem)) Begin
2917 Set pvComObject of hoItem to vItem
2918 Get ComIndex of hoItem to iItemIndex
2919 Get ColumnObject iItemIndex to hoColumnObject
2920 Get RowValue of hoColumnObject iRow to sValue
2921 End
2922
2923 // send the custom tooltip event....
2924 If (hoColumnObject <> 0) Begin
2925 Get OnGetTooltip of hoColumnObject iRow sValue sText to sText
2926 Set ComText of hoTooltipInfo to sText // apply the tooltip
2927 End
2928 End_Procedure // OnComGetToolTipInfo
2929
2930 // OnComItemCheck
2931
2932 Procedure OnComItemCheck Variant llRow Variant llItem
2933 Handle hoRow hoItem
2934 Integer iRow iColumn
2935 Boolean bAllowEdit
2936
2937 Forward Send OnComItemCheck llRow llItem
2938
2939 // Test that the grid is editable....
2940 Get pbAllowEdit to bAllowEdit
2941
2942 If (bAllowEdit) Begin
2943 Get phoReportRow to hoRow
2944 Get phoReportRecordItem to hoItem
2945 Set pvComObject of hoRow to llRow
2946 Set pvComObject of hoItem to llItem
2947 Get ComIndex of hoItem to iColumn
2948 Get ComIndex of hoRow to iRow
2949 Get CanEditColumn iColumn to bAllowEdit
2950 If bAllowEdit Begin
2951 Send NotifyItemChecked iRow iColumn
2952 End
2953 End
2954 End_Procedure // OnComItemCheck
2955
2956 // OnComKeyDown
2957
2958 Procedure OnComKeyDown Short ByRef llKeyCode Short llShift
2959 Boolean bInEdit
2960
2961 Forward Send OnComKeyDown (&llKeyCode) llShift
2962
2963 Get IsEditMode to bInEdit
2964 If bInEdit Begin
2965 Set piLastKey to 0
2966 End
2967 Else Begin
2968 Set piLastKey to llKeyCode
2969 Set piLastKey2 to llShift
2970 End
2971 End_Procedure
2972
2973 // OnComPreviewKeyDown
2974
2975 // Handle keyboard navigation duties. Triggered after a key is pressed down but before it is processed.
2976 Procedure OnComPreviewKeyDown Short ByRef iKeyCode Short iShift Boolean ByRef bCancel
2977 Handle hoNavigator
2978 Boolean bEditMode bFocusSub
2979 Forward Send OnComPreviewKeyDown (&iKeyCode) iShift (&bCancel)
2980
2981 If (iShift = 0) Begin
2982 Get phoReportNavigator to hoNavigator
2983 Get ComEditMode to bEditMode
2984 If (not(bEditMode)) Begin
2985 Get pbFocusSubItems to bFocusSub
2986 Case Begin
2987 Case (iKeyCode = VK_LEFT and bFocusSub) // Left Arrow 37
2988 //Send ComMoveLeft to hoNavigator False False
2989 Send Previous
2990 Move True to bCancel
2991 Case Break
2992
2993 Case (iKeyCode = VK_RIGHT and bFocusSub) // Right Arrow
2994 //Send ComMoveRight to hoNavigator False False
2995 Send Next
2996 Move True to bCancel
2997 Case Break
2998 Case (iKeyCode = VK_RETURN and bFocusSub) // Right Arrow
2999 Send OnEnterKey
3000 Move True to bCancel
3001 Case Break
3002 Case (iKeyCode = VK_DOWN) // Down Arrow
3003 Send MoveDownRow
3004 Move True to bCancel
3005 Case Break
3006 Case (iKeyCode = VK_UP) // Up Arrow
3007 Send MoveUpRow
3008 Move True to bCancel
3009 Case Break
3010 Case (iKeyCode = VK_ESCAPE) // esc
3011 Send OnEscKey
3012 Move True to bCancel
3013 Case Break
3014 Case End
3015 End
3016 End
3017 End_Procedure // OnComPreviewKeyDown
3018
3019 { Visibility=Private }
3020 // this returns by reference the GUI size and location for the edit control.
3021 Procedure GetCustomEditSizeAndLocation Handle hoRow Variant llItem Integer ByRef iSizeY Integer ByRef iSizeX Integer ByRef iLocY Integer ByRef iLocX
3022 Integer iL iT iR iB
3023 Integer iEL iET iER iEB
3024 Integer iGuiLoc iGuiLocX iGuiLocY
3025
3026 Get GuiLocation to iGuiLoc
3027 Move (Low(iGuiLoc)) to iGuiLocX
3028 Move (Hi(iGuiLoc)) to iGuiLocY
3029
3030 Move (Cast(iGuiLocX,Short)) to iGuiLocX // Cast these integers as signed 2-byte short integers (this preserves -ve locations)
3031 Move (Cast(iGuiLocY,Short)) to iGuiLocY
3032
3033 Send ComGetItemRect of hoRow llItem (&iL) (&iT) (&iR) (&iB)
3034 // must makes sure bottom and right fits within report area
3035 Send ComGetElementRect xtpReportElementRectReportArea (&iEL) (&iET) (&iER) (&iEB)
3036 Move (iR min iER) to iR
3037 //Move (iB min iEB) to iB // bottom looks better without this adjustment
3038
3039 Move (iB-iT-3) to iSizeY
3040 Move (iR-iL-3) to iSizeX
3041 Move (iT + iGuiLocY + 3) to iLocY
3042 Move (iL + iGuiLocX + 3) to iLocX
3043 End_Procedure
3044
3045
3046 Procedure OnComRequestEdit Variant llRow Variant llColumn Variant llItem Boolean ByRef llCancel
3047 Handle hoRow hoItem hoCol hoForm
3048 Integer iLocX iLocY iSizeX iSizeY
3049 Integer iRow iCol iKey iVoid iKey2 iChar
3050 Handle hoReportColumn hoReportRow hoReportItem hWnd
3051 Handle hoFont
3052 Variant vFont
3053 String sTypeFace
3054 Integer iFontSize iWeight iColor iTextColor
3055 Boolean bItalic bUnderline bSubFocus bCancel bOk bIsCutCopyPaste
3056
3057 Forward Send OnComRequestEdit llRow llColumn llItem (&llCancel)
3058
3059 // you cannot edit if the focus is not in the grid. This should not happen.
3060 If (Focus(Self)<>Self) Begin
3061 Move True to llCancel
3062 Procedure_Return
3063 End
3064
3065 Get pbEditOnTyping to bOk
3066 Get piLastKey to iKey
3067 Get piLastKey2 to iKey2
3068 If (not(bOk) and iKey<>0) Begin
3069 Move True to llCancel
3070 Procedure_Return
3071 End
3072
3073 Get phoReportColumn to hoCol
3074 Set pvComObject of hoCol to llColumn
3075 Get phoReportRow to hoRow
3076 Set pvComObject of hoRow to llRow
3077 Get phoReportRecordItem to hoItem
3078 Set pvComObject of hoItem to llItem
3079 Get ComIndex of hoItem to iCol
3080 Get ComIndex of hoRow to iRow
3081
3082 Get CanEditColumn iCol to bOk
3083 If not bOk Begin
3084 Move True to llCancel
3085 Procedure_Return
3086 End
3087
3088 // can't rely on selectedColumn because it may be -1 with FocuSubItems=false
3089 Set piCurrentEditColumn to iCol
3090 Get ColumnObject iCol to hoReportColumn
3091 Get CustomEditObject of hoReportColumn to hoForm`
3092 If not hoForm Begin
3093 Procedure_Return
3094 End
3095
3096 // Get the selected item's Font properties....
3097 Get Create (RefClass(cComStdFont)) to hoFont
3098 Get private_pvSelectedFont to vFont
3099 Set pvComObject of hoFont to vFont
3100
3101 If (not(IsNullComObject(vFont))) Begin
3102 // Get font properties....
3103 Get ComSize of hoFont to iFontSize
3104 Get ComName of hoFont to sTypeface
3105 Get ComWeight of hoFont to iWeight
3106 Get ComItalic of hoFont to bItalic
3107 Get ComUnderline of hoFont to bUnderline
3108
3109 // Get colors....
3110 Get private_piSelectedTextColor to iTextColor
3111
3112 Move (PointSizeToPhysicalFontSize(sTypeFace, iFontSize)) to iFontSize
3113 Set Typeface of hoForm to (ToAnsi(sTypeFace)) // Must set typeface first
3114 Set Physical_FontSize of hoForm to iFontSize 0
3115 Set FontWeight of hoForm to iWeight
3116 Set FontItalics of hoForm to bItalic
3117 Set FontUnderline of hoForm to bUnderline
3118 If (iTextColor <> -1) Begin // -1 = default color
3119 Set TextColor of hoForm to iTextColor
3120 End
3121 End
3122
3123 Send Destroy to hoFont
3124
3125 Send GetCustomEditSizeAndLocation hoRow llItem (&iSizeY) (&iSizeX) (&iLocY) (&iLocX)
3126 Set GuiSize of hoForm to iSizeY iSizeX
3127 Set GuiLocation of hoForm to iLocY iLocX
3128 Send ActivateForm of hoForm
3129
3130 Get piLastKey to iKey
3131 Get piLastKey2 to iKey2
3132 If (iKey<>0 and iKey<>VK_TAB) Begin
3133 // 1=shift, 2=ctrl, 4=alt
3134 Move ( (iKey2=2 or iKey2=3) and (iKey=VK_C or iKey=VK_X or iKey=VK_V)) to bIsCutCopyPaste // we allow Ctrl or Ctrl+Shift X/C/V
3135 If ( ((iKey2 iand 6)=0) or bIsCutCopyPaste) Begin // skip ctrl and alt keys, except cut/copy/paste
3136 Move (MapVirtualKey(iKey,MAPVK_VK_TO_CHAR)) to iChar
3137 Get GetVKeyToAnsi iKey iKey2 to iChar
3138 If (iChar) Begin
3139 Get Form_Window_Handle of hoForm 0 to hWnd
3140 Move (PostMessage(hWnd,WM_KEYDOWN,iKey,ikey2)) to iVoid
3141 Set piLastKey to 0
3142 End
3143 End
3144
3145 End
3146 Move True to llCancel
3147 End_Procedure // OnComRequestEdit
3148
3149 { Visibility=Private }
3150 // convert current key press from keydown to ANSI character. Returns 0 in a char
3151 Function GetVKeyToAnsi Integer iVKey Integer iShiftBits Returns Integer
3152 Integer iCapsLock iAnsi
3153 Get_Key_State VK_CAPITAL to iCapslock // is the capslock key currently depressed?
3154 Get To_Ascii iVKey iShiftBits (iCapslock=1) to iAnsi
3155 Function_Return iAnsi
3156 End_Function
3157
3158 // OnComValueChanged
3159
3160 Procedure OnComValueChanged Variant llRow Variant llColumn Variant llItem
3161 Handle hoRow hoItem
3162 Integer iRow iColumn
3163 String sValue
3164
3165 Forward Send OnComValueChanged llRow llColumn llItem
3166
3167 Get phoReportRow to hoRow
3168 Get phoReportRecordItem to hoItem
3169
3170 Set pvComObject of hoRow to llRow
3171 Set pvComObject of hoItem to llItem
3172 Get ComIndex of hoItem to iColumn
3173 Get ComIndex of hoRow to iRow
3174 Get ComCaption of hoItem to sValue
3175 Send NotifyEndEdit iRow iColumn sValue
3176 End_Procedure // OnComValueChanged
3177
3178 // OnComMouseDown
3179
3180 // augmented to set internal property to false, which may get reset in OnComColumnOrderChangedEx
3181 Procedure OnComMouseDown Short llButton Short llShift Integer llx Integer lly
3182 Handle hoFocus
3183 Forward Send OnComMouseDown llButton llShift llx lly
3184 // as of 13.4.2, the control no longer sets the focus on a right mouse click. We will
3185 // do so here, if needed, to make this work the way it used to
3186 If (llButton=2) Begin
3187 Get Focus to hoFocus
3188 If (hoFocus<>Self) Begin
3189 Send Activate
3190 End
3191 End
3192 Set piLastKey to 0
3193 Set peGridMouseStatus to gmsMouseStatusDown
3194 End_Procedure
3195
3196 // OnComMouseUp
3197
3198 // augment to handle mouse header click
3199 Procedure OnComMouseUp Short llButton Short llShift Integer llx Integer lly
3200 Handle hoHitTest hoReportColumn
3201 Variant vHit vCol
3202 Integer iCol eHt
3203 Boolean bPostEntering
3204 Integer eMouse
3205
3206// Showln "mouse up" (pbNeedPostEntering(Self))
3207
3208 Forward Send OnComMouseUp llButton llShift llx lly
3209
3210 Get peGridMouseStatus to eMouse // bColOrderChange
3211 Set peGridMouseStatus to gmsMouseStatusCleared
3212 If (eMouse<>gmsMouseStatusDown) Begin
3213 Procedure_Return
3214 End
3215
3216 // if the grid does not have the focus we should not proceed. This should
3217 // not happen - MouseDown sets focus and R-MouseDown is handled in OnComMouseDown
3218 If (Focus(Self)<>Self) Begin
3219 Procedure_Return
3220 End
3221
3222 Get pbNeedPostEntering to bPostEntering
3223 If bPostEntering Begin
3224 Procedure_Return
3225 End
3226
3227
3228
3229 Get Create (RefClass(cCJReportHitTestInfo)) to hoHitTest
3230 Get ComHitTest llx lly to vHit
3231 Set pvComObject of hoHitTest to vHit
3232 Get ComHt of hoHitTest to eHt
3233 If (eHt=xtpHitTestHeader) Begin
3234 Get ComColumn of hoHitTest to vCol
3235 If (IsNullComObject(vCol)) Begin
3236 Move -1 to iCol
3237 End
3238 Else Begin
3239 Get phoReportColumn to hoReportColumn
3240 Set pvComObject of hoReportColumn to vCol
3241 Get ComItemIndex of hoReportColumn to iCol
3242 End
3243 If (llButton=1) Begin
3244 Send OnHeaderClick iCol
3245 End
3246 Else If (llButton=2) Begin
3247 Send OnHeaderRightClick iCol
3248 End
3249 End
3250 Else If (eHt=xtpHitTestUnknown) Begin
3251 Send OnUnknownAreaClick llx lly
3252 End
3253 Send Destroy of hoHitTest
3254
3255 End_Procedure
3256
3257 // OnComColumnOrderChangedEx
3258
3259 // augmented so we know that a header click did resulted in some kind of column move. When this happens
3260 // we don't want to treat a mouse up as a simple mouse click
3261 Procedure OnComColumnOrderChangedEx Variant llColumn XTPReportColumnOrderChangedReason llReason
3262 Forward Send OnComColumnOrderChangedEx llColumn llReason
3263 Set peGridMouseStatus to gmsMouseStatusMoved
3264 End_Procedure
3265
3266
3267 // OnCreate
3268
3269 // Called when the COM object is created.
3270 { Visibility=Private } // make this private. Use OnCreateGridControl for custom event
3271 Procedure OnCreate
3272 Forward Send OnCreate
3273 Send CreateGridControl
3274 End_Procedure
3275
3276 // OnCreateGridControl
3277
3278 { MethodType=Event }
3279 Procedure OnCreateGridControl
3280 End_Procedure
3281
3282
3283 // OnIdle
3284
3285 { MethodType=Event }
3286 Procedure OnIdle
3287 Boolean bDirty bCancel bNeedsRedraw bNeedsPostEntry
3288 Handle hoDataSource hoCol
3289 Integer iRow
3290 Get phoDataSource to hoDataSource
3291
3292 Get piDeferredRemoveRow to iRow
3293 If (iRow<>-1) Begin
3294 Set piDeferredRemoveRow to -1
3295 Send RemoveRowAndSelect iRow
3296 End
3297 // this provides a mechanism for moving to a different column within a focus change
3298 // event. This is used so validation can move to the error column. This must be used with care.
3299 // There is no way to defer switch rows with a focuschanging event. Doesn't make sense
3300 Get phoDeferredFocusColumn to hoCol
3301 If hoCol Begin
3302 Set phoDeferredFocusColumn to 0
3303 Get MoveToColumnObject hoCol to bCancel
3304 End
3305
3306 Get DataSourceSynchRequired of hoDataSource to bDirty
3307 If (bDirty) Begin
3308 Send ReSynchToDataSource
3309 End
3310 Get pbNeedsRedraw to bNeedsRedraw
3311 If (bNeedsRedraw) Begin
3312 Send ComRedraw
3313 End
3314
3315 // handle a post entering event
3316 Get pbNeedPostEntering to bNeedsPostEntry
3317 If bNeedsPostEntry Begin
3318 Set pbNeedPostEntering to False
3319 Send PostEntering
3320 End
3321
3322 Send BeginEditOnIdle
3323
3324 End_Procedure // OnIdle
3325
3326 { Visibility=Private }
3327 // OnIdle is done and needs to check if the edit control should take the focus.
3328 // We set the focus if pbBeginEditOnIdle is true (set by activate) and the grid has
3329 // the focus. ResetEditMode may not activate the edit control. This only does something if
3330 // pbEditOnNavigate/pbEditOnClick is true (i.e., aggressive edit mode)
3331 Procedure BeginEditOnIdle
3332 Boolean bBeginEdit
3333 Handle hoFoc
3334 Get pbBeginEditOnIdle to bBeginEdit
3335 If bBeginEdit Begin
3336 Set pbBeginEditOnIdle to False
3337 Get Focus to hoFoc
3338 If (hoFoc=Self) Begin
3339 Send ResetEditMode False
3340 End
3341 End
3342 End_Procedure
3343
3344 { NoDoc=True }
3345 Procedure ComRedraw
3346 Forward Send ComRedraw
3347 Set pbNeedsRedraw to False
3348 End_Procedure
3349
3350 { MethodType=Event }
3351 // called before row change. iCurrentSelectedRow is the SelectedRow. Return True to cancel
3352 Function OnRowChanging Integer iCurrentSelectedRow Integer iNewRow Returns Boolean
3353 Function_Return False
3354 End_Function
3355
3356 { MethodType=Event }
3357 // called after the row change has succeeded. iNewSelectedRow is now the SelectedRow
3358 Procedure OnRowChanged Integer iOldRow Integer iNewSelectedRow
3359 End_Procedure
3360
3361 { MethodType=Event }
3362 Procedure OnEnterKey
3363 Boolean bEditOnKeyNavigate
3364 Get pbEditOnKeyNavigation to bEditOnKeyNavigate
3365 If gbKEnterNext Begin
3366 Send Next
3367 End
3368 Else If (not(bEditOnKeyNavigate)) Begin
3369 Send ToggleEdit
3370 End
3371 End_Procedure
3372
3373 { MethodType=Event }
3374 Procedure OnEscKey
3375 Boolean bIsEdit
3376 Get IsEditMode to bIsEdit
3377 Send EndEdit
3378 Send Request_Cancel
3379 If (IsComObjectCreated(Self) and bIsEdit) Begin
3380 Send BeginEdit
3381 End
3382 End_Procedure
3383
3384 { Visibility=Private }
3385 Procedure Request_Cancel
3386 Send Deactivate 3 // AREA_FLAG
3387 End_Procedure
3388
3389 // OnRelease
3390
3391 { MethodType=Event }
3392 Procedure OnRelease
3393 End_Procedure
3394
3395 { MethodType=Event}
3396 Procedure OnHeaderClick Integer iCol
3397 Boolean bSelectCol bFocusSub bPrompt bCancel
3398 Handle hoCol hoPrompt
3399 Integer iSel
3400 If (iCol<>-1) Begin
3401 Get SelectedColumn to iSel
3402 Get pbFocusSubItems to bFocusSub
3403 Get pbHeaderSelectsColumn to bSelectCol
3404 Get pbHeaderPrompts to bPrompt
3405 Get ColumnObject iCol to hoCol
3406
3407 Send HeaderReorder iCol
3408
3409 If (bPrompt) Begin
3410 Get Prompt_Object of hoCol to hoPrompt
3411 End
3412
3413 If (((hoPrompt) or bSelectCol) and (iSel<>iCol)) Begin
3414 Get MoveToColumnObject hoCol to bCancel
3415 End
3416
3417 If (hoPrompt and not(bCancel)) Begin
3418 Send Prompt
3419 End
3420 End
3421 End_Procedure
3422
3423 // Handle popping up a click in an unknown area. If autoappend is allowed we will attempt to append
3424 // a row to the end of the table. This can be easily cancelled.
3425 { MethodType=Event }
3426 Procedure OnUnknownAreaClick Integer iX Integer iY
3427 Boolean bEnterOnClick
3428 Integer iEL iET iER iEB
3429 Integer eHt iRow iBottomRow
3430 Handle hoHitTest hoDatasource hoReportRow
3431 Variant vHit vRow
3432
3433 // we only want to test if the hit is within the report area
3434 Send ComGetElementRect xtpReportElementRectReportArea (&iEL) (&iET) (&iER) (&iEB)
3435 If (iY<iEB) Begin
3436
3437 // We want to find a known area above this hit area. This may be
3438 // a row or it could be something else. Move up one pixel at a time until
3439 // we find something
3440 Get Create (RefClass(cCJReportHitTestInfo)) to hoHitTest
3441 Repeat
3442 Get ComHitTest iX iY to vHit
3443 Set pvComObject of hoHitTest to vHit
3444 Get ComHt of hoHitTest to eHt
3445 Decrement iY
3446 Until (iY<0 or eHt<>xtpHitTestUnknown)
3447 // if we found report area we are in the right zone
3448 // note that this will not work with empty rows but that's
3449 // ok because that is handled elsewhere
3450 If (eHt=xtpHitTestReportArea) Begin
3451 Get phoReportRow to hoReportRow
3452 Get ComRow of hoHitTest to vRow
3453 Set pvComObject of hoReportRow to vRow
3454 Get ComIndex of hoReportRow to iRow
3455 End
3456 Else Begin
3457 Move -1 to iRow
3458 End
3459 Send Destroy of hoHitTest
3460
3461 Get phoDataSource to hoDatasource
3462 Get RowCount of hoDatasource to iBottomRow
3463 // if we backed up to a row or we backed up to the header in an emtpty grid, we are ok
3464 If ((eHt=xtpHitTestReportArea) or (eHt=xtpHitTestHeader and iBottomRow=0)) Begin
3465 Decrement iBottomRow // if no rows, this will be -1
3466 // we only do anything if this is the last row. This may only be the
3467 // last row in the cache but that's ok, it will just do a down.
3468 // If the grid is empty both will be -1, which will also work
3469 If (iRow=iBottomRow) Begin
3470 // if bottom is -1, we have an empty grid
3471 If (iBottomRow>=0) Begin
3472 // we will do an append by jumping to the last row
3473 // and doing a down. If allowed, this will do an autoappend
3474 Get SelectedRow of hoDatasource to iBottomRow
3475 // move to last row if needed
3476 If (iRow<>iBottomRow) Begin
3477 Send MoveToRow iRow
3478 Get SelectedRow of hoDatasource to iBottomRow
3479 End
3480 End
3481 // down from that row. May append my not
3482 If (iRow=iBottomRow) Begin
3483 Send MoveDownRow
3484 // if move succeeded go to first enterable column
3485 Get SelectedRow of hoDatasource to iBottomRow
3486 If (iBottomRow=iRow+1) Begin
3487 Send MoveToFirstEnterableColumn
3488 Get pbEditOnClick to bEnterOnClick
3489 If bEnterOnClick Begin
3490 Send BeginEdit
3491 End
3492 End
3493 End
3494 End
3495 End
3496 End
3497
3498 End_Procedure
3499
3500
3501 // OnHeaderRightClick
3502
3503 // Handle poping up a header context menu
3504 { MethodType=Event }
3505 Procedure OnHeaderRightClick Integer iCol
3506 Handle hoHeaderContextMenu hoReportColumn
3507 Handle hoColumn
3508 Integer iIndex
3509
3510 Get phoHeaderContextMenu to hoHeaderContextMenu
3511 If (iCol<>-1) Begin
3512 Get ColumnObject iCol to hoColumn
3513 // allow header to customize this choice
3514 Get HeaderContextMenu of hoColumn hoHeaderContextMenu to hoHeaderContextMenu
3515 End
3516 // Activate the popup....
3517 If (hoHeaderContextMenu <> 0) Begin
3518 Set phoContextMenuColumn to hoColumn
3519 Send Popup to hoHeaderContextMenu
3520 End
3521 End_Procedure
3522
3523
3524 { MethodType=Event }
3525 Procedure OnRowDoubleClick Integer iRow Integer iCol
3526 End_Procedure
3527
3528 // Handle popping up a context menu over a row
3529 { MethodType=Event }
3530 Procedure OnRowRightClick Integer iRow Integer iCol
3531 Handle hoContextMenu
3532 Handle hoColumn hoDataSource
3533 Integer iSelRow iSelCol
3534 Boolean bFocusSub bCancel
3535
3536 If (Focus(Self)<>Self) Begin
3537 Procedure_Return
3538 End
3539
3540 Get phoDataSource to hoDataSource
3541 Get pbFocusSubItems to bFocusSub
3542
3543 // make sure the focus is on the right row and column. If not, no menu
3544 // do this before calling the column ContextMenu so it is called
3545 // with the proper settings
3546 Get SelectedRow of hoDataSource to iSelRow
3547 If (iSelRow<>iRow) Begin
3548 Send MoveToRow iRow
3549 Get SelectedRow of hoDataSource to iSelRow
3550 If (iSelrow<>iRow) Begin
3551 Procedure_Return // row focus change failed. no menu
3552 End
3553 End
3554
3555 If (bFocusSub) Begin
3556 If (iCol<>-1) Begin
3557 Get ColumnObject iCol to hoColumn
3558 Get SelectedColumn to iSelCol
3559 If (iSelCol<>iCol) Begin
3560 Get MoveToColumnObject hoColumn to bCancel
3561 If bCancel Begin
3562 Procedure_Return // column focus change failed, no menu
3563 End
3564 End
3565 End
3566 End
3567
3568 // this is our default menu
3569 Get phoContextMenu to hoContextMenu
3570 // get custom menu from column
3571 If (bFocusSub and iCol<>-1) Begin
3572 Get ContextMenu of hoColumn hoContextMenu to hoContextMenu
3573 End
3574
3575 // only do something if we actually have a menu
3576 If hoContextMenu Begin
3577 // property might be useful for a context menu
3578 Set phoContextMenuColumn to hoColumn
3579 Send Popup of hoContextMenu
3580
3581 End
3582 End_Procedure
3583
3584
3585 { MethodType=Event }
3586 Function OnExiting Handle hoDestination Returns Boolean
3587 Function_Return False
3588 End_Function
3589
3590 { MethodType=Event }
3591 Procedure OnEntering
3592 End_Procedure
3593
3594 { MethodType=Event }
3595 Function OnPostEntering Returns Boolean
3596 Function_Return False
3597 End_Function
3598
3599 // When next or previous results in a wrap you can choose to cancel (set bCancel True)
3600 // stay within the row (set bWrapRow to False) or activate some other object, row, or column
3601 // (just do it and set bCancel True)
3602 { MethodType=Event }
3603 Procedure OnWrappingRow Boolean bForwardWrap Handle hoToColumn Boolean ByRef bWrapRow Boolean ByRef bCancel
3604 End_Procedure
3605
3606
3607 // RegisterColumn:
3608
3609 // Registers a column object in the columns collection.
3610 { Visibility=Private }
3611 Procedure RegisterColumn Handle hoColumn
3612 Integer iSize
3613 Handle[] hoColumnObjects
3614 Get phoColumnObjects to hoColumnObjects
3615 Move (SizeOfArray(hoColumnObjects)) to iSize
3616 Move hoColumn to hoColumnObjects[iSize]
3617 Set piColumnId of hoColumn to iSize
3618 Set phoColumnObjects to hoColumnObjects
3619 End_Procedure // RegisterColumn
3620
3621 // tells grid to redraw when idle
3622
3623 Procedure DeferredRedraw
3624 Set pbNeedsRedraw to True
3625 End_Procedure
3626
3627 // RowChange
3628
3629 // handles possible row change. returns false to cancel
3630 { Visibility=Private }
3631 Function RowChange Integer iNew Returns Boolean
3632 Handle hoDataSource
3633 Integer iOld iOldCol
3634 Boolean bCancel bOldCancel
3635 Get phoDataSource to hoDataSource
3636 Get SelectedRow of hoDataSource to iOld
3637 If (iOld<>iNew) Begin
3638 // first attempt to select column to -1.
3639 Get SelectedColumn to iOldCol
3640 If (iOld<>-1) Begin
3641 Get ColumnChange -1 to bCancel
3642 End
3643 Else Begin
3644 Send NewColumn -1
3645 End
3646 If not bCancel Begin
3647 Get OnRowChanging iOld iNew to bCancel // iOld is SelectedRow
3648 If not bCancel Begin
3649 // attempt to do row change
3650 Get RowChanging iOld iNew to bCancel
3651 End
3652 If not bCancel Begin
3653 Send SelectRow of hoDataSource iNew True
3654 Send OnRowChanged iOld iNew // iNew is now SelectedRow
3655 End
3656 Else Begin
3657 // if attempt fails, restore the old selected column
3658 Get ColumnChange iOldCol to bOldCancel
3659 End
3660 End
3661 End
3662 Function_Return bCancel
3663 End_Function // RowChange
3664
3665 // SelectedColumn
3666
3667 // Call this to get the index of the currently focused column.
3668 Function SelectedColumn Returns Integer
3669 Integer iIndex iRow
3670 Handle hoDataSource
3671 Get phoDataSource to hoDataSource
3672 Get SelectedRow of hoDataSource to iIndex
3673 If (iIndex<>-1) Begin
3674 Get piSelectedColumn to iIndex
3675 End
3676 Function_Return iIndex
3677 End_Function
3678
3679 // SetTooltipMargin
3680
3681 // sets the top, left, bottom, and right margins of the tool tip window. This is the "padding" that is placed around
3682 // the tool tip text in the tool tip window.
3683 Procedure SetTooltipMargin Integer iLeft Integer iTop Integer iRight Integer iBottom
3684 Handle hoTooltipContext
3685
3686 Set piTooltipMarginTop to iTop
3687 Set piTooltipMarginLeft to iLeft
3688 Set piTooltipMarginBottom to iBottom
3689 Set piTooltipMarginRight to iRight
3690
3691 If (IsComObjectCreated(Self)) Begin
3692 Get phoToolTipContext to hoTooltipContext
3693 Send ComSetMargin to hoTooltipContext iLeft iTop iRight iBottom
3694 End
3695 End_Procedure
3696
3697 // SetWatermark
3698
3699 // Sets a watermark bitmap to be shown in the report control background using a bitmap from file or resource.
3700 // sImage - Is the resource image name or the image filename.
3701 // iTransparency - Level of transparency. Values can be 0-255 with 0 being totally transparent and 255 being totally visible.
3702 Procedure SetWatermark String sImage Integer iTransparency
3703 Handle hBitmap
3704 Integer iVoid
3705 Boolean bOk
3706 String sFileImage
3707
3708 Set psWatermark to sImage
3709 Set piWatermarkTransparency to iTransparency
3710
3711 If (IsComObjectCreated(Self)) Begin
3712 Move (LoadImage(GetModuleHandle(0), sImage, IMAGE_BITMAP, 0, 0, 0)) to hBitmap
3713
3714 If hBitmap Begin
3715 Get ComSetWatermarkBitmap hBitmap iTransparency to bOk
3716 Move (DeleteObject(hBitmap)) to iVoid
3717 End
3718 Else Begin // the bitmap was not in the EXE resource
3719 Get_File_Path sImage to sFileImage // find path in DFPATH, if appropriate
3720
3721 If (sFileImage <> "") Begin // The image was found!
3722 Get ComSetWatermarkBitmapFromFile sFileImage iTransparency to bOk
3723 End
3724 End
3725 Send DeferredRedraw // ComRedraw
3726 End
3727 End_Procedure // SetWatermark
3728
3729 // ColumnObjectsInDisplayOrder
3730
3731 // return array of column objects in display order.
3732 // This will include non visible objects so you may have to test if the object is visible
3733 Function ColumnObjectsInDisplayOrder Returns Handle[]
3734 Handle[] ItemsArrays
3735 Handle[] ColumnObjects
3736 Integer iDisplayIndex iCols iColIndex
3737 Handle hoReportColumns hoReportColumn
3738 Variant vCol
3739 Get phoColumnObjects to ColumnObjects
3740 Get phoReportColumns to hoReportColumns
3741 Get phoReportColumn to hoReportColumn
3742 Get ComCount of hoReportColumns to iCols
3743 For iDisplayIndex from 0 to (iCols-1)
3744 Get ComColumn of hoReportColumns iDisplayIndex to vCol
3745 Set pvComObject of hoReportColumn to vCol
3746 Get ComItemIndex of hoReportColumn to iColIndex
3747 Move ColumnObjects[iColIndex] to ItemsArrays[iDisplayIndex]
3748 Loop
3749 Function_Return ItemsArrays
3750 End_Function // ColumnObjectsInDisplayOrder
3751
3752 // Must be called from BeforeDrawRow passing the row object and recorditem com pointer.
3753 // If variable length row, we change to guess.
3754 { Visibility=Private }
3755 Function EstimateVisibleRowCount Handle hoRow Variant llItem Returns Integer
3756 Integer iTop iLeft iBottom iRight
3757 Integer iRowTop iRowBottom iRowLeft iRowRight
3758 Integer iTopRow iRowHeight iRowCount iGridHeight iVisibleCount
3759 Number nVisibleCount
3760 Handle hoPaintManager
3761 Boolean bFixedHeight
3762
3763 // Get the report area coordinates....
3764 Send ComGetElementRect xtpReportElementRectReportArea (&iLeft) (&iTop) (&iRight) (&iBottom)
3765
3766 // Test that fixed row height it True (allowing us to extrapolate the height of a single row)....
3767 Get phoReportPaintManager to hoPaintManager
3768 Get ComFixedRowHeight of hoPaintManager to bFixedHeight
3769 If (not(bFixedHeight)) Begin
3770 // if not fixed we really dont know. I am using 10 as a height because that's pretty small.
3771 Move ( (iBottom-iTop) / 10 + 0.99) to nVisibleCount
3772 Move (nVisibleCount) to iVisibleCount
3773 Function_Return iVisibleCount
3774 End
3775
3776
3777 Send ComGetItemRect of hoRow llItem (&iRowLeft) (&iRowTop) (&iRowRight) (&iRowBottom)
3778
3779 Move (iRowBottom - iRowTop) to iRowHeight
3780 Move (iBottom - iTop) to iGridHeight
3781 Move (iGridHeight / iRowHeight + 0.99) to nVisibleCount
3782 Move (nVisibleCount) to iVisibleCount
3783
3784 Function_Return iVisibleCount
3785 End_Function // VisibleRowCount
3786
3787 // Selects column without entering exiting messages.
3788 // Note that this sets SelectedColumn but it does not synch this with
3789 // the grid's focus column. If you misuse this, things will not work
3790
3791 { Visibility=Private }
3792 Procedure NewColumn Integer iColumn
3793 Handle hoDataSource
3794 Integer iRow iCount
3795 Get phoDataSource to hoDataSource
3796 Get SelectedRow of hoDataSource to iRow
3797 If (iRow=-1 and iColumn<>-1) Begin
3798 Error DFERR_PROGRAM "selected col has no selected row"
3799 Function_Return False
3800 End
3801
3802 Get ColumnCount to iCount
3803 If (iColumn<>-1 and (iColumn<0) or (iColumn>=iCount)) Begin
3804 Error DFERR_PROGRAM "selected col out of range"
3805 Function_Return False
3806 End
3807 Else Begin
3808 Set piSelectedColumn to iColumn
3809 End
3810 End_Procedure
3811
3812 // Does a column exit without changing the current column.
3813 // Is used to force the column exiting events without changing
3814 // the column (used during object exiting)
3815
3816 Function ForceColumnExit Returns Boolean
3817 Integer iOld
3818 Boolean bCancel
3819 Get SelectedColumn to iOld
3820 If (iOld<>-1) Begin
3821 Get ColumnChange -1 to bCancel
3822 If not bCancel Begin
3823 Send NewColumn iOld
3824 End
3825 End
3826 Function_Return bCancel
3827 End_Function
3828
3829 // changes the column
3830
3831 { Visibility=Private }
3832 Function ColumnChange Integer iNew Returns Boolean
3833 Boolean bCancel bIsFocus
3834 Integer iOld
3835 Handle hoFocus
3836 Get SelectedColumn to iOld
3837 If (iOld<>iNew) Begin
3838 Get ColumnChanging iOld iNew to bCancel
3839 If not bCancel Begin
3840 Get Focus to hoFocus
3841 Move (Self=hoFocus) to bIsFocus
3842 If bIsFocus Begin
3843 Send Request_Status_Help False
3844 End
3845 Send NewColumn iNew
3846 Send ColumnChanged iOld iNew
3847 If bIsFocus Begin
3848 Send Request_Status_Help True
3849 End
3850 End
3851 End
3852 Function_Return bCancel
3853 End_Function
3854
3855 // this provides room for us to work within
3856 { Visibility=Private }
3857 Function ColumnChanging Integer iOld Integer iNew Returns Boolean
3858 Boolean bCancel
3859 Handle hoCol
3860 If (iOld<>-1) Begin
3861 Get ColumnObject iOld to hoCol
3862 Get Exiting of hoCol to bCancel
3863 End
3864 If (not(bCancel) and (iNew<>-1)) Begin
3865 Get ColumnObject iNew to hoCol
3866 Get Entering of hoCol to bCancel
3867 End
3868 Function_Return bCancel
3869 End_Function
3870
3871 // this provides room for us to work within
3872 { Visibility=Private }
3873 Procedure ColumnChanged Integer iOld Integer iNew
3874 Handle hoCol
3875 If (iOld<>-1) Begin
3876 Get ColumnObject iOld to hoCol
3877 Send Exit of hoCol
3878 End
3879 If (iNew<>-1) Begin
3880 Get ColumnObject iNew to hoCol
3881 Send Entry of hoCol
3882 End
3883 End_Procedure
3884
3885 Procedure CreateGridControl
3886 Variant vComObject vItem vEditOptions vConstraints vFormula
3887 Handle hoObject hoReportColumns hoDataSource hoPaintManager hoColumn hoToolTipContext hoFormula
3888 Handle hoReportRecord hoReportRecords hoReportRows hoEditOptions hoConstraints hoIdle
3889 Integer iColumn icColumn
3890 Integer iWidth iRowCount iValue
3891 Integer iLeft iTop iRight iBottom
3892 String sCaption sValue sSettings
3893 Boolean bResizable bValue
3894
3895 // Set up all static COM objects
3896 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3897
3898 // Columns Collection:
3899 Get phoReportColumns to hoReportColumns
3900 Get ComColumns to vComObject
3901 Set pvComObject of hoReportColumns to vComObject
3902
3903 // Navigator:
3904 Get phoReportNavigator to hoObject
3905 Get ComNavigator to vComObject
3906 Set pvComObject of hoObject to vComObject
3907
3908 // Paint Manager:
3909 Get phoReportPaintManager to hoPaintManager
3910 Get ComPaintManager to vComObject
3911 Set pvComObject of hoPaintManager to vComObject
3912
3913 // Report Records:
3914 Get phoReportRecords to hoReportRecords
3915 Get ComRecords to vComObject
3916 Set pvComObject of hoReportRecords to vComObject
3917
3918 // Report Rows:
3919 Get phoReportRows to hoReportRows
3920 Get ComRows to vComObject
3921 Set pvComObject of hoReportRows to vComObject
3922
3923 // Image Manager:
3924 Get phoImageManagerIcons to hoObject
3925 Get ComIcons to vComObject
3926 Set pvComObject of hoObject to vComObject
3927
3928 // Tooltip context:
3929 Get phoToolTipContext to hoToolTipContext
3930 Get ComToolTipContext to vComObject
3931 Set pvComObject of hoToolTipContext to vComObject
3932
3933 // Set COM object property values
3934 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3935 Get private_pbFocusSubItems to bValue
3936 Set ComFocusSubItems to bValue // Turns on event firing for change current cell
3937
3938 Get private_pbEditOnKeyNavigation to bValue
3939 Set ComTrapTabKey to (not(bValue)) // Tab/shift tab key goes into edit mode
3940
3941 Set ComAllowColumnSort to False // We don't support column sorting in virtual grids
3942
3943 Get private_pbAllowColumnRemove to bValue
3944 Set ComAllowColumnRemove to bValue
3945
3946 Get private_pbAllowColumnReorder to bValue
3947 Set ComAllowColumnReorder to bValue
3948
3949 Get private_pbAllowColumnResize to bValue
3950 Set ComAllowColumnResize to bValue
3951
3952 Get private_pbAllowEdit to bValue
3953 Set ComAllowEdit to bValue
3954
3955 Get private_pbAutoColumnSizing to bValue
3956 Set ComAutoColumnSizing to bValue
3957
3958 Get private_pbEditOnClick to bValue
3959 Set ComEditOnClick to bValue
3960
3961 Get private_Enabled_State to bValue
3962 Set ComEnabled to bValue
3963
3964 Get private_pbFullColumnScrolling to bValue
3965 Set ComFullColumnScrolling to bValue
3966
3967 Get private_pbInitialSelectionEnable to bValue
3968 Set ComInitialSelectionEnable to bValue
3969
3970 Get private_pbMultipleSelection to bValue
3971 Set ComMultipleSelection to bValue
3972
3973 Get private_pbMultiSelectionMode to bValue
3974 Set ComMultiSelectionMode to bValue
3975
3976 Get private_pbSelectionEnable to bValue
3977 Set ComSelectionEnable to bValue
3978
3979 Get private_pbShowFooter to bValue
3980 Set ComShowFooter to bValue
3981
3982 Get private_pbShowHeader to bValue
3983 Set ComShowHeader to bValue
3984
3985 Get private_pbShowRowFocus to bValue
3986 Set ComShowRowFocus to bValue
3987
3988 Get private_peBorderStyle to iValue
3989 Set ComBorderStyle to iValue
3990
3991 Get private_peWatermarkAlignment to iValue
3992 Set ComWatermarkAlignment to iValue
3993
3994 Get private_piHScrollStep to iValue
3995 Set ComHScrollStep to iValue
3996
3997 Get private_Color to iValue
3998 If (iValue <> clNone) Begin
3999 Set Color to iValue
4000 End
4001
4002 Get private_TextColor to iValue
4003 If (iValue <> clNone) Begin
4004 Set TextColor to iValue
4005 End
4006
4007 Get private_piShadeSortColor to iValue
4008 If (iValue <> clNone) Begin
4009 Set piShadeSortColor to iValue
4010 End
4011
4012 Get private_pbShadeSortColumn to bValue
4013 Set ComShadeSortColumn of hoPaintManager to bValue
4014
4015 Get private_peDrawSortTriangleStyle to iValue
4016 Set ComDrawSortTriangleStyle of hoPaintManager to iValue
4017
4018 Get ComAlternativeBackgroundColor of hoPaintManager to iValue
4019 Set piDefaultAlternateRowBackColor to iValue // Store the COM control's default color (this is a workaround as -1 does not work as usual with this property).
4020
4021 Get private_piAlternateRowBackgroundColor to iValue
4022 If (iValue <> clNone) Begin
4023 Set piAlternateRowBackgroundColor to iValue
4024 End
4025
4026 Get private_piCaptionBackColor to iValue
4027 If (iValue <> clNone) Begin
4028 Set piCaptionBackColor to iValue
4029 End
4030
4031 Get private_piCaptionBackGradientColorDark to iValue
4032 If (iValue <> clNone) Begin
4033 Set piCaptionBackGradientColorDark to iValue
4034 End
4035
4036 Get private_piCaptionBackGradientColorLight to iValue
4037 If (iValue <> clNone) Begin
4038 Set piCaptionBackGradientColorLight to iValue
4039 End
4040
4041 Get private_piCaptionForeColor to iValue
4042 If (iValue <> clNone) Begin
4043 Set piCaptionForeColor to iValue
4044 End
4045
4046 Get private_piColumnHotGradientColorDark to iValue
4047 If (iValue <> clNone) Begin
4048 Set piColumnHotGradientColorDark to iValue
4049 End
4050
4051 Get private_piColumnHotGradientColorLight to iValue
4052 If (iValue <> clNone) Begin
4053 Set piColumnHotGradientColorLight to iValue
4054 End
4055
4056 Get private_piColumnPushedGradientColorDark to iValue
4057 If (iValue <> clNone) Begin
4058 Set piColumnPushedGradientColorDark to iValue
4059 End
4060
4061 Get private_piColumnPushedGradientColorLight to iValue
4062 If (iValue <> clNone) Begin
4063 Set piColumnPushedGradientColorLight to iValue
4064 End
4065
4066 // Set the height (in text lines) of the header section.
4067 // See also cCJGridColumn.pbMultiline
4068 Get private_piHeaderHeightMultiplier to iValue
4069
4070 If (iValue > 0) Begin
4071 Get ComHeaderHeightFormula of hoPaintManager to vFormula
4072 Get Create (RefClass(cCJFormulaMulDivC)) to hoFormula
4073 Set pvComObject of hoFormula to vFormula
4074 Set ComMultiplier of hoFormula to iValue
4075 Set ComDivisor of hoFormula to 1
4076 Send ComRefreshMetrics of hoPaintManager
4077 Send Destroy of hoFormula
4078 End
4079
4080 Get private_piFreezeColsDividerColor to iValue
4081 If (iValue <> clNone) Begin
4082 Set piFreezeColsDividerColor to iValue
4083 End
4084
4085 Get private_piGridLineColor to iValue
4086 If (iValue <> clNone) Begin
4087 Set piGridLineColor to iValue
4088 End
4089
4090 Get private_piHighlightBackColor to iValue
4091 If (iValue <> clNone) Begin
4092 Set piHighlightBackColor to iValue
4093 End
4094
4095 Get private_piHighlightForeColor to iValue
4096 If (iValue <> clNone) Begin
4097 Set piHighlightForeColor to iValue
4098 End
4099
4100 Get private_piSelectedRowBackColor to iValue
4101 If (iValue = clNone) Begin
4102 // Make the default 'Selected' row default colors the same as the default 'Highlighted' row colors
4103 // we set the COM color directly so that the private value of clNone remains unchanged.
4104 Get ComHighlightBackColor of hoPaintManager to iValue
4105 Set ComSelectedRowBackColor of hoPaintManager to iValue
4106 End
4107 Else Begin
4108 Set piSelectedRowBackColor to iValue
4109 End
4110
4111 Get private_piSelectedRowForeColor to iValue
4112 If (iValue = clNone) Begin
4113 // Make the default 'Selected' row default colors the same as the default 'Highlighted' row colors
4114 // we set the COM color directly so that the private value of clNone remains unchanged.
4115 Get ComHighlightForeColor of hoPaintManager to iValue
4116 Set ComSelectedRowForeColor of hoPaintManager to iValue
4117 End
4118 Else Begin
4119 Set piSelectedRowForeColor to iValue
4120 End
4121
4122 Get private_piHotDividerColor to iValue
4123 If (iValue <> clNone) Begin
4124 Set piHotDividerColor to iValue
4125 End
4126
4127 Get psWatermark to sValue
4128 If (Trim(sValue) <> "") Begin
4129 Get piWatermarkTransparency to iValue
4130 If (iValue < 0) Begin
4131 Move "1" to iValue
4132 End
4133 Send SetWatermark sValue iValue
4134 End
4135
4136 Get private_pbDrawGridForEmptySpace to bValue
4137 Set ComDrawGridForEmptySpace of hoPaintManager to bValue
4138
4139 Get private_pbFixedInplaceButtonHeight to bValue
4140 Set ComFixedInplaceButtonHeight of hoPaintManager to bValue
4141
4142 Get private_pbGrayIfDisable to bValue
4143 Set ComGrayIfDisable of hoPaintManager to bValue
4144
4145 Get private_pbHideSelection to bValue
4146 Set ComHideSelection of hoPaintManager to bValue
4147
4148 Get private_pbHotTracking to bValue
4149 Set ComHotTracking of hoPaintManager to bValue
4150
4151 Get private_pbShowNonActiveInPlaceButton to bValue
4152 Set ComShowNonActiveInPlaceButton of hoPaintManager to bValue
4153
4154 Get private_pbUseAlternateRowBackgroundColor to bValue
4155 Set ComUseAlternativeBackground of hoPaintManager to bValue
4156
4157 Get private_pbUseColumnTextAlignment to bValue //JVH
4158 Set ComUseColumnTextAlignment of hoPaintManager to bValue
4159
4160 Get private_pbUseEditTextAlignment to bValue
4161 Set ComUseEditTextAlignment of hoPaintManager to bValue
4162
4163 Get private_peColumnStyle to iValue
4164 Set ComColumnStyle of hoPaintManager to iValue
4165
4166 Get private_peFreezeColsDividerStyle to iValue
4167 Set ComFreezeColsDividerStyle of hoPaintManager to iValue
4168
4169 Get private_peHorizontalGridStyle to iValue
4170 Set ComHorizontalGridStyle of hoPaintManager to iValue
4171
4172 Get private_peVerticalGridStyle to iValue
4173 Set ComVerticalGridStyle of hoPaintManager to iValue
4174
4175 Get private_psNoFieldsAvailableText to sValue
4176 Set ComNoFieldsAvailableText of hoPaintManager to sValue
4177
4178 Get private_psNoItemsText to sValue
4179 Set ComNoItemsText of hoPaintManager to sValue
4180
4181 // Apply tooltip style properties
4182 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4183 Get piTooltipMarginTop to iTop
4184 Get piTooltipMarginLeft to iLeft
4185 Get piTooltipMarginBottom to iBottom
4186 Get piTooltipMarginRight to iRight
4187
4188 If (iTop <> -1) Begin
4189 Send ComSetMargin to hoToolTipContext iLeft iTop iRight iBottom
4190 End
4191
4192 Get private_piTooltipMaxWidth to iValue
4193 If (iValue <> -1) Begin
4194 Set ComMaxTipWidth of hoToolTipContext to iValue
4195 End
4196
4197 Get private_piTooltipBkColor to iValue
4198 If (iValue <> clNone) Begin
4199 Set piTooltipBkColor of hoToolTipContext to iValue
4200 End
4201
4202 Get private_piTooltipTextColor to iValue
4203 If (iValue <> clNone) Begin
4204 Set piTooltipTextColor of hoToolTipContext to iValue
4205 End
4206
4207 Get private_peTooltipStyle to iValue
4208 Set ComStyle of hoToolTipContext to iValue
4209
4210 Send OnCreateGridControl
4211 Send CreateColumns
4212
4213 // These Grid properties must be set after CreateColumns...
4214 Get private_piFreezeColumnsCount to iValue
4215 Set ComFreezeColumnsCount to iValue
4216
4217 // take a snapshot of the orignal object defined settings. This is done on the first activation of the grid
4218 // and can be used to restore the original layout
4219 Get psOriginalLayout to sSettings
4220 If (sSettings="") Begin
4221 Send StoreOriginalLayout
4222 End
4223
4224 Send LoadEnvironment // load layout if needed
4225
4226 Get phoIdleHandler to hoIdle
4227 Set pbEnabled of hoIdle to True
4228 End_Procedure
4229
4230 // Standard SaveEnvironment Behavior. This is called when the grid is deactivated.
4231 // This is good for augmentation if you wish to change the standard save
4232 Procedure SaveEnvironment
4233 String sKey sSection sSettings
4234 Boolean bPreserveEnvironment bRestore
4235
4236 // always save the instance settings. If the grid is reactivated it uses this. These are lost when
4237 // the app is closed
4238 Get CurrentLayoutAsXML to sSettings
4239 Set psInstanceLayout to sSettings
4240
4241 // see if we should do a permanent save. It will Save environment If:
4242 // 1) application Object exists and pbPreserveEnvironment is true
4243 // 2) pbRestoreLayout is True
4244 If (ghoApplication=0) Begin
4245 Procedure_Return
4246 End
4247 Get pbPreserveEnvironment of ghoApplication to bPreserveEnvironment
4248 If bPreserveEnvironment Begin
4249 Get pbRestoreLayout to bRestore
4250 If bRestore Begin
4251 Get psLayoutSection to sSection
4252 If (sSection="") Begin
4253 Error DFERR_PROGRAM ("Cannot Save grid settings for grid. The psLaySection property is blank. Object=" * Name(Self))
4254 Procedure_Return
4255 End
4256 Get RegistryKeyString of ghoApplication to sKey
4257 Move (sKey - "\Grid") to sKey
4258 Send SaveGridLayoutToRegistry sKey
4259 End
4260 End
4261 End_Procedure
4262
4263 // Standard LoadEnvironment Behavior.
4264 // This is good for augmentation if you wish to change the standard load.
4265 Procedure LoadEnvironment
4266 String sKey sSection sSettings
4267 Boolean bOk bPreserveEnvironment bRestore
4268
4269 // if a layout exists, it means this was deactivated but we have info about the instance. Restore from that.
4270 Get psInstanceLayout to sSettings
4271 If (sSettings<>"") Begin
4272 Send RestoreLayoutFromXMLString sSettings
4273 Procedure_Return
4274 End
4275
4276 // See if we should so a new instance restores. It will load environment If:
4277 // 1) application Object exists and pbPreserveEnvironment is true
4278 // 2) pbRestoreLayout is True
4279 If (ghoApplication=0) Begin
4280 Procedure_Return
4281 End
4282 Get pbPreserveEnvironment of ghoApplication to bPreserveEnvironment
4283 If bPreserveEnvironment Begin
4284 Get pbRestoreLayout to bRestore
4285 If bRestore Begin
4286 Get psLayoutSection to sSection
4287 If (sSection="") Begin
4288 Error DFERR_PROGRAM ("Cannot Load grid settings for grid. The psLaySection property is blank. Object=" * Name(Self))
4289 Procedure_Return
4290 End
4291 Get RegistryKeyString of ghoApplication to sKey
4292 Move (sKey - "\Grid") to sKey
4293 Get LoadGridLayoutFromRegistry sKey to bOk
4294 End
4295 End
4296 End_Procedure
4297
4298 // restores the gird layout with the original object created layout.
4299 // It is an error to call this when the grid is not activated.
4300 Procedure RestoreLayout
4301 String sSettings
4302 Integer iSort iTop
4303 Get psOriginalLayout to sSettings
4304 If (sSettings<>"") Begin
4305 // LoadSettings will reset the COM row to 0. We must restore it without changing anything.
4306 Get ComTopRowIndex to iTop
4307 Send RestoreLayoutFromXMLString sSettings
4308 Send SynchronizeGridtoSelectedRow iTop // restore row back to where it was
4309 Get piSortColumn to iSort
4310 Set piSortColumn to iSort
4311 End
4312 End_Procedure
4313
4314 // Stores the current state as the original layout
4315 Procedure StoreOriginalLayout
4316 String sSettings
4317 Get CurrentLayoutAsXML to sSettings
4318 Set psOriginalLayout to sSettings
4319 End_Procedure
4320
4321 // return the current layout as an xml document. We use this instead of ComLoadSettings & ComSaveSettings
4322 // because those interfaces don't work as well. When two columns have the same name, it messes things up.
4323 { Visibility=Private }
4324 Function CurrentLayoutAsXML Returns String
4325 Handle hoExchange hoExchangePref
4326 Boolean bOk
4327 String sSection sName sXmlLayout
4328 Variant vSection
4329
4330 Move "grid" to sName // these two values must be the same in CurrentLayoutAsXml
4331 Move "temp" to sSection // and RestoreLayoutFromXMLString
4332 Get CreatePropExchangeObject to hoExchange
4333 Get Create (RefClass(cCJPropExchange)) to hoExchangePref
4334 Get ComCreateAsXML of hoExchange False sName to bOk
4335 Get ComGetSection of hoExchange sSection to vSection
4336 Set pvComObject of hoExchangePref to vSection
4337 Send ComDoPropExchange vSection
4338 Get ComValue of hoExchange to sXmlLayout
4339 Send Destroy of hoExchangePref
4340 Send Destroy of hoExchange
4341 Function_Return sXmlLayout
4342 End_Procedure
4343
4344 // restore the grid based on the passed xml layout string.
4345 { Visibility=Private }
4346 Procedure RestoreLayoutFromXMLString String sXmlLayout
4347 Handle hoExchange hoExchangePref
4348 Boolean bOk
4349 String sSection sName
4350 Variant vSection
4351
4352 Move "grid" to sName // these two values must be the same in CurrentLayoutAsXml
4353 Move "temp" to sSection // and RestoreLayoutFromXMLString
4354 Get CreatePropExchangeObject to hoExchange
4355 Get Create (RefClass(cCJPropExchange)) to hoExchangePref
4356 Get ComCreateAsXML of hoExchange True sName to bOk
4357 Set ComValue of hoExchange to sXmlLayout
4358 Get ComGetSection of hoExchange sSection to vSection
4359 Set pvComObject of hoExchangePref to vSection
4360 Send ComDoPropExchange vSection
4361 Send Destroy of hoExchangePref
4362 Send Destroy of hoExchange
4363 End_Procedure
4364
4365
4366
4367 { Visibility=Private }
4368 Procedure ReleaseComObject
4369 Handle hoDataSource hoObject hoIdle
4370 Handle[] hoColumnObjects
4371 Integer icColumn iColumn
4372
4373 Get phoIdleHandler to hoIdle
4374 Set pbEnabled of hoIdle to False
4375 Set piLastImageID to 0
4376
4377 Get phoDataSource to hoDataSource
4378
4379 Send SaveEnvironment // save layout if needed
4380 Send OnRelease
4381
4382 // send message to columns to release everything
4383 Get phoColumnObjects to hoColumnObjects
4384 Move (SizeOfArray(hoColumnObjects)) to icColumn
4385 For iColumn from 0 to (icColumn-1)
4386 Send ReleaseObject of hoColumnObjects[iColumn]
4387 Loop
4388
4389 // release all com objects
4390 Get phoReportColumns to hoObject
4391 Set pvComObject of hoObject to (NullComObject())
4392
4393 Get phoReportNavigator to hoObject
4394 Set pvComObject of hoObject to (NullComObject())
4395
4396 Get phoReportPaintManager to hoObject
4397 Set pvComObject of hoObject to (NullComObject())
4398
4399 Get phoReportRecords to hoObject
4400 Set pvComObject of hoObject to (NullComObject())
4401
4402 Get phoReportRows to hoObject
4403 Set pvComObject of hoObject to (NullComObject())
4404
4405 Get phoImageManagerIcons to hoObject
4406 Set pvComObject of hoObject to (NullComObject())
4407
4408 Get phoToolTipContext to hoObject
4409 Set pvComObject of hoObject to (NullComObject())
4410
4411 Get phoReportToolTipInfo to hoObject
4412 Set pvComObject of hoObject to (NullComObject())
4413
4414 Get phoReportColumn to hoObject
4415 Set pvComObject of hoObject to (NullComObject())
4416
4417 Get phoReportRecord to hoObject
4418 Set pvComObject of hoObject to (NullComObject())
4419
4420 Get phoReportRecordItem to hoObject
4421 Set pvComObject of hoObject to (NullComObject())
4422
4423 Get phoReportRecordItemMetrics to hoObject
4424 Set pvComObject of hoObject to (NullComObject())
4425
4426 Get phoReportRow to hoObject
4427 Set pvComObject of hoObject to (NullComObject())
4428
4429 Set private_pvSelectedFont to (NullComObject())
4430
4431 Forward Send ReleaseComObject
4432 End_Procedure
4433
4434 // does a reset. Clears data. Add columns to datasource
4435 Procedure ResetGrid
4436 Handle hoDataSource hoColumn hoColumnDataSource
4437 Handle hoPaint
4438 Integer iColumn icColumn
4439 Integer iCustomDraw
4440 Boolean bIsVirtual bUseFocusCell bFixed
4441 Get pbVirtualMode to bIsVirtual
4442 Get pbUseFocusCellRectangle to bUseFocusCell
4443 Get phoDataSource to hoDataSource
4444 Get phoReportPaintManager to hoPaint
4445
4446 Send ResetAll of hoDataSource
4447 Send NewColumn -1
4448 Get ColumnCount to icColumn
4449 For iColumn from 0 to (icColumn-1)
4450 Get ColumnObject iColumn to hoColumn
4451 Get phoDataSourceColumnClass of hoColumn to hoColumnDataSource
4452 Send AddColumn of hoDataSource hoColumnDataSource
4453 Loop
4454 Send BindDataSource
4455
4456 If bUseFocusCell Begin
4457 Move (xtpCustomDrawItem) to iCustomDraw
4458 End
4459 If bIsVirtual Begin
4460 Move (iCustomDraw ior xtpCustomBeforeDrawRow) to iCustomDraw
4461 End
4462 Send ResetVirtualMode 0
4463
4464 Get ComFixedRowHeight of hoPaint to bFixed // ComSetCustomDraw resets this to True, must be restored
4465 Send ComSetCustomDraw iCustomDraw
4466 Set ComFixedRowHeight of hoPaint to bFixed
4467
4468 Get piSortColumn to iColumn
4469 Set piSortColumn to iColumn
4470
4471 End_Procedure
4472
4473 // use this to set any special properties in the datasource that might be
4474 // needed for this particular grid and data source
4475 Procedure BindDataSource
4476 End_Procedure
4477
4478 // initializes the data
4479 Procedure InitializeData Variant[] DataSource
4480 Integer iCount
4481 Handle hoDataSource
4482
4483 // If the data has been initialized we don't know what the sort column is and we really don't know what
4484 // the sort direction, so we set them back to the default. If the developer needs to define these they
4485 // should so so after calling InitializeData
4486 Set piSortColumn to -1
4487 Set pbReverseOrdering to False
4488
4489 Get phoDataSource to hoDataSource
4490 Send InitializeDataSource of hoDataSource DataSource
4491 // After a reset and reload, selected column is -1.
4492 Send NewColumn -1
4493 Get RowCount of hoDataSource to iCount
4494 Send ResetVirtualMode iCount
4495 If (iCount) Begin
4496 Set ComTopRowIndex to 0
4497 Send MoveToRow 0
4498 End
4499 End_Procedure
4500
4501 // create a template row
4502 { Visibility=Private }
4503 Procedure CreateTemplateRow
4504 Handle hoReportRecord hoReportRecords
4505 Variant vComobject vItem
4506 Integer iColumn icColumn iRows
4507
4508 Get phoReportRecords to hoReportRecords
4509 Get Create (RefClass(cCJReportRecord)) to hoReportRecord
4510 Get ComRecord of hoReportRecords 0 to vComobject
4511 Set pvComObject of hoReportRecord to vComObject
4512 Get ColumnCount to icColumn
4513 For iColumn from 0 to (icColumn-1)
4514 Get ComAddItem of hoReportRecord "" to vItem
4515 Loop
4516 Send Destroy to hoReportRecord
4517 End_Procedure
4518
4519
4520 Procedure CreateColumns
4521 Handle hoColumn
4522 Handle[] hoColumnObjects
4523 Integer icColumn iColumn
4524 Get phoColumnObjects to hoColumnObjects
4525 Move (SizeOfArray(hoColumnObjects)) to icColumn
4526 For iColumn from 0 to (icColumn-1)
4527 // Create the column's COM object....
4528 Move hoColumnObjects[iColumn] to hoColumn
4529 Send CreateColumn of hoColumn iColumn
4530 Loop
4531 Send ResetGrid // sets up columns in datasource and resets all data
4532 End_Procedure
4533
4534 // returns object for column
4535 Function ColumnObject Integer iColumn Returns Handle
4536 Handle[] hoColumnObjects
4537 Get phoColumnObjects to hoColumnObjects
4538 Function_Return (hoColumnObjects[iColumn])
4539 End_Function
4540
4541 // returns selected column object, 0 if none
4542 Function SelectedColumnObject Returns Handle
4543 Handle hoCol
4544 Integer iCol
4545 Get SelectedColumn to iCol
4546 If (iCol<>-1) Begin
4547 Get ColumnObject iCol to hoCol
4548 End
4549 Function_Return hoCol
4550 End_Function
4551
4552 // returns number of columns
4553 Function ColumnCount Returns Integer
4554 Handle[] hoColumnObjects
4555 Get phoColumnObjects to hoColumnObjects
4556 Function_Return (SizeOfArray(hoColumnObjects))
4557 End_Function
4558
4559 Procedure Notify_Focus_Change Integer Fg
4560 Set peGridMouseStatus to gmsMouseStatusCleared
4561 Forward Send Notify_Focus_Change Fg
4562 End_Procedure
4563
4564 { Visibility=Private }
4565 Procedure Entering Returns Integer
4566 Handle hoEdit hoScope
4567 Boolean bOldVal bNeeds
4568 Set piLastKey to 0
4569 Set pbNeedPostEntering to False
4570 // if entering from the edit control, we don't do anything
4571 Get phoCustomEdit to hoEdit
4572 If hoEdit Begin
4573 Procedure_Return
4574 End
4575 Send OnEntering
4576 Get pbNeedPostEntering to bNeeds
4577 Get Scope_Focus to hoScope
4578 Set phoPriorScopeFocus to hoScope
4579 If not bNeeds Begin
4580 Send EnteringGrid
4581 End
4582 End_Procedure
4583
4584 { Visibility=Private }
4585 Procedure Set item Integer iPosition
4586 Boolean bFocusSub
4587 Get pbFocusSubItems to bFocusSub
4588 If bFocusSub Begin
4589 If iPosition Begin
4590 Send MoveToFirstEnterableColumn
4591 End
4592 Else Begin
4593 Send MoveToLastEnterableColumn
4594 End
4595 End
4596 End_Procedure
4597
4598 // This is called after a focus change is complete during the first idle event
4599 // It sends OnEntering which can be cancelled. If cancelled the prior focus object
4600 // will be activated. However, if OnEntering changed the focus, it won't do anything
4601 { Visibility=Private }
4602 Procedure PostEntering
4603 Handle hodataSource hoColumn hoEdit hoOld
4604 Boolean bCancel
4605
4606 // just in case OnIdle the focus was lost
4607 If (Focus(Self)<>Self and Focus(Self)<>phoCustomEdit(Self) and phoCustomEdit(Self)<>0) Begin
4608 Procedure_Return
4609 End
4610
4611 Get OnPostEntering to bCancel
4612
4613 If bCancel Begin
4614 Get phoPriorScopeFocus to hoOld
4615 If (Focus(Self)=Self and hoOld<>Self) Begin
4616 Send Activate of hoOld
4617 End
4618 Procedure_Return
4619 End
4620 Else Begin
4621 Send EnteringGrid
4622 End
4623 End_Procedure
4624
4625 { Visibility=Private }
4626 Procedure EnteringGrid
4627 Handle hodataSource hoColumn hoEdit hoOld
4628 Variant vVal
4629 Integer iCol iRow iRows iERow iECol
4630 Boolean bCancel bEdit bSubFocus
4631 Boolean bAutoAppend bAllowAppend bAllowInsert bReadOnly
4632
4633 Get phoDataSource to hodataSource
4634 Get SelectedRow of hodataSource to iRow
4635 Get pbFocusSubItems to bSubFocus
4636 If (iRow=-1) Begin
4637 Get pbReadOnly to bReadOnly
4638 Get pbAutoAppend to bAutoAppend
4639 Get pbAllowAppendRow to bAllowAppend
4640 Get pbAllowInsertRow to bAllowInsert
4641 Get RowCount of hodataSource to iRows
4642 If ((iRows=0) and not(bReadOnly) and (bAllowAppend or bAllowInsert) and bAutoAppend) Begin
4643 Get AddRow 0 to bCancel
4644 If not bCancel Begin
4645 Send ReSynchToDataSource
4646 Send MoveToRow 0
4647 Get SelectedRow of hodataSource to iRow
4648 End
4649 End
4650 End
4651 If (bSubFocus and (iRow<>-1)) Begin
4652 Get SelectedColumnObject to hoColumn
4653 If (hoColumn=0) Begin
4654 Get FirstEnterableColumn to hoColumn
4655 End
4656 If hoColumn Begin
4657 Send NewColumn -1 // this will force an entering message in column change
4658 Get MoveToColumnObject hoColumn to bCancel // set column focus in grid and com object
4659 End
4660 End
4661 End_Procedure
4662
4663
4664
4665
4666 // called when you are exiting object. Return true if the selected row should be
4667 // committed - either saved or cleared depending on the autosave state. We pass the
4668 // destination object so you can use this to determine where you are exiting to. Sometimes
4669 // this will influence the decision.
4670 Function ShouldCommitOnObjectExit Handle hoDestination Returns Boolean
4671 Function_Return True
4672 End_Function
4673
4674
4675 // it is important that the exiting logic is executed properly, particularly the
4676 // custom edit cancellation. For that reason developers are discouraged from augmenting
4677 // this method and OnExiting is provided instead
4678 { Visibility=Private }
4679 Procedure Exiting Handle hoDestination Returns Integer
4680 Boolean bCancel bCommit bSubFocus
4681 Handle hoEdit
4682 Integer iSelRow
4683 Handle hoDatasource
4684
4685 // if we moving to the custom edit control, we don't want to do any exiting - it's internal
4686 Get phoCustomEdit to hoEdit
4687 If ( (hoEdit<>0 and hoEdit=hoDestination)) Begin
4688 Procedure_Return False
4689 End
4690
4691 Get phoDataSource to hoDatasource
4692 Get SelectedRow of hoDatasource to iSelRow
4693 Get pbFocusSubItems to bSubFocus
4694
4695 If (iSelRow<>-1) Begin
4696
4697 Get ShouldCommitOnObjectExit hoDestination to bCommit
4698 If (bCommit and OPERATION_MODE=0) Begin
4699 Get CommitSelectedRow to bCancel
4700 If bCancel Begin
4701 Procedure_Return bCancel
4702 End
4703 End
4704 End
4705 Forward Get msg_Exiting hoDestination to bCancel
4706
4707 If not bCancel Begin
4708 Get OnExiting hoDestination to bCancel
4709 End
4710
4711 If (not(bCancel) and bSubFocus) Begin
4712 // we force an exit message but we will not change the column so that other
4713 // objects can test SelectedColumn. When we re-enter, we will force an entry message
4714 Get ForceColumnExit to bCancel
4715 End
4716
4717 Procedure_Return bCancel
4718 End_Procedure
4719
4720 { Visibility=Private }
4721 Procedure NotifyEndEdit Integer iRow Integer iColumn String sValue
4722 Handle hoColumn
4723 Boolean bChanged
4724 Get ColumnObject iColumn to hoColumn
4725 Get NotifyEndEdit of hoColumn sValue to bChanged
4726 If bChanged Begin
4727 Send ComRedraw // Redraw now
4728 End
4729 End_Procedure
4730
4731 { Visibility=Private }
4732 Procedure NotifyCustomEndEdit Integer iCol String sValue
4733 Handle hoDataSource
4734 Integer iRow
4735 Get phoDataSource to hoDataSource
4736 Get SelectedRow of hoDataSource to iRow
4737 Send NotifyEndEdit iRow iCol sValue
4738 End_Procedure
4739
4740 { Visibility=Private }
4741 Procedure NotifyItemChecked Integer iRow Integer iColumn
4742 Handle hoColumn
4743 Boolean bCancel
4744 Get ColumnObject iColumn to hoColumn
4745 Get NotifyItemChecked of hoColumn to bCancel
4746 End_Procedure
4747
4748 { Visibility=Private }
4749 Function LoadFirstOrLastRow Boolean bLast Returns Boolean
4750 Handle hoDataSource
4751 Integer iCount
4752 Boolean bDirty bCancel
4753
4754 Get phoDataSource to hoDataSource
4755
4756 Get CommitSelectedRow to bCancel
4757 If bCancel Begin
4758 Function_Return True
4759 End
4760
4761 If bLast Begin
4762 Send PageInLastRow of hoDataSource
4763 End
4764 Else Begin
4765 Send PageInFirstRow of hoDataSource
4766 End
4767
4768 Get DataSourceSynchRequired of hoDataSource to bDirty
4769 If (bDirty) Begin
4770 Get RowCount of hoDataSource to iCount
4771 Send ResetVirtualMode iCount
4772 Send ComPopulate // non virutal mode pageinXxxx make not make any sense
4773 Send SelectRow of hoDataSource -1 True
4774 Send DeferredRedraw
4775 End
4776 Function_Return False
4777 End_Function
4778
4779 // this does the mechanics of resetting info for virtual mode. Note that after
4780 // a reset, everything is cleared, Although focusRow is 0, we are setting select row as not defined
4781 { Visibility=Private }
4782 Procedure ResetVirtualMode Integer iCount
4783 Boolean bVirtualMode
4784 Get pbVirtualMode to bVirtualMode
4785 If bVirtualMode Begin
4786 Send ComSetVirtualMode iCount 0
4787 If iCount Begin
4788 Send CreateTemplateRow
4789 End
4790 End
4791 Send ComPopulate
4792 Set piLastTopRowIndex to -1
4793 Set piLastVisibleRowCount to -1
4794 End_Procedure
4795
4796
4797 // normally sent within BeforeDraw Paint event. The startrow is the top row and last row must be the
4798 // approximate last row (so we have number of rows by subtracting the two). Any special caching (and there is some)
4799 // will be handled by PageInRows in the datasource
4800 { Visibility=Private }
4801 Procedure PageData Integer iStartRow
4802 Integer iRowsToRead iLastRow
4803 Handle hoDataSource
4804 Get phoDataSource to hoDataSource
4805 Get piLastVisibleRowCount to iRowsToRead
4806 Move (iStartRow + iRowsToRead-1) to iLastRow
4807 Send PageInRows of hoDataSource (&iStartRow) (&iLastRow)
4808 End_Procedure
4809
4810
4811 // called to reset datasource rowcount/offset as needed and then
4812 // update the report control
4813
4814 { Visibility=Private }
4815 Procedure ReSynchToDataSource
4816 Integer iNewRowCount iTop iNewTop
4817 Integer iRowCount iOffsetChange
4818 Integer iIndex
4819 Integer[] SelectedRowIndexes
4820 Integer iSel iFoc iNewSel iNewFoc iSels
4821 Handle hoDataSource hoPaint hoNav
4822 Boolean bNoFocusChangeCheck bFixedHeight bIsEdit
4823
4824 Get phoDataSource to hoDataSource
4825
4826 Get RowCount of hoDataSource to iRowCount
4827
4828 Get ComTopRowIndex to iTop
4829 Get GetIndexesForSelectedRows to SelectedRowIndexes // get all selected rows
4830 Get GetFocusedRowIndex to iFoc // we use this for testing
4831
4832 Get NormalizeDataSource of hoDataSource iTop to iOffsetChange
4833
4834 Get RowCount of hoDataSource to iNewRowCount
4835
4836 // the new top row index. Make sure it is range
4837 Move (iTop + iOffsetChange) to iNewTop
4838 If (iNewTop<0) Begin
4839 Move 0 to iNewTop
4840 End
4841 Else If (iNewTop>iNewRowCount) Begin
4842 Move (iNewRowCount-1) to iNewTop
4843 End
4844
4845 Send ResetVirtualMode iNewRowCount
4846
4847 // the datasource should have handled in change in FocusRows
4848 Get SelectedRow of hoDataSource to iNewFoc
4849
4850 If (iFoc<>-1 and iNewFoc<>-1 and (iNewFoc <> (iFoc+iOffsetChange))) Begin
4851 Error DFERR_PROGRAM "Focused row out of synch"
4852 End
4853
4854 // if multi-line is supported, the COM control responds to ComMoveToRow by sending paint messages for
4855 // topItem row page and then for the actual row being moved to. This can cause the grid to go out and
4856 // peform another unneeded PageData which creates circular problems. By setting the TopItem first we
4857 // avoid this. However, TopItem must still be set after MoveToRow because MoveToRow will reset TopItem
4858 // if it is not visible.
4859 Get phoReportPaintManager to hoPaint
4860 Get ComFixedRowHeight of hoPaint to bFixedHeight
4861 If not bFixedHeight Begin
4862 If (iNewFoc<>-1) Begin // see comment below about why this is here
4863 Set ComTopRowIndex to iNewTop // this resets top row
4864 End
4865 End
4866 // move to new focus row
4867 Get IsEditMode to bIsEdit
4868 Send EndEdit
4869 If (iNewFoc<>-1) Begin
4870 // we just want to do a COM move. SelectedRow should already be correct
4871 Get pbNoFocusChangeCheck to bNoFocusChangeCheck
4872 Set pbNoFocusChangeCheck to True
4873 Get phoReportNavigator to hoNav
4874 Send ComMoveToRow of hoNav iNewFoc False False
4875 Set pbNoFocusChangeCheck to bNoFocusChangeCheck
4876 End
4877 // re-set selected Rows
4878 Move (SizeOfArray(SelectedRowIndexes)) to iSels
4879 For iSel from 0 to (iSels-1)
4880 Move (SelectedRowIndexes[iSel]+iOffsetChange) to iNewSel
4881 If (iNewSel>=0 and iNewSel<iNewRowCount) Begin
4882 Send SetSelectedRow iNewSel True
4883 End
4884 Loop
4885
4886 // if there is no selectedRow we don't want to set the top-index as it will happen later
4887 // This avoids setting the index to a row that may not exist and it may avoid unneeded extra pages
4888 If (iNewFoc<>-1) Begin
4889 Set ComTopRowIndex to iNewTop // this resets top row
4890 If bIsEdit Begin
4891 Send BeginEdit
4892 End
4893 End
4894
4895 End_Procedure
4896
4897 // Removes the row, the row below becomes the selected row unless there are no
4898 // rows below and then the row above is selected.
4899 // If other rows were selected they are deselected
4900 { Visibility=Private }
4901 Procedure RemoveRowAndSelect Integer iRow
4902 Integer iIndex iSelect iNewRow
4903 Handle hoDataSource
4904 Integer iRowCount
4905 Boolean bInEdit bInRowChange bRemoveSelected bNoFocusChangeCheck
4906
4907 // we cannot remove a row while in row focus changing
4908 Get pbInRowFocusChanging to bInRowChange
4909 If bInRowChange Begin
4910 Set piDeferredRemoveRow to iRow
4911 Procedure_Return
4912 End
4913
4914 Get phoDataSource to hoDataSource
4915 Get SelectedRow of hoDataSource to iSelect
4916 If (iRow<>-1) Begin
4917 Get IsEditMode to bInEdit
4918 Send EndEdit
4919
4920 Move (iSelect=iRow) to bRemoveSelected
4921 Get RowCount of hoDataSource to iRowCount
4922 Send RemoveRow of hoDataSource iRow
4923 Send PageData iIndex
4924 If (iSelect<>-1) Begin
4925 Decrement iRowCount
4926 If (iSelect>iRow or iSelect=iRowCount) Begin
4927 // we must decrement the selected row if the row removed is above us
4928 // or if it is the last raw and was selected.
4929 Decrement iSelect
4930 End
4931 If (iSelect>=0) Begin
4932 If (bRemoveSelected) Begin
4933 // if selectedRow was removed, move to the new selectedRow. Even if same row position
4934 Send MoveToRow iSelect
4935 End
4936 Else Begin
4937 // if the removed row was not selectedRow, there is not a real row change. We just need
4938 // to set SelectRow. We do need to make sure that the COM object is synchronized with
4939 // the datasource, which MoveToRow will do as a non-navigation focus change event.
4940 Send SelectRow of hoDataSource iSelect False
4941 Get pbNoFocusChangeCheck to bNoFocusChangeCheck
4942 Set pbNoFocusChangeCheck to True
4943 Send MoveToRow iSelect
4944 Set pbNoFocusChangeCheck to bNoFocusChangeCheck
4945 End
4946 End
4947 End
4948
4949 Send ReSynchToDataSource
4950 If (bInEdit and iRow>=0) Begin
4951 Send BeginEdit
4952 End
4953 End
4954 End_Procedure
4955
4956 // Move to a row.
4957 Procedure MoveToRow Integer iIndex
4958 Handle hoNav hoDataSource
4959 Variant vNav
4960 Integer iCurrent iSel iSelCol
4961 Boolean bInEdit bEdit bNoFocusChangeCheck bCancel
4962
4963 Get pbNoFocusChangeCheck to bNoFocusChangeCheck
4964
4965 Get IsEditMode to bInEdit
4966 Send EndEdit
4967
4968 Get phoReportNavigator to hoNav
4969 Get ComNavigator to vNav
4970 Set pvComObject of honav to vNav
4971
4972 Get GetFocusedRowIndex to iCurrent
4973 Send ComMoveToRow of hoNav iIndex False False
4974 // if there is no COM move needed the focus row change event is not sent. We want to
4975 // force this to be sent. If bNoFocusChangeCheck is set, it means that selectedrow is
4976 // already correct and there is no need to do this synchronization (because the row was ok)
4977 If (not(bNoFocusChangeCheck) and (iIndex=iCurrent)) Begin
4978 Get phoDataSource to hoDataSource
4979 Get SelectedRow of hoDataSource to iSel
4980 // if selectedrow needs to change we should do a RowChange event which
4981 // does exiting, entering, etc.
4982 If (iSel<>iIndex) Begin
4983 // RowChange always sets the SelectedColumn to -1 which we must then set to the actual column (which is what FocusChanging does).
4984 // Use the private property here, because a curent SelectedRow of -1, will make SelectedColumn return -1
4985 Get piSelectedColumn to iSelCol
4986 Get RowChange iIndex to bCancel
4987 If (not(bCancel) and (iSelCol<>-1)) Begin
4988 Get ColumnChange iSelCol to bCancel
4989 End
4990 End
4991 // if the selectedrow is unchanged we will just make sure the DD is up to date. This means that
4992 // moving to the row you are already in, refreshes the row from the external source (DD)
4993 Else Begin
4994 Send SelectRow of hoDataSource iIndex True
4995 End
4996 End
4997
4998 Send ResetEditMode bInEdit
4999 End_Procedure
5000
5001 // Move to last row and select. This is the last row of data, which may not
5002 // be the last row of the current datasource. Can be used to refresh the grid
5003 // around the last record
5004 Procedure MovetoLastRow
5005 Integer iRowCount
5006 Handle hoDataSource
5007 Boolean bCancel bInEdit
5008 Get IsEditMode to bInEdit
5009 Send EndEdit
5010 Send LockBeginEdit
5011 Get phoDataSource to hoDataSource
5012 Get LoadFirstOrLastRow True to bCancel
5013 If not bCancel Begin
5014 Get RowCount of hoDataSource to iRowCount
5015 Send MoveToRow (iRowCount-1) True
5016 End
5017 Send UnlockBeginEdit
5018 Send ResetEditMode bInEdit
5019 End_Procedure
5020
5021 // Move to first row and select. This is the last row of data, which may not
5022 // be the first row of the current datasource. Can be used to refresh the grid
5023 // around the first record
5024 Procedure MovetoFirstRow
5025 Boolean bCancel bInEdit
5026
5027 Get IsEditMode to bInEdit
5028 Send EndEdit
5029 Send LockBeginEdit
5030 Get LoadFirstOrLastRow False to bCancel
5031 If not bCancel Begin
5032 Send MoveToRow 0 True
5033 End
5034 Send UnlockBeginEdit
5035 Send ResetEditMode bInEdit
5036 End_Procedure
5037
5038 // MoveToColumnObject
5039
5040 // Move to the column and set SelectedColumn.
5041 Function MoveToColumnObject Handle hoCol Returns Boolean
5042 Handle hoNav hoDataSource hoOldCol
5043 Variant vNav
5044 Integer iItemCol iDispayCol iFocusedItemIndex iRows
5045 Boolean bCancel bInfocusChange bFocusable bSubFocus
5046 Boolean bInEdit
5047
5048 Get phoDataSource to hoDataSource
5049 // don't allow if the column focus is not support or the column is not focusable or no rows
5050 Get pbFocusSubItems to bSubFocus
5051 Get IsColumnFocusable of hoCol to bFocusable
5052 Get RowCount of hoDataSource to iRows
5053 If (not(bSubFocus) or not(bFocusable) or iRows=0) Begin
5054 Function_Return True
5055 End
5056
5057 Get pbInRowFocusChanging to bInfocusChange
5058 If bInfocusChange Begin
5059 Set phoDeferredFocusColumn to hoCol
5060 Function_Return False
5061 End
5062
5063 Get IsEditMode to bInEdit
5064 Send EndEdit
5065 Get ColumnDisplayIndex of hoCol to iDispayCol // display order index of target column
5066 Get piColumnId of hoCol to iItemCol // column creation/datasource index
5067 Get GetFocusedColumnIndex to iFocusedItemIndex // this is column creation order index of current column
5068
5069 Get phoReportNavigator to hoNav
5070 Get ComNavigator to vNav
5071 Set pvComObject of hoNav to vNav
5072 Send ComMoveToColumn of hoNav iDispayCol False // COM message uses display item
5073 // if there is no column from the control's point of view, ComMoveToColumn does not fire a focuschanging event which means
5074 // that the coluumn change event is not fired. We must do this here.
5075 If (iItemCol=iFocusedItemIndex) Begin
5076 Get ColumnChange iItemCol to bCancel // columnChange uses the ItemIndex order, not display order
5077 End
5078 Send ResetEditMode bInEdit
5079 Function_Return False
5080 End_Function
5081
5082
5083 // returns the first enterable column object, 0 if none
5084 Function FirstEnterableColumn Returns Handle
5085 Handle[] hoCols
5086 Handle hoCol
5087 Integer iCol iCols
5088 Boolean bOk bWrap
5089 Get ColumnObjectsInDisplayOrder to hoCols
5090 Move (SizeOfArray(hoCols)) to iCols
5091 If (iCols) Begin
5092 Move hoCols[0] to hoCol
5093 Get CanNavigateIntoColumn of hoCol True to bOk
5094 If (not(bOk)) Begin
5095 Get NextColumn of hoCol (&hoCol) (bWrap) to bOk
5096 End
5097 End
5098 Function_Return (If(bOk,hoCol,0))
5099 End_Function
5100
5101 // returns the last enterable column object, 0 if none
5102 Function LastEnterableColumn Returns Handle
5103 Handle[] hoCols
5104 Handle hoCol
5105 Integer iCol iCols
5106 Boolean bOk bWrap
5107 Get ColumnObjectsInDisplayOrder to hoCols
5108 Move (SizeOfArray(hoCols)) to iCols
5109 If (iCols) Begin
5110 Move hoCols[iCols-1] to hoCol
5111 Get CanNavigateIntoColumn of hoCol False to bOk
5112 If (not(bOk)) Begin
5113 Get PreviousColumn of hoCol (&hoCol) (bWrap) to bOk
5114 End
5115 End
5116 Function_Return (If(bOk,hoCol,0))
5117 End_Function
5118
5119 // move to first enterable column
5120 Procedure MoveToFirstEnterableColumn
5121 Handle hoCol
5122 Boolean bOk
5123 Get FirstEnterableColumn to hoCol
5124 If hoCol Begin
5125 Get MoveToColumnObject hoCol to bOk
5126 End
5127 End_Procedure
5128
5129 // move to last enterable column
5130 Procedure MoveToLastEnterableColumn
5131 Handle hoCol
5132 Boolean bOk
5133 Get LastEnterableColumn to hoCol
5134 If hoCol Begin
5135 Get MoveToColumnObject hoCol to bOk
5136 End
5137 End_Procedure
5138
5139
5140 // returns the current value from the active edit control
5141 { Visibility=Private }
5142 Function EditValue Returns String
5143 Boolean bEditMode
5144 Integer iLen
5145 String sValue
5146 Handle hWnd hoEdit hoColumn
5147 Get IsEditMode to bEditMode
5148 If bEditMode Begin
5149 Get IsCustomEditMode to bEditMode
5150 If bEditMode Begin
5151 Get phoCustomEdit to hoEdit
5152 Get Value of hoEdit to sValue
5153 End
5154 Else Begin
5155 Get ComInplaceEditHwnd to hWnd
5156
5157 If (not(hWnd)) Begin
5158 Error DFERR_PROGRAM "EditValue has no edit handle"
5159 Function_Return
5160 End
5161
5162 Move (SendMessage(hWnd,WM_GETTEXTLENGTH,0,0)) to iLen
5163 Move (Repeat(Character(0),iLen+1)) to sValue
5164 Move (SendMessage(hWnd,WM_GETTEXT,iLen+1,AddressOf(sValue))) to iLen
5165 Move (ToOEM(sValue)) to sValue
5166 End
5167 Get SelectedColumnObject to hoColumn
5168 Get FormatEditedValue of hoColumn sValue to sValue
5169 End
5170 Function_Return sValue
5171 End_Function
5172
5173 // returns true if VDF edit control is active
5174 Function IsCustomEditMode Returns Boolean
5175 Handle hoEdit hwHnd
5176 Boolean bEdit
5177 If (IsComObjectCreated(Self)) Begin
5178 Get phoCustomEdit to hoEdit
5179 If (hoEdit) Begin
5180 Get Form_Window_Handle of hoEdit 0 to hwHnd
5181 Move (hwHnd) to bEdit
5182 End
5183 End
5184 Function_Return bEdit
5185 End_Function
5186
5187 // returns true if built-in or VDF edit control is active
5188 Function IsEditMode Returns Boolean
5189 Boolean bEdit
5190 If (IsComObjectCreated(Self)) Begin
5191 Get ComEditMode to bEdit
5192 If not bEdit Begin
5193 Get IsCustomEditMode to bEdit
5194 End
5195 End
5196 Function_Return bEdit
5197 End_Function
5198
5199 // ends edit mode. If not in edit mode, does nothing
5200 Procedure EndEdit
5201 Handle hwHnd hoEdit hoFocus
5202 Boolean bInEdit
5203 Integer iVal
5204 Get IsEditMode to bInEdit
5205 If bInEdit Begin
5206 Get IsCustomEditMode to bInEdit
5207 If bInEdit Begin
5208 Get phoCustomEdit to hoEdit
5209 Get Focus to hoFocus
5210 If (hoEdit=hoFocus) Begin
5211 Send Activate
5212 End
5213 Else Begin
5214 Send Deactivate of hoEdit
5215 End
5216 End
5217 Else Begin
5218 Get Window_Handle to hwHnd
5219 Move (SetFocus(hwHnd)) to iVal
5220 End
5221 End
5222 End_Procedure
5223
5224 Procedure LockBeginEdit
5225 Set piBeginEditLockCount to (piBeginEditLockCount(Self)+1)
5226 End_Procedure
5227
5228 Procedure UnlockBeginEdit
5229 Set piBeginEditLockCount to ((piBeginEditLockCount(Self)-1) max 0)
5230 End_Procedure
5231
5232 Function IsBeginEditLocked Returns Boolean
5233 Integer iLocked
5234 Get piBeginEditLockCount to iLocked
5235 Function_Return (iLocked<>0)
5236 End_Procedure
5237
5238
5239 // starts edit mode if not already in edit mode
5240 Procedure BeginEdit
5241 Boolean bInEdit bLock
5242 Handle hoDataSource hoNavigator hoCol
5243 Integer iRow iCol
5244 Set piLastKey to 0
5245
5246 Get IsBeginEditLocked to bLock
5247 If bLock Begin
5248 Procedure_Return
5249 End
5250 Get phoDeferredFocusColumn to hoCol
5251 If hoCol Begin
5252 Procedure_Return
5253 End
5254
5255 Get IsEditMode to bInEdit
5256 Get phoDataSource to hoDataSource
5257 Get SelectedRow of hoDataSource to iRow
5258 Get SelectedColumn to iCol
5259 If (not(bInEdit) and (iRow<>-1 and iCol<>-1)) Begin
5260 If (Focus(Self)<>Self) Begin
5261 Procedure_Return // should not happen. Good for breakpoint test
5262 End
5263 Get phoReportNavigator to hoNavigator
5264 Send ComBeginEdit to hoNavigator
5265 End
5266 End_Procedure
5267
5268 // Sent to commit the value in an edit control without
5269 // needing to close the edit
5270 Procedure CommitFocusField
5271 Handle hoCol
5272 Boolean bEdit
5273 Integer iCurrentEdit
5274 Get IsEditMode to bEdit
5275 If bEdit Begin
5276 Get piCurrentEditColumn to iCurrentEdit
5277 Get ColumnObject iCurrentEdit to hoCol
5278 If (hoCol=0) Begin
5279 Error DFERR_PROGRAM "no selected column in CommitFocusField"
5280 Procedure_Return
5281 End
5282 Send UpdateFocusFieldValue of hoCol
5283 End
5284 End_Procedure
5285
5286 // sets the selected row in report control. note this is all COM
5287 // and the selected rows do not interact with the datasource
5288 Procedure SetSelectedRow Integer iIndex Boolean bSet
5289 Handle hoRows hoRow
5290 Variant vRow vRows
5291 Get phoReportRow to hoRow
5292 Get phoReportRows to hoRows
5293 Get ComRows to vRows
5294 Set pvComObject of hoRows to vRows
5295 Get ComRow of hoRows iIndex to vRow
5296 Set pvComObject of hoRow to vRow
5297 Set ComSelected of hoRow to bSet
5298 End_Procedure
5299
5300 // clear or set all rows selection
5301 Procedure SetSelectedRowsAll Boolean bSet
5302 Integer iCount iSels iSel
5303 Handle hoDataSource
5304 Get phoDataSource to hoDataSource
5305 Get RowCount of hoDataSource to iCount
5306 For iSel from 0 to (iCount-1)
5307 Send SetSelectedRow iSel bSet
5308 Loop
5309 End_Procedure
5310
5311 // Get array of selected rows. This is not to be confused with
5312 // with the Grid's SelectedRow. These are rows that are selected
5313 Procedure SetIndexesForSelectedRows Integer[] SelectedRowIndexes
5314 Integer iCount iSels iSel
5315 Handle hoDataSource
5316 Get phoDataSource to hoDataSource
5317 Get RowCount of hoDataSource to iCount
5318 // re-set selected Rows
5319 Move (SizeOfArray(SelectedRowIndexes)) to iSels
5320 For iSel from 0 to (iSels-1)
5321 If (SelectedRowIndexes[iSel]<iCount) Begin
5322 Send SetSelectedRow SelectedRowIndexes[iSel] True
5323 End
5324 Loop
5325 End_Procedure
5326
5327 // Get array of selected rows. This is not to be confused with
5328 // with the Grid's SelectedRow. These are rows that are selected
5329 Function GetIndexesForSelectedRows Returns Integer[]
5330 Integer iCount i
5331 Integer[] iIndexes
5332 Handle hoRows hoRow
5333 Variant vRow vRows
5334 Get phoReportRows to hoRows
5335 Get phoReportRow to hoRow
5336 Get ComSelectedRows to vRows
5337 Set pvComObject of hoRows to vRows
5338 Get ComCount of hoRows to iCount
5339 For i from 0 to (iCount-1)
5340 Get ComRow of hoRows i to vRow
5341 Set pvComObject of hoRow to vRow
5342 Get ComIndex of hoRow to iIndexes[i]
5343 Loop
5344 Function_Return iIndexes
5345 End_Function
5346
5347 // Get number of selected rows. Normally not needed as GetIndexesForSelectedRows
5348 // has the same info.
5349 Function GetSelectedRowsCount Returns Integer
5350 Integer iCount
5351 Handle hoRows
5352 Variant vRows
5353 Get phoReportRows to hoRows
5354 Get ComSelectedRows to vRows
5355 Set pvComObject of hoRows to vRows
5356 Get ComCount of hoRows to iCount
5357 Function_Return iCount
5358 End_Function
5359
5360// // Sets focused row but does not adjust datasource. Use with care!
5361// Procedure SetFocusedRow Integer iIndex
5362// Variant vRow vrows
5363// Handle horows
5364// Get phoReportRows to horows
5365// Get ComRows to vrows
5366// Set pvComObject of horows to vRows
5367// Get ComRow of horows iIndex to vRow
5368// // setting focused row changes the displayed row and sets selection
5369// Set ComFocusedRow to vRow // set focused row
5370// End_Procedure
5371
5372 // get index of focused row. Use carefully. You should use SelectedRow
5373 { Visibility=Private }
5374 Function GetFocusedRowIndex Returns Integer
5375 Integer iIndex
5376 Handle hoRow
5377 Variant vRow
5378 Get phoReportRow to hoRow
5379 Get ComFocusedRow to vRow
5380 If (IsNullComObject(vRow)) Begin
5381 Function_Return -1
5382 End
5383 Set pvComObject of hoRow to vRow
5384 Get ComIndex of hoRow to iIndex
5385 Function_Return iIndex
5386 End_Function
5387
5388 // get index of focused column. Use carefully. You should use SelectedColumn.
5389 // This returns the object item order not display order
5390 { Visibility=Private }
5391 Function GetFocusedColumnIndex Returns Integer
5392 Integer iIndex
5393 Handle hoCol
5394 Variant vCol
5395 Move -1 to iIndex
5396 Get ComFocusedColumn to vCol
5397 If (not(IsNullComObject(vCol))) Begin
5398 Get phoReportColumn to hoCol
5399 Set pvComObject of hoCol to vCol
5400 Get ComItemIndex of hoCol to iIndex
5401 End
5402 Function_Return iIndex
5403 End_Function
5404
5405 // ToggleEdit
5406
5407 // If we are editing a cell then Enter acts just like pressing Tab. If we are not editing then
5408 // Enter will put the cell into Edit mode.
5409 Procedure ToggleEdit
5410 Handle hoDataSource
5411 Integer iRow iCol
5412 Boolean bEditMode
5413
5414 Get phoDataSource to hoDataSource
5415 Get SelectedRow of hoDataSource to iRow
5416 Get SelectedColumn to iCol
5417 If (iRow<>-1 and iCol<>-1) Begin
5418 Get IsEditMode to bEditMode
5419 If bEditMode Begin
5420 Send EndEdit
5421 End
5422 Else Begin
5423 Send BeginEdit
5424 End
5425 End
5426 End_Procedure
5427
5428 // Next
5429
5430 Procedure Next
5431 Integer iSelRow iRowCount iNewSelRow
5432 Handle hoCol hoNewCol hoNextCol hoDataSource
5433 Boolean bWrap bCancel bEdit bValidate bInFocusChanging bOk bInEdit
5434 Boolean bChanged bReadOnly bAutoSaveOnRowChange bAllowInsert bAllowAppend
5435 Boolean bAutoAppend bNew bAttemptSaveAndAppend
5436
5437 Get pbInRowFocusChanging to bInFocusChanging
5438 If bInFocusChanging Begin
5439 Error DFERR_PROGRAM "Next called in focus changing"
5440 Procedure_Return
5441 End
5442
5443 Get phoDataSource to hoDataSource
5444 Get SelectedRow of hoDataSource to iSelRow // if -1, selectedColumnObject will be 0
5445 Get RowCount of hoDataSource to iRowCount
5446 Get SelectedColumnObject to hoCol
5447 If (hoCol=0) Begin
5448 Procedure_Return
5449 End
5450
5451 Get IsEditMode to bInEdit
5452 Send EndEdit
5453
5454 If (Focus(Self)<>Self) Begin
5455 Procedure_Return
5456 End
5457
5458 Send LockBeginEdit
5459
5460 Get pbValidateOnNext to bValidate
5461 If bValidate Begin
5462 Get Validating of hoCol to bCancel
5463 End
5464
5465 If (not(bCancel)) Begin
5466 Get NextColumn of hoCol (&hoNextCol) (&bWrap) to bOk
5467 Move (not(bOk)) to bCancel
5468 End
5469
5470 If (not(bCancel)) Begin
5471
5472 // if wrapping we offer the change to wrap to a different object
5473 If (bWrap) Begin
5474 Send OnWrappingRow True hoNextCol (&bWrap) (&bCancel)
5475 If (not(bCancel)) Begin
5476 Get SelectedRow of hoDataSource to iNewSelRow
5477 Get SelectedColumnObject to hoNewCol
5478 Move (iNewSelRow<>iSelRow or hoNewCol<>hoCol or Focus(Self)<>Self) to bCancel
5479 End
5480 End
5481
5482 If (not(bCancel)) Begin
5483 Get MoveToColumnObject hoNextCol to bCancel
5484 End
5485
5486 If (not(bCancel) and bWrap) Begin
5487
5488 // if we are wrapping we may want to move to the next row. This is complicated. In some
5489 // cases we will want to do an auto-insert where we save the row, insert a new row and then
5490 // move to that new row. This can be an insert or an append at the end of the grid.
5491
5492 Get ShouldSaveSelectedRow of hoDataSource to bChanged
5493 Get IsSelectedRowNew of hoDataSource to bNew
5494 Get pbAutoSave to bAutoSaveOnrowChange
5495 Get pbAutoAppend to bAutoAppend
5496 Get pbReadOnly to bReadOnly
5497 Get pbAllowInsertRow to bAllowInsert
5498 Get pbAllowAppendRow to bAllowAppend
5499
5500 // if the last row
5501 If (iSelRow=(iRowCount-1)) Begin
5502 // if we autosave and its either autoappend of a new row
5503 Move (bAllowAppend and not(bReadOnly) and bAutoSaveOnRowChange and (bAutoAppend or bNew)) to bAttemptSaveAndAppend
5504 // if no autosave and insert, we can't do a move to next row
5505 Move (not(bAttemptSaveAndAppend)) to bCancel
5506 End
5507 // if not the last row
5508 Else Begin
5509 // if it is changed, we autosave and it is new)
5510 Move (not(bReadOnly) and bChanged and bAutoSaveOnRowChange and bNew and bAllowInsert) to bAttemptSaveAndAppend
5511 End
5512
5513 // If we must save, attempt to do so and insert a new row
5514 If bAttemptSaveAndAppend Begin
5515 Get SaveSelectedRow to bCancel
5516 If not bCancel Begin
5517 Get AddRow (iSelRow+1) to bCancel
5518 If not bCancel Begin
5519 Send ReSynchToDataSource
5520 End
5521 End
5522 End
5523
5524 // if we did not cancel we want to move to the next row, which may be new or not. If this is not an
5525 // insert this move may result in an autosave. If it is an append, that autosave has already happened.
5526 If not bCancel Begin
5527 Send MoveToRow (iSelRow+1) //False
5528 End
5529
5530 End
5531 End
5532
5533 Send UnlockBeginEdit
5534 If (Focus(Self)=Self) Begin
5535 Send ResetEditMode bInEdit
5536 End
5537
5538 End_Procedure
5539
5540 Procedure Previous
5541 Integer iRow iSelRow iNewSelRow
5542 Handle hoCol hoNewCol hoNextCol hoDataSource hoExitTo
5543 Boolean bWrap bCancel bEdit bInFocusChanging bOk bInEdit
5544
5545 Get pbInRowFocusChanging to bInFocusChanging
5546 If bInFocusChanging Begin
5547 Error DFERR_PROGRAM "Previous called in focus changing"
5548 Procedure_Return
5549 End
5550
5551 Get phoDataSource to hoDataSource
5552 Get SelectedRow of hoDataSource to iSelRow
5553 Get SelectedColumnObject to hoCol
5554 If (hoCol=0) Begin
5555 Procedure_Return
5556 End
5557 Get IsEditMode to bInEdit
5558 Send EndEdit
5559
5560 If (Focus(Self)<>Self) Begin
5561 Procedure_Return
5562 End
5563
5564 Send LockBeginEdit
5565
5566 Get PreviousColumn of hoCol (&hoNextCol) (&bWrap) to bOk
5567 Move (not(bOk)) to bCancel
5568
5569 If (not(bCancel)) Begin
5570
5571 If bWrap Begin
5572 Send OnWrappingRow False hoNextCol (&bWrap) (&bCancel)
5573 If (not(bCancel)) Begin
5574 Get SelectedRow of hoDataSource to iNewSelRow
5575 Get SelectedColumnObject to hoNewCol
5576 Move (iNewSelRow<>iSelRow or hoNewCol<>hoCol or Focus(Self)<>Self) to bCancel
5577 End
5578 End
5579
5580 If (not(bCancel)) Begin
5581 Get MoveToColumnObject hoNextCol to bCancel
5582 End
5583
5584 If (not(bCancel) and bWrap and iSelRow>0) Begin
5585 Send MoveToRow (iSelRow-1)
5586 End
5587 End
5588
5589 Send UnlockBeginEdit
5590 If (Focus(Self)=Self) Begin
5591 Send ResetEditMode bInEdit
5592 End
5593 End_Procedure
5594
5595 // used by down arrow key. Does a row down with the option of
5596 // creating a new row at the bottom.
5597 Procedure MoveDownRow
5598 Handle hoDataSource
5599 Integer iSel iRows iCol
5600 Boolean bNew bAllowAppend bCancel bReadOnly bCancelCol bEdit bInEdit bDirty
5601
5602 Get phoDataSource to hoDataSource
5603 Get pbEditOnKeyNavigation to bEdit
5604 Get IsEditMode to bInEdit
5605 Send EndEdit
5606 Send LockBeginEdit
5607 Get SelectedRow of hoDataSource to iSel
5608 Get RowCount of hoDataSource to iRows
5609 If (iSel+1>=iRows) Begin
5610 // if possible for this get called when you are not really at the end of the list
5611 // If the datasource needs a refresh, don't do the auto add
5612 Get DataSourceSynchRequired of hoDataSource to bDirty
5613 If (not(bDirty)) Begin
5614 Get pbAllowAppendRow to bAllowAppend
5615 Get pbReadOnly to bReadOnly
5616 If (not(bReadOnly) and bAllowAppend) Begin
5617 Get AddRow (iSel+1) to bCancel
5618 If not bCancel Begin
5619 Send ReSynchToDataSource
5620 Send MoveToRow (iSel+1)
5621 Get SelectedColumn to iCol
5622 If (iCol=-1) Begin
5623 Send MoveToFirstEnterableColumn
5624 End
5625 Move True to bInEdit // this will force it to start in edit mode
5626 End
5627 End
5628 End
5629 End
5630 Else Begin
5631 Send MoveToRow (iSel+1)
5632 End
5633 Send UnlockBeginEdit
5634 Send ResetEditMode bInEdit
5635 End_Procedure
5636
5637 // used by up arrow key. Does a row up
5638 Procedure MoveUpRow
5639 Handle hoDataSource
5640 Integer iSel iRows iCol
5641 Boolean bNew bAllowAppend bCancel bReadOnly bCancelCol bEdit bInEdit
5642
5643 Get phoDataSource to hoDataSource
5644 Get pbEditOnKeyNavigation to bEdit
5645 Get IsEditMode to bInEdit
5646 Send EndEdit
5647 Send LockBeginEdit
5648 Get SelectedRow of hoDataSource to iSel
5649 Get RowCount of hoDataSource to iRows
5650 If (iSel>0) Begin
5651 Send MoveToRow (iSel-1)
5652 End
5653 Send UnlockBeginEdit
5654 Send ResetEditMode bInEdit
5655 End_Procedure
5656
5657 Procedure MovePageDown
5658 Handle hoNav
5659 Boolean bInEdit
5660 Get IsEditMode to bInEdit
5661 Send EndEdit
5662 Send LockBeginEdit
5663 Get phoReportNavigator to hoNav
5664 Send ComMovePageDown of hoNav False False
5665 Send UnlockBeginEdit
5666 Send ResetEditMode bInEdit
5667 End_Procedure
5668
5669 Procedure MovePageUp
5670 Handle hoNav
5671 Boolean bInEdit
5672 Get IsEditMode to bInEdit
5673 Send EndEdit
5674 Send LockBeginEdit
5675 Get phoReportNavigator to hoNav
5676 Send ComMovePageUp of hoNav False False
5677 Send UnlockBeginEdit
5678 Send ResetEditMode bInEdit
5679 End_Procedure
5680
5681 // Validates the selected row (which is done by the datasource). Returns column object
5682 // of the object that failed validation. If 0, no errors. If bTakeFocus is true it will
5683 // give focus to the offending column.
5684 Function ValidateRow Boolean bTakeFocus Returns Handle
5685 Handle hoCol hoDataSource
5686 Boolean bCancel
5687 Get phoDataSource to hoDataSource
5688 Get ValidateSelectedRow of hoDataSource to hoCol
5689 If (hoCol>0 and bTakeFocus) Begin
5690 // this may be a deferred move.
5691 Get MoveToColumnObject hoCol to bCancel
5692 End
5693 Function_Return hoCol
5694 End_Function
5695
5696 // returns number of rows the selectedRow is from the TopRow. If SelRow is
5697 // above, the top, it returns 0.
5698 {Visibility=Private }
5699 Function OffSetFromTop Returns Integer
5700 Integer iSel iOffset iTop
5701 Handle hoDataSource
5702 Get phoDataSource to hoDataSource
5703 Get SelectedRow of hoDataSource to iSel
5704 If (iSel<>-1) Begin
5705 Get ComTopRowIndex to iTop
5706 If (iSel<iTop) Begin
5707 Move 0 to iOffset
5708 End
5709 Else Begin
5710 Move (iSel-iTop) to iOffset
5711 End
5712 End
5713 Function_Return iOffSet
5714 End_Function
5715
5716 // synchronize the grid to the selected row passing a rowOffset preference
5717 // no rowchanging events are triggered by this. The offset preference can
5718 // be a row offset or ropTop, ropCenter, ropBotton
5719 Procedure SynchronizeGridtoSelectedRow Integer iRowOffsetPreference
5720 Integer iRow iIndex iRows
5721 Integer hoDataSource
5722 Boolean bCancel bNoFocusChangeCheck
5723 Get phoDataSource to hoDataSource
5724 Get SelectedRow of hoDataSource to iRow
5725 If (iRow<>-1) Begin
5726 If (iRowOffsetPreference=ropBottom or iRowOffsetPreference=ropCenter) Begin
5727 Get piLastVisibleRowCount to iRows
5728 If (iRows<=0) Begin
5729 Move 0 to iRowOffsetPreference
5730 End
5731 Else Begin
5732 Move (If(iRowOffsetPreference=ropBottom, iRows, (iRows/2))) to iRowOffsetPreference
5733 End
5734 End
5735 Move ( (iRow-iRowOffsetPreference) max 0) to iIndex
5736 Get pbNoFocusChangeCheck to bNoFocusChangeCheck
5737 Set pbNoFocusChangeCheck to True
5738 Set ComTopRowIndex to iIndex
5739 Send MoveToRow iRow
5740 Set pbNoFocusChangeCheck to bNoFocusChangeCheck
5741 End
5742 End_Procedure
5743
5744
5745 // synchronize the grid to the selected column
5746 // no row/column changing events are triggered by this
5747 // currently this is private because I cannot think of any reason this
5748 // would be used.
5749 { Visibility=Private }
5750 Procedure SynchronizeGridtoSelectedColumn
5751 Integer hoCol
5752 Boolean bCancel bNoFocusChangeCheck
5753 Get SelectedColumnObject to hoCol
5754 If (hoCol) Begin
5755 Get pbNoFocusChangeCheck to bNoFocusChangeCheck
5756 Set pbNoFocusChangeCheck to True
5757 Get MoveToColumnObject hoCol to bCancel
5758 Set pbNoFocusChangeCheck to bNoFocusChangeCheck
5759 End
5760 End_Procedure
5761
5762 // returns true if you are allowed to delete the row
5763 Function CanDeleteRow Returns Boolean
5764 Handle hoDataSource
5765 Boolean bCanDelete bAllowDelete bReadOnly
5766 Integer iSel
5767
5768 Get phoDataSource to hoDataSource
5769 Get SelectedRow of hoDataSource to iSel
5770 If (iSel=-1) Begin
5771 Function_Return False
5772 End
5773 Get pbReadOnly to bReadOnly
5774 Get CanDeleteRow of hoDataSource to bCanDelete
5775 Get pbAllowDeleteRow to bAllowDelete
5776 Function_Return (bCanDelete and bAllowDelete and not(bReadOnly))
5777 End_Function
5778
5779 // returns true if you are allowed to insert a row
5780 Function CanAddRow Returns Boolean
5781 Handle hoDataSource
5782 Boolean bReadOnly bCanInsert
5783
5784 Get phoDataSource to hoDataSource
5785 Get CanAddRow of hoDataSource to bCanInsert
5786 Get pbReadOnly to bReadOnly
5787 Function_Return (bCanInsert and not(bReadOnly))
5788 End_Function
5789
5790 // This is called by OnComRequestEdit which means that this is already
5791 // editable. This is used as one last chance to stop the edit. Most often
5792 // this will be applied to the entire row. We will disable edits if pbReadOnly is True.
5793 // When pbReadOnly is true and pbAllowEdit is true (default) edit requests will come
5794 // here and we want to disable them. If for some odd reason you wanted to be able to
5795 // edit you could augment this message
5796 Function CanEditColumn Integer iCol Returns Boolean
5797 Boolean bReadOnly
5798 Get pbReadOnly to bReadOnly
5799 Function_Return (not(bReadOnly))
5800 End_Function
5801
5802 // returns true if you are allowed to save the row
5803 Function CanSaveRow Returns Boolean
5804 Handle hoDataSource
5805 Boolean bReadOnly bCanSave
5806 Integer iSel
5807
5808 Get phoDataSource to hoDataSource
5809 Get SelectedRow of hoDataSource to iSel
5810 If (iSel=-1) Begin
5811 Function_Return False
5812 End
5813
5814 Get pbReadOnly to bReadOnly
5815 Get CanSaveRow of hoDataSource to bCanSave
5816 Function_Return (not(bReadOnly) and bCanSave)
5817
5818 End_Function
5819
5820 // removes a new selected row and selects the next row
5821 // performs a dataloss verify if needed.
5822 // Returns True If canceled
5823 Function RemoveNewSelectedRow Returns Boolean
5824 Boolean bChanged bNewRow bCancel
5825 Integer iSel
5826 Handle hoDataSource
5827
5828 Get phoDataSource to hoDataSource
5829 Get SelectedRow of hoDataSource to iSel
5830 If (iSel=-1) Begin
5831 Error DFERR_PROGRAM "Assert: RemoveNewSelectedRow called with no selected row"
5832 Function_Return True
5833 End
5834
5835 // this should never be called with an existing row because you could
5836 // be removing a row without notifying the external backend. Existing rows must
5837 // be deleted
5838 Get IsSelectedRowNew of hoDataSource to bNewRow
5839 If not bNewRow Begin
5840 Error DFERR_PROGRAM "Assert: RemoveNewSelectedRow called with non-new row"
5841 Function_Return True
5842 End
5843
5844 Get IsSelectedRowChanged of hoDataSource to bChanged
5845 If bChanged Begin
5846 Get Verify_Data_Loss to bCancel
5847 End
5848 If not bCancel Begin
5849 Send RemoveRowAndSelect iSel
5850 End
5851 Function_Return bCancel
5852 End_Function
5853
5854 // restores the selected row back to its pre-edited state
5855 // performs a dataloss verify if needed
5856 // returns True if canceled
5857 Function RestoreSelectedRow Returns Boolean
5858 Integer iSel
5859 Handle hoDataSource
5860 Boolean bChanged bCancel
5861
5862 Get phoDataSource to hoDataSource
5863 Get SelectedRow of hoDataSource to iSel
5864 If (iSel=-1) Begin
5865 Error DFERR_PROGRAM "Assert: RestoreSelectedRow called with no selected row"
5866 Function_Return True
5867 End
5868
5869 Get IsSelectedRowChanged of hoDataSource to bChanged
5870 If bChanged Begin
5871 Get Verify_Data_Loss to bCancel
5872 End
5873 If not bCancel Begin
5874 Send ResetSelectedRow of hoDataSource
5875 End
5876 Function_Return bCancel
5877 End_Procedure
5878
5879
5880 // inserts or appends a new empty row at iNewRow
5881 // Pass row number to insert before. If at end, it will append
5882 // Existing row is restored or saved as needed with verifications
5883 // Returns True if this was cancelled (eitehr not allowed or a verification cancel)
5884 Function AddRow Integer iNewRow Returns Boolean
5885 Handle hoDataSource
5886 Boolean bCancel bAllowed bAutoSave
5887 Boolean bShouldSave bNew
5888 Integer iSel
5889
5890 Get phoDataSource to hoDataSource
5891 Get SelectedRow of hoDataSource to iSel
5892
5893 Get CanAddRow to bAllowed
5894 If not bAllowed Begin
5895 Function_Return True
5896 End
5897
5898
5899 If (iSel<>-1) Begin
5900 // if this is a new row and there is nothing to save, we don't
5901 // want to add another row.
5902 Get ShouldSaveSelectedRow of hoDataSource to bShouldSave
5903 Get IsSelectedRowNew of hoDataSource to bNew
5904 Move (bNew and not(bShouldSave)) to bCancel
5905 If not bCancel Begin
5906 Get pbAutoSave to bAutoSave
5907 If (bAutoSave) Begin
5908 Get SaveSelectedRow to bCancel
5909 End
5910 Else Begin
5911 Get RestoreSelectedRow to bCancel
5912 End
5913 End
5914 End
5915
5916 If not bCancel Begin
5917 Send InsertRow of hoDataSource iNewRow // when done, SelectedRow is -1
5918 End
5919
5920 Function_Return bCancel
5921 End_Procedure
5922
5923 // deletes the selected row from datasource with verify
5924 // returns true if cancelled (either not allowed or cancelled)
5925 Function DeleteSelectedRow Returns Boolean
5926 Handle hoDataSource
5927 Boolean bCanDelete bCancel bErr
5928 Integer iSel
5929
5930 Get phoDataSource to hoDataSource
5931 Get SelectedRow of hoDataSource to iSel
5932 If (iSel=-1) Begin
5933 Function_Return True
5934 End
5935 Get CanDeleteRow to bCanDelete
5936 If (not(bCanDelete)) Begin
5937 Function_Return True
5938 End
5939
5940 Get Verify_Delete to bCancel
5941 If not bCancel Begin
5942 Get DeleteSelectedRow of hoDataSource to bCancel
5943 If not bCancel Begin
5944 Send RemoveRowAndSelect iSel
5945 End
5946 End
5947 Function_Return bCancel
5948 End_Function
5949
5950 // Save the selected row with verify
5951 // returns True if cancelled (either not allowed or cancelled)
5952 Function SaveSelectedRow Returns Boolean
5953 Integer iSel
5954 Boolean bChanged bCancel bSave
5955 Handle hoDataSource hoCol
5956
5957 Get phoDataSource to hoDataSource
5958 Get SelectedRow of hoDataSource to iSel
5959 If (iSel=-1) Begin
5960 Function_Return True
5961 End
5962 Get ForceColumnExit to bCancel
5963 If bCancel Begin
5964 Function_Return bCancel
5965 End
5966
5967 Get ShouldSaveSelectedRow of hoDataSource to bSave
5968 If (not(bSave)) Begin
5969 Function_Return False // nothing to do but that's ok
5970 End
5971
5972 Get CanSaveRow to bSave
5973 If (not(bSave)) Begin
5974 Function_Return True // cant save... not good.
5975 End
5976
5977 // validate row
5978 Get ValidateRow True to hoCol
5979 If (hoCol) Begin
5980 Function_Return True
5981 End
5982
5983 Get Verify_Save to bCancel
5984 If (bCancel) Begin
5985 Function_Return True
5986 End
5987
5988 Get SaveSelectedRow of hoDataSource to bCancel
5989 Function_Return bCancel
5990
5991 End_Function
5992
5993 // this does a commit of the selected row without changing the
5994 // actual row. Can be used to save or clear a row without changing the row. If the
5995 // row is new and not changed we will remove it. This is normally used in exiting.
5996 Function CommitSelectedRow Returns Boolean
5997 Handle hoDataSource
5998 Integer iRow
5999 Boolean bCancel bChanged bNew
6000
6001 Send EndEdit
6002 Get phoDataSource to hoDataSource
6003 Get SelectedRow of hoDataSource to iRow
6004 If (iRow<>-1) Begin
6005
6006 // this all handles the case of commiting a new unchanged row. If the row is new
6007 // and not changed, we want to remove and select the next or previous row
6008 Get ShouldSaveSelectedRow of hoDataSource to bChanged
6009 Get IsSelectedRowNew of hoDataSource to bNew
6010 If (bNew and not(bChanged)) Begin
6011 Get RemoveNewSelectedRow to bCancel
6012 End
6013 Else Begin
6014 Get RowChanging iRow iRow to bCancel
6015 End
6016
6017 End
6018 Function_Return bCancel
6019 End_Function
6020
6021 { Visibility=Private }
6022 Function RowChanging Integer iOld Integer iNew Returns Boolean
6023 Boolean bCancel bValidate bChanged bAutoSaveOnrowChange bNew bReadOnly
6024 Handle hoCol hoDataSource
6025
6026 If (iOld<>-1) Begin
6027 Get phoDataSource to hoDataSource
6028 Get ShouldSaveSelectedRow of hoDataSource to bChanged
6029 Get IsSelectedRowNew of hoDataSource to bNew
6030 If bChanged Begin
6031 Get pbAutoSave to bAutoSaveOnrowChange
6032 Get pbReadOnly to bReadOnly
6033 If (not(bReadOnly) and bAutoSaveOnRowChange) Begin
6034 Get SaveSelectedRow to bCancel
6035 End
6036 Else Begin
6037 If (bNew and (iNew<>-1) and (iNew<>iOld)) Begin
6038 Get RemoveNewSelectedRow to bCancel
6039 End
6040 Else Begin
6041 Get RestoreSelectedRow to bCancel
6042 End
6043 End
6044 End
6045 // not changed
6046 Else Begin
6047 If (bNew and (iNew<>-1) and (iNew<>iOld)) Begin
6048 Get RemoveNewSelectedRow to bCancel // will be deferred
6049 End
6050 End
6051 End
6052
6053 Function_Return bCancel
6054 End_Function // RowChanging
6055
6056 // called to verify a save. Return non zero to cancel
6057 Function Verify_Save Returns Integer
6058 End_Function
6059
6060 // called to verify a dataloss from a clear or restore. Return non zero to cancel
6061 Function Verify_Data_Loss Returns Integer
6062 End_Function
6063
6064 // called to verify a delete. Return non zero to cancel
6065 Function Verify_Delete Returns Integer
6066 End_Function
6067
6068 // Request a "clear row"
6069 //
6070 // This is the table row clearing handler. If:
6071 // A. New row / Unchanged: Delete empty row
6072 // B. old row / unchanged: ignore
6073 // C. New row / changed: verify_loss and clear changes, goto 1st enterable column
6074 // D. old row / changed: verify_loss and clear changes, goto 1st enterable column
6075 //
6076 Procedure Request_ClearRow
6077 Boolean bChanged bNewRow bCancel
6078 Integer iSel iCount
6079 Handle hoDataSource
6080 Boolean bInFocusChanging
6081
6082 Get pbInRowFocusChanging to bInFocusChanging
6083 If bInFocusChanging Begin
6084 Error DFERR_PROGRAM "Request_ClearRow called in focus changing"
6085 Procedure_Return
6086 End
6087
6088 Get phoDataSource to hoDataSource
6089 Get SelectedRow of hoDataSource to iSel
6090 If (iSel=-1) Begin
6091 Procedure_Return
6092 End
6093
6094 Send EndEdit
6095 Send LockBeginEdit
6096 Get IsSelectedRowChanged of hoDataSource to bChanged
6097 Get IsSelectedRowNew of hoDataSource to bNewRow
6098
6099 If (not(bChanged)) Begin
6100 If (bNewRow) Begin // A. new row-unchanged. close Row. select new row
6101 Get RemoveNewSelectedRow to bCancel
6102 End
6103 Else Begin // B. old, unchanged ..do nothing
6104 End
6105 End
6106 Else Begin
6107 // C. new row-changed. Clear existing row
6108 // D. old row-changed. Clear existing changes
6109 Get RestoreSelectedRow to bCancel
6110 If not bCancel Begin
6111 Send MoveToFirstEnterableColumn
6112 End
6113 End
6114 Send DeferredRedraw
6115 Send UnlockBeginEdit
6116 Send ResetEditMode False
6117 Move (bCancel) to Err
6118 End_Procedure
6119
6120
6121 // requests an insert row
6122 Procedure Request_InsertRow
6123 Boolean bChanged bNewRow bCancel bAppend
6124 Integer iSel iCol
6125 Handle hoDataSource
6126 Boolean bInFocusChanging bAllowInsert bInEdit
6127
6128 Get pbInRowFocusChanging to bInFocusChanging
6129 If bInFocusChanging Begin
6130 Error DFERR_PROGRAM "Request_InsertRow called in focus changing"
6131 Procedure_Return
6132 End
6133
6134 Get phoDataSource to hoDataSource
6135 Get pbAllowInsertRow to bAllowInsert
6136 If not bAllowInsert Begin
6137 // if insert not allowed, see if append is allowed and do that instead
6138 Get pbAllowAppendRow to bAppend
6139 If bAppend Begin
6140 Send Request_AppendRow
6141 End
6142 Else Begin
6143 Move True to Err
6144 End
6145 Procedure_Return
6146 End
6147
6148 Get IsEditMode to bInEdit
6149 Send EndEdit
6150 Send LockBeginEdit
6151
6152
6153 Get SelectedRow of hoDataSource to iSel
6154 If (iSel=-1) Begin
6155 // if no selected row insert at the top
6156 Move 0 to iSel
6157 End
6158
6159 Get AddRow iSel to bCancel // AddRow will leave selectedRow unset (-1)
6160
6161 If not bCancel Begin
6162 Send MoveToRow iSel // make the inserted row the current row
6163 Get SelectedColumn to iCol
6164 If (iCol=-1) Begin
6165 Send MoveToFirstEnterableColumn
6166 End
6167 End
6168 Send UnlockBeginEdit
6169 // if you are adding a row, we will assume you want to enter edit mode. It just makes sense
6170 If (not(bCancel)) Begin
6171 Send BeginEdit
6172 End
6173 Else Begin
6174 Send ResetEditMode bInEdit
6175 End
6176 Move (bCancel) to Err
6177 End_Procedure
6178
6179 // requests an append row
6180 Procedure Request_AppendRow
6181 Boolean bChanged bCancel bAllowAppend
6182 Boolean bInFocusChanging bInEdit
6183 Integer iSel iCol iRowCount
6184 Handle hoDataSource
6185
6186 Get pbInRowFocusChanging to bInFocusChanging
6187 If bInFocusChanging Begin
6188 Error DFERR_PROGRAM "Request_AppendRow called in focus changing"
6189 Procedure_Return
6190 End
6191
6192 Get pbAllowAppendRow to bAllowAppend
6193 If not bAllowAppend Begin
6194 Move True to Err
6195 Procedure_Return
6196 End
6197 Get IsEditMode to bInEdit
6198 Send EndEdit
6199 Send LockBeginEdit
6200 Get phoDataSource to hoDataSource
6201 Get LoadFirstOrLastRow True to bCancel
6202 If not bCancel Begin
6203 Get RowCount of hoDataSource to iRowCount
6204 Get AddRow iRowCount to bCancel
6205 If not bCancel Begin
6206 Send ReSynchToDataSource
6207 Send MoveToRow iRowCount
6208 Get SelectedColumn to iCol
6209 If (iCol=-1) Begin
6210 Send MoveToFirstEnterableColumn
6211 End
6212 End
6213 End
6214 Send UnlockBeginEdit
6215 // if you are adding a row, we will assume you want to enter edit mode. It just makes sense
6216 If (not(bCancel)) Begin
6217 Send BeginEdit
6218 End
6219 Else Begin
6220 Send ResetEditMode bInEdit
6221 End
6222 Move (bCancel) to Err
6223 End_Procedure
6224
6225
6226 // standard request_clear (which is sent to all DEOs).
6227 // Does a Request_ClearRow
6228 Procedure Request_Clear
6229 Send Request_ClearRow
6230 End_Procedure
6231
6232 // request a delete row
6233 // delete row and back end record.
6234 // If the record is new, treat this as a remove row request
6235 Procedure Request_Delete
6236 Boolean bCancel
6237 Boolean bInFocusChanging bIsNew bInEdit
6238 Handle hoDataSource
6239
6240 Get phoDataSource to hoDataSource
6241 Get IsSelectedRowNew of hoDataSource to bIsNew
6242 Get pbInRowFocusChanging to bInFocusChanging
6243 If bInFocusChanging Begin
6244 Error DFERR_PROGRAM "Request_Delete called in focus changing"
6245 Procedure_Return
6246 End
6247 Get IsEditMode to bInEdit
6248 Send EndEdit
6249 Send LockBeginEdit
6250 If bIsNew Begin
6251 Get RemoveNewSelectedRow to bCancel
6252 End
6253 Else Begin
6254 Get DeleteSelectedRow to bCancel
6255 End
6256 Send UnlockBeginEdit
6257 Send ResetEditMode bInEdit
6258 Move (bCancel) to Err
6259 End_Procedure
6260
6261 // request a save
6262 Procedure Request_Save
6263 Boolean bCancel
6264 Boolean bInFocusChanging bInEdit
6265
6266 Get pbInRowFocusChanging to bInFocusChanging
6267 If bInFocusChanging Begin
6268 Error DFERR_PROGRAM "Request_Save called in focus changing"
6269 Procedure_Return
6270 End
6271
6272 Get IsEditMode to bInEdit
6273 Send EndEdit
6274 Send LockBeginEdit
6275 Get SaveSelectedRow to bCancel
6276 Send DeferredRedraw
6277 Send UnlockBeginEdit
6278 Send ResetEditMode bInEdit
6279 Move (bCancel) to Err
6280 End_Procedure
6281
6282 // Does a prompt for selected column. Needed by the rest of the system
6283 { Visibility=Private }
6284 Procedure Prompt
6285 Handle hoCol
6286 Get SelectedColumnObject to hoCol
6287 If (hoCol) Begin
6288 Send Prompt of hoCol
6289 End
6290 End_Procedure
6291
6292 // returns prompt object for selected column. Needed by the rest of the system
6293 { Visibility=Private }
6294 Function Prompt_Object Returns Handle
6295 Handle hoCol hoPrompt
6296 Get SelectedColumnObject to hoCol
6297 If (hoCol) Begin
6298 Get Prompt_Object of hoCol to hoPrompt
6299 End
6300 Function_Return hoPrompt
6301 End_Function
6302
6303 { MethodType=Event }
6304 Procedure Prompt_Callback Handle hoPrompt
6305 Handle hoCol
6306 Get SelectedColumnObject to hoCol
6307 If (hoCol) Begin
6308 Send Prompt_Callback of hoCol hoPrompt
6309 End
6310 End_Procedure
6311
6312 // Does a Zoom for selected column. Needed by the rest of the system
6313 { Visibility=Private }
6314 Procedure Zoom
6315 Handle hoCol
6316 Get SelectedColumnObject to hoCol
6317 If (hoCol) Begin
6318 Send Zoom of hoCol
6319 End
6320 End_Procedure
6321
6322 // returns Zoom object for selected column. Needed by the rest of the system
6323 { Visibility=Private }
6324 Function Zoom_Object Returns Handle
6325 Handle hoCol hoZoom
6326 Get SelectedColumnObject to hoCol
6327 If (hoCol) Begin
6328 Get Zoom_Object of hoCol to hoZoom
6329 End
6330 Function_Return hoZoom
6331 End_Function
6332
6333 // augmented to remove the custom edit before a resize.
6334 { NoDoc=True }
6335 Procedure Set GuiSize Integer iHeight Integer iWidth
6336 Send EndEdit
6337 Forward Set GuiSize to iHeight iWidth
6338 Set piLastVisibleRowCount to -1
6339 End_Procedure
6340
6341 // augmented to remove the custom edit before a relocate.
6342 { NoDoc=True }
6343 Procedure Set GuiLocation Integer iRowPos Integer iColPos
6344 Send EndEdit
6345 Forward Set GuiLocation to iRowPos iColPos
6346 End_Procedure
6347
6348 // create and return a PropExchange COM object
6349 Function CreatePropExchangeObject Returns Handle
6350 Handle hoPropExchange hoGlobal
6351 Variant vPropExchange vGlobal
6352
6353 If (not(IsComObjectCreated(Self))) Begin
6354 Error DFERR_PROGRAM "Cannot exchange report/grid data. COM object not created"
6355 Function_Return 0
6356 End
6357
6358 Get Create (RefClass(cCJReportControlGlobalSettings)) to hoGlobal
6359 Send CreateComObject of hoGlobal
6360 Get ComCreatePropExchange of hoGlobal to vPropExchange
6361 Get Create (RefClass(cCJPropExchange)) to hoPropExchange
6362 Set pvComObject of hoPropExchange to vPropExchange
6363 Send Destroy of hoGlobal
6364 Function_Return hoPropExchange
6365 End_Function
6366
6367 // does a property exchange. Pass COM exchange objetc and section name
6368 Procedure ExchangeLayout Handle hoExchange String sSection
6369 Variant vSection
6370 Handle hoExchangePref
6371 Integer iBuild iIDBuild iColumns iLastColumns
6372 Boolean bLoad
6373
6374 If (not(IsComObjectCreated(Self))) Begin
6375 Error DFERR_PROGRAM "Cannot exchange report/grid data. COM object not created"
6376 Procedure_Return
6377 End
6378
6379 Get ComLoading of hoExchange to bLoad
6380 Get piLayoutBuild to iBuild
6381 Get ColumnCount to iColumns
6382
6383 Get Create (RefClass(cCJPropExchange)) to hoExchangePref
6384 Get ComGetSection of hoExchange sSection to vSection
6385 Set pvComObject of hoExchangePref to vSection
6386
6387 If (not(bLoad)) Begin
6388 Send ComDoPropExchange vSection
6389 Send ComExchangeInt of hoExchangePref "Build" (&iBuild) 0
6390 Send ComExchangeInt of hoExchangePref "Columns" (&iColumns) 0
6391 End
6392 Else Begin
6393 // get the build from the data. If it is not what we expect, don't load - it is out of date
6394 Send ComExchangeInt of hoExchangePref "Build" (&iIDBuild) 0
6395 // as a double check we will not save if the column count changes. This does not insure that
6396 // things are correct but it will catch some problems. When this is loaded from an out of date
6397 // setting it can create some very strange side-effect.
6398 Send ComExchangeInt of hoExchangePref "Columns" (&iLastColumns) 0
6399 If ((iIDBuild=iBuild) and (iColumns=iLastColumns)) Begin
6400 Send ComDoPropExchange vSection
6401 End
6402 End
6403
6404 Send Destroy of hoExchangePref
6405 End_Procedure
6406
6407
6408 // loads grid info from the registry.
6409 // It provides a good model for how to do this kind of thing.
6410 { Visibility=Private }
6411 Function LoadGridLayoutFromRegistry String sKey Returns Boolean
6412 Handle hoExchange
6413 Boolean bOk
6414 String sSection sFullKey
6415 Integer iSort
6416
6417 Move ("HKEY_CURRENT_USER\" - sKey) to sFullKey
6418 Get psLayoutSection to sSection
6419 Get CreatePropExchangeObject to hoExchange
6420
6421 Get ComCreateAsRegistry of hoExchange True sFullKey to bOk
6422
6423 If not (bOk) Begin
6424 Error DFERR_PROGRAM "Assert: Cannot load from registry"
6425 End
6426
6427 If bOk Begin
6428 Send ExchangeLayout hoExchange sSection
6429 Get piSortColumn to iSort
6430 Set piSortColumn to iSort
6431 Send DeferredRedraw // ComRedraw
6432 End
6433 Send destroy of hoExchange
6434 Function_Return bOk
6435 End_Function
6436
6437
6438 // save grid info to the registry.
6439 // It provides a good model for how to do this kind of thing.
6440 { Visibility=Private }
6441 Procedure SaveGridLayoutToRegistry String sKey
6442 Handle hoExchange hoRegistry
6443 Boolean bOk bExists bVoid
6444 String sSection sFullKey sShortKey
6445
6446 Move ("HKEY_CURRENT_USER\" - sKey) to sFullKey
6447 Get psLayoutSection to sSection
6448 Move (sKey - "\" - sSection) to sShortKey
6449
6450 If (sKey="" or sSection="") Begin
6451 Error DFERR_PROGRAM "Assert: Registry Key or Section name is invalid"
6452 End
6453
6454 Get CreatePropExchangeObject to hoExchange
6455 Get ComCreateAsRegistry of hoExchange False sFullKey to bOk
6456
6457 If not (bOk) Begin
6458 Error DFERR_PROGRAM "Assert: Cannot save layout to registry"
6459 End
6460
6461 If bOk Begin
6462 // delete the existing registry information for this section
6463 Get Create U_cRegistry to hoRegistry
6464 Set pbLazyWrite of hoRegistry to False
6465 Get KeyExists of hoRegistry sShortKey to bExists
6466 If bExists Begin
6467 Get DeleteKey of hoRegistry sShortKey to bVoid
6468 End
6469 Send Destroy of hoRegistry
6470
6471 Send ExchangeLayout hoExchange sSection
6472 End
6473
6474 Send destroy of hoExchange
6475 End_Procedure
6476
6477
6478 // Destroys all column objects. You'd only use this if you are dynamically creating columns. There is no need to send
6479 // this during a normal grid destroy. There is no option to destroy individual columns - just destroy them all and start over.
6480 // This also resets the datasource. The datasource is not valid when the column objects are destroyed.
6481 Procedure DestroyColumnObjects
6482 Handle[] hoColumnObjects
6483 Handle hoDataSource hoReportColumns
6484 Integer iCols i
6485
6486 Get phoColumnObjects to hoColumnObjects
6487 Move (SizeOfArray(hoColumnObjects)) to iCols
6488 For i from 0 to (iCols-1)
6489 Send Destroy of hoColumnObjects[i]
6490 Loop
6491 Set phoColumnObjects to (ResizeArray(hoColumnObjects,0))
6492
6493 Get phoDataSource to hoDataSource
6494 Send ResetAll of hoDataSource
6495 Send NewColumn -1
6496 // if object is active, we must destroy COM columns and reset
6497 If (IsComObjectCreated(Self)) Begin
6498 Get phoReportColumns to hoReportColumns
6499 Send ComDeleteAll of hoReportColumns
6500 Send ResetGrid
6501 End
6502 Set psOriginalLayout to ''
6503 Set psInstanceLayout to ''
6504
6505 End_Procedure
6506
6507 // request a grid reorder based on bestorder for this header column.
6508 Procedure HeaderReorder Integer iCol
6509 Handle hoCol
6510 Integer iOldCol
6511 Boolean bHeaderTogglesDirection bHeaderReorders bReverse
6512 Get ColumnObject iCol to hoCol
6513 If hoCol Begin
6514 Get pbHeaderReorders to bHeaderReorders
6515 If bHeaderReorders Begin
6516 Get pbHeaderTogglesDirection to bHeaderTogglesDirection
6517 Get piSortColumn to iOldCol
6518 If (iOldCol<>iCol) Begin
6519 Send SortGridByColumn hoCol False
6520 End
6521 Else If bHeaderTogglesDirection Begin
6522 Get pbReverseOrdering to bReverse
6523 Send SortGridByColumn hoCol (not(bReverse))
6524 End
6525 End
6526 End
6527 End_Procedure
6528
6529 // request a grid datasource for passed column object and ascending/descending flag.
6530 // Should mainly be used with a datasource that is fully loaded and static.
6531 // If your datasource is cached and not fully loaded it will sort what is there which is
6532 // almost never what you.
6533 Procedure SortGridByColumn Handle hoCol Boolean bDescending
6534 Handle hoDataSource hoSelCol
6535 Integer iCol iSelRow iOffset
6536 tGridSortRules SortRules
6537 Boolean bCancel
6538
6539 // commit any changes first
6540 Get CommitSelectedRow to bCancel
6541 If bCancel Begin
6542 Function_Return True
6543 End
6544
6545 Get phoDataSource to hoDataSource
6546 Get ColumnSortRules of hoCol to SortRules
6547 If (SizeOfArray(SortRules.Rules)) Begin
6548 Get SelectedColumnObject to hoSelCol
6549 Get piColumnId of hoCol to iCol
6550 Get OffSetFromTop to iOffset
6551 Set piSortColumn to iCol
6552 Set pbReverseOrdering to bDescending
6553 Move bDescending to SortRules.bDescending
6554 Send SortDataSource of hoDataSource SortRules
6555 Get SelectedRow of hoDataSource to iSelRow
6556 If (iSelRow<>-1) Begin
6557 Send SynchronizeGridtoSelectedRow iOffset
6558 End
6559 If (hoSelCol) Begin
6560 Get MoveToColumnObject hoSelCol to bCancel
6561 End
6562 End
6563 End_Procedure
6564
6565 { MethodType=Property }
6566 { DesignTime = False }
6567 Procedure Set piSortColumn Integer iValue
6568 Handle hoSortOrer hoCol
6569 Integer iCount iCol
6570 Variant vCol
6571 Boolean bAsc
6572 Set private_piSortColumn to iValue
6573 If (IsComObjectCreated(Self)) Begin
6574 Get Create (RefClass(cCJReportColumnOrder)) to hoSortOrer
6575 Get ComSortOrder to vCol
6576 Get pbReverseOrdering to bAsc
6577 Set pvComObject of hoSortOrer to vCol
6578 Send ComDeleteAll of hoSortOrer
6579 If (iValue<>-1) Begin
6580 Get ColumnObject iValue to hoCol
6581 If (IsComObjectCreated(hoCol)) Begin
6582 Get pvComObject of hoCol to vCol
6583 Send ComAdd of hoSortOrer vCol
6584 Set ComSortAscending of hoCol to (not(bAsc))
6585 End
6586 End
6587 Send Destroy of hoSortOrer
6588 End
6589 End_Procedure
6590
6591 { MethodType=Property }
6592 Function piSortColumn Returns Integer
6593 Integer iCol
6594 Get private_piSortColumn to iCol
6595 Function_Return iCol
6596 End_Function
6597
6598 { MethodType=Property }
6599 { DesignTime = False }
6600 Procedure Set pbReverseOrdering Boolean bAsc
6601 Handle hoCol
6602 Integer iCol
6603 Set private_pbReverseOrdering to bAsc
6604 If (IsComObjectCreated(Self)) Begin
6605 Get piSortColumn to iCol
6606 If (iCol<>-1) Begin
6607 Get ColumnObject iCol to hoCol
6608 If (IsComObjectCreated(hoCol)) Begin
6609 Set ComSortAscending of hoCol to (not(bAsc))
6610 End
6611 End
6612 End
6613 End_Procedure
6614
6615 { MethodType=Property }
6616 Function pbReverseOrdering Returns Boolean
6617 Boolean bReverse
6618 Get private_pbReverseOrdering to bReverse
6619 Function_Return bReverse
6620 End_Function
6621
6622
6623 // Search the value for this column in the datasource and move to that row.
6624 // This is meant to be used when all data is loaded. bFindGE determines if this is a EQ (false)
6625 // or GE (True) find. iStartRow determines the row to start the search at.
6626 // If a GE search and no match move to end of datasource (it makes the most sense)
6627 Procedure RequestFindColumnValue Integer iColumn String sValue Boolean bFindGE Integer iStartRow
6628 Integer iRow iRows
6629 Handle hoDataSource
6630 Boolean bReverse
6631 Get phoDataSource to hoDataSource
6632 Get pbReverseOrdering to bReverse
6633 Get FindColumnValue of hoDataSource iColumn sValue bFindGE iStartRow bReverse to iRow
6634 // if not found and this ia GE search move to last row
6635 If ((iRow=-1) and bFindGE) Begin
6636 Get RowCount of hoDataSource to iRows
6637 If (iRows>0) Begin
6638 If bReverse Begin
6639 Move 0 to iRow
6640 End
6641 Else Begin
6642 Move (iRows-1) to iRow
6643 End
6644 End
6645 End
6646 If (iRow<>-1) Begin
6647 Send MoveToRow iRow
6648 End
6649 End_Procedure
6650
6651 // required DD/DEO interface
6652 { Visibility=Private }
6653 Function ItemToColumnObject Integer iItem Returns Handle
6654 Handle hoCol
6655 If (iItem<>-1) Begin
6656 If (iItem=Current) Begin
6657 Get SelectedColumn to iItem
6658 If (iItem=-1) Begin
6659 Function_Return 0
6660 End
6661 End
6662 // note ths returns 0 if this is not a DEO column
6663 Get ColumnObject iItem to hoCol
6664 End
6665 Function_Return hoCol
6666 End_Function
6667
6668
6669 // required Item interface
6670 // These are special item/value things that get sent to the focus
6671 // object to get or set the current focused control).
6672
6673 // required Item interface
6674 Function Current_Item Returns Integer
6675 Integer iItem
6676 Get SelectedColumn to iItem
6677 Function_Return iItem
6678 End_Function
6679
6680 // required Item interface
6681 Function item_count Returns Integer
6682 Integer iItems
6683 Get ColumnCount to iItems
6684 Function_Return iItems
6685 End_Function
6686
6687 // required Item interface
6688 { MethodType=Property }
6689 Procedure Set Value Integer iItem String sVal
6690 Handle hoCol
6691 Get ItemToColumnObject iItem to hoCol
6692 If hoCol Begin
6693 Send UpdateCurrentValue of hoCol sVal
6694 End
6695 End_Procedure
6696
6697 // required Item interface
6698 { MethodType=Property }
6699 Function Value Integer iItem Returns String
6700 String sVal
6701 Handle hoCol
6702 Get ItemToColumnObject iItem to hoCol
6703 If hoCol Begin
6704 Get SelectedRowValue of hoCol to sVal
6705 End
6706 Function_Return sVal
6707 End_Function
6708
6709 // required Item interface
6710 // does nothing with this value
6711 { MethodType=Property }
6712 Procedure Set Item_Changed_State Integer iItem Integer bChanged
6713 End_Procedure
6714
6715 // required Item interface
6716 // always returns values
6717 { MethodType=Property }
6718 Function Item_Changed_State Integer iItem Returns Integer
6719 End_Function
6720
6721 { Visibility=Private }
6722 Procedure ResetEditMode Boolean bWasEdit
6723 Boolean bEdit
6724 Get pbEditOnKeyNavigation to bEdit
6725 If (bEdit or bWasEdit) Begin
6726 Send BeginEdit
6727 End
6728 End_Procedure
6729
6730 Procedure FreezeColumn Handle hoCol
6731 Integer iFreeze iCol iCol0
6732 Boolean bVisible
6733 Handle hoCol0
6734 If (hoCol) Begin
6735 Get ColumnDisplayIndex of hoCol to iCol
6736 // piFreezecoumnsCount sets a visible column and
6737 // the display index includes hidden. So we must
6738 // adjust our column count to remove hidden columns.
6739 Move iCol to iCol0
6740 // check this column and all columns to the left
6741 While (iCol0>=0)
6742 Get ColumnObject iCol0 to hoCol0
6743 Get pbVisible of hoCol0 to bVisible
6744 If not bVisible Begin
6745 Decrement iCol // not visible, decrement column count
6746 End
6747 Decrement iCol0
6748 Loop
6749 If (iCol>=0) Begin
6750 Get piFreezeColumnsCount to iFreeze
6751 If ((iCol+1=iFreeze)) Begin
6752 Set piFreezeColumnsCount to 0
6753 End
6754 Else Begin
6755 Set piFreezeColumnsCount to (iCol+1)
6756 End
6757 Send DeferredRedraw // ComRedraw
6758 End
6759 End
6760 End_Procedure
6761
6762 // request status help. First check if their is a column help string
6763 // if not, see if the grid has a help string.
6764 Procedure Request_Status_Help Boolean bShow
6765 String sHelp
6766 Handle hoStatusbar hoCol
6767 If bShow Begin
6768 Get Statusbar_Id to hoStatusbar
6769 If hoStatusbar Begin
6770 Get SelectedColumnObject to hoCol
6771 If hoCol Begin
6772 Get Status_Help of hoCol to sHelp
6773 End
6774 If (sHelp="") Begin
6775 Get Status_Help to sHelp
6776 End
6777 Send Show_Status_Help of hoStatusbar sHelp
6778 End
6779 End
6780 End_Procedure
6781
6782 // augmented to set a flag which tells the idle handler to go into edit mode at the end
6783 // of its processes. This is needed so that the grid edit control takes the focus when it is first
6784 // activated and when switching between views.
6785 { NoDoc=True }
6786 Procedure Activate Returns Integer
6787 Boolean bHasFocus
6788 Integer iFail
6789 // if grid already has the focus or if the edit control has the focus we don't do anything special. We only care
6790 // when the activation is moving the focus here from somewhee else.
6791 Get ContainsFocus to bHasFocus
6792 Forward Get Msg_Activate to iFail
6793 If (not(iFail) and not(bHasFocus)) Begin
6794 Set pbBeginEditOnIdle to True
6795 End
6796 End_Procedure
6797
6798 // make sure the edit control is closed before the change
6799 { NoDoc=True }
6800 Procedure Switch
6801 Send EndEdit
6802 Forward Send Switch
6803 End_Procedure
6804
6805 // make sure the edit control is closed before the change
6806 { NoDoc=True }
6807 Procedure Switch_Back
6808 Send EndEdit
6809 Forward Send Switch_Back
6810 End_Procedure
6811
6812 // do a popup search request for the passed column. The keys can provide a
6813 // seed value - they come from OnComKeyDown
6814 Procedure RequestColumnSearch Handle hoCol Integer iKeyCode Integer iKeyShift
6815 Handle hoSearchDialog
6816 Integer iCol
6817 Boolean bOk
6818 String sValue
6819
6820 Get piColumnId of hoCol to iCol
6821 Get Create (RefClass(cCJGridSearchDialog)) to hoSearchDialog
6822 Get RequestGridSearch of hoSearchDialog iKeyCode iKeyShift hoCol (&sValue) to bOk
6823 If bOk Begin
6824 Send RequestFindColumnValue iCol sValue True 0
6825 End
6826 Send Destroy of hoSearchDialog
6827 End_Procedure
6828
6829 // do a popup search request for the sort column. The keys can provide a
6830 // seed value - they come from OnComKeyDown
6831 Procedure Request_Search Integer iKeyCode Integer iKeyShift
6832 Integer iCol
6833 Handle hoCol
6834 Get piSortColumn to iCol
6835 If (iCol<>-1) Begin
6836 Get ColumnObject iCol to hoCol
6837 Send RequestColumnSearch hoCol iKeyCode iKeyShift
6838 End
6839 End_Procedure
6840
6841 // reinitialize the static data in your grid. This is meant to be used where
6842 // you have taken the datasource and made a batch change like setting all checkboxes
6843 // in a column. The restores the current row, column and selections. This works best
6844 // if you keep the same number of rows. If you add or delete rows below the selected row
6845 // it will work ok. If you insert rows or delete records above the selected rows you
6846 // don't want to use this - Use InitializeData
6847 Procedure ReInitializeData Variant[] DataSource Boolean bKeepSelections
6848 Handle hoDataSource
6849 Integer[] SelectedRowIndexes
6850 Integer iRow iCol iTop iOldSize iNewSize iSels iSel iNewSel
6851 Boolean bInitEnable bInEdit
6852
6853 Get IsEditMode to bInEdit
6854 Get phoDataSource to hoDataSource
6855 Get RowCount of hoDataSource to iOldSize
6856 Move (SizeOfArray(DataSource)) to iNewSize
6857 Get SelectedRow of hoDataSource to iRow
6858 Get SelectedColumn of hoDataSource to iCol
6859 Get ComTopRowIndex of hoDataSource to iTop
6860 If bKeepSelections Begin
6861 Get GetIndexesForSelectedRows to SelectedRowIndexes // get all selected rows
6862 End
6863 Send InitializeDataSource of hoDataSource DataSource
6864 Get pbInitialSelectionEnable to bInitEnable
6865 Set pbInitialSelectionEnable to False // don't auto set the first row
6866 Send ResetVirtualMode iNewSize
6867 Get pbInitialSelectionEnable to bInitEnable
6868
6869 If (iRow<>-1 and iRow>=iNewSize) Begin
6870 Send MovetoLastRow
6871 End
6872 Else Begin
6873 Send SelectRow of hoDataSource iRow True
6874 Send SynchronizeGridtoSelectedRow 0
6875 If (iTop>=0) Begin
6876 Set ComTopRowIndex to iTop
6877 End
6878 End
6879 Send NewColumn iCol
6880 Send SynchronizeGridtoSelectedColumn
6881 If bKeepSelections Begin
6882 Send SetIndexesForSelectedRows SelectedRowIndexes
6883 End
6884 If bInEdit Begin
6885 Send BeginEdit
6886 End
6887 End_Procedure
6888
6889End_Class // cGrid
6890