You're right to ask about how these methods are related! The sheer number of methods in TXBrowse can be overwhelming, but they are designed to work together to provide a rich and functional browse control.
Let's break down how these methods are related by categorizing them based on their roles and interactions:
1. Lifecycle Management (Creation, Destruction, Initialization):
New() and Destroy(): These are the fundamental methods that control the lifespan of a TXBrowse object. New() creates an instance, setting up default properties and resources. Destroy() cleans up and releases those resources when the object is no longer needed.
Initiate( hDlg ): Called internally during the creation process. It sets up scrollbars, default colors, and initializes data-related codeblocks.
Adjust(): Crucially linked to data loading and display. It's called after data is set (via SetRDD, SetArray, etc.) to calculate sizes of rows, columns, headers, footers, and prepare the browse for rendering. It also triggers CheckSize() and CalcHdrHeight() to ensure correct layout.
CheckSize() & CalcHdrHeight() & CalcRowSelPos(): These are helper methods called by Adjust() and Refresh() to recalculate dimensions and positions based on data and style settings. They ensure the browse layout is consistent and correct after data or style changes.
Think of it like building a house: New() is like laying the foundation, Initiate() is like building the basic structure, Adjust() is like fitting windows and doors and ensuring everything is properly sized, and Destroy() is like demolishing the house when it's no longer needed.
2. Data Source Management (Setting and Resetting Data):
SetRDD(), SetArray(), SetoDbf(), SetExcelRange(), SetAdo(), SetTree(), SetColsForTree(), SetDolphin(), SetMySql(): These methods are the entry points for connecting the TXBrowse to different data sources. They are mutually exclusive – you'll use one of them depending on your data origin. They all ultimately trigger Adjust() after setting up the data connection to prepare the browse for display.
ResetData( uSrc, aCols ) & ResetBrowse(): Used to clear the existing data and columns and optionally load new data. ResetBrowse() is a more general reset, while ResetData() specifically handles switching data sources.
Analogy: These methods are like choosing the type of fuel and engine for your car (TXBrowse). You choose one (RDD, Array, etc.) to power the data display. ResetData is like changing the engine entirely, while ResetBrowse is more like just turning off the engine and clearing the dashboard.
3. Navigation Methods (Cursor Movement and Position):
GoTop(), GoBottom(), GoUp(), GoDown(), PageUp(), PageDown(), Skip(): These methods provide different ways to move the browse cursor through the data. They are all interconnected as different forms of navigation.
BookMark(), KeyNo(): These methods manage the bookmark and key number (scrollbar position) of the browse. They are often used in conjunction with navigation methods to remember or jump to specific positions.
GoFltRow(n), GoLeft(), GoRight(), GoLeftMost(), GoRightMost(), GoFirstEditCol(): These methods offer more specialized navigation, like moving to a specific filtered row or navigating horizontally.
Analogy: These are like the steering wheel, pedals, gear shift, and GPS of your car. They allow you to control where you are in the data (the road).
4. Selection Management (Row Selection and Multiselect):
Select( nOperation ), SelectAll(), SelectNone(), SelectRow( nOperation ), IsSelectedRow(): These methods are focused on row selection, especially in multi-select mode. Select() is the core method, with others being convenience wrappers.
SetMultiSelectCol( uCol, lFooter ): Enables multi-selection and links it to a specific column, triggering the use of the selection methods.
Analogy: These are like the car's seatbelt and door locks – features that manage how you interact with the car's contents (data).
5. Editing and Data Modification:
Edit(), EditSource(), EditBrowse(), EditDateTime(): These methods provide different ways to edit data, typically in modal dialogs or in-place (depending on column settings). Edit() acts as a dispatcher, choosing the appropriate editing method.
CancelEdit(): Cancels any ongoing edit operation.
Delete( lMsg ): Deletes the currently selected record.
SaveData( lRefresh ): Saves changes made during editing back to the data source.
ArrCellSet(), ArrCell(): Methods for direct manipulation of array data source cells.
Lock(), UnLock(): Methods for controlling data modification by locking/unlocking the browse.
Analogy: These are like the tools you use to repair or modify your car – wrenches, paintbrushes, etc. They allow you to change the data (car's components).
6. Display and Appearance Methods:
Display(), Paint(), Refresh( lComplete ), RefreshCurrent(), RefreshHeaders(), RefreshFooters(), DrawBorder(), DrawLine(), EraseData(), FullPaint(): These methods are responsible for rendering the browse control visually. Refresh() is the main method for redrawing, while others handle specific parts of the display or optimize refresh operations.
SetStyle(), SetDarkTheme(), SetFont(), FontSize(), SetRecSelBmp(), SetRecSelSl(), SetBackGround(), SetColor(), SetGroupHeader(), SetGroupTotal(), SetMultiSelectCol(), SetChecks(), SetProgBar(): These methods control the visual appearance of the browse, including styles, colors, fonts, bitmaps, and various display elements.
ShowMessage(), CloseMessage(): Methods for displaying and closing temporary message boxes within the browse.
DrawChart(), DrawChartInRect(), PaintBmpAndText(), PaintHeader(), PaintFooter(), PaintHDivider(), PaintVDivider(), PaintTopBar(), PaintCellBack(), PaintCell(), PaintCellBtn(), PaintCellImage(), PaintCellBarCode(): These are lower-level painting methods used internally by Paint() to draw specific elements of the browse, like headers, footers, cells, bitmaps, and various visual styles.
Analogy: These are like the paint job, interior design, and lights of your car – everything that makes it look and present information to the user.
7. Exporting Methods:
ToExcel(), ToXlsx(), ToCalc(), ToWord(), ToHTML(), ToCSV(), ToArray(), ClpRow(), Copy(): These methods provide ways to export the data displayed in the browse to various formats.
Analogy: These are like the car's ability to transport cargo – taking the data (cargo) and putting it in a different format (destination).
8. Event Handling Methods:
HandleEvent(), HandleGesture(), GesturePan(), LButtonDown(), LButtonUp(), MouseMove(), LDblClick(), RButtonDown(), MouseWheel(), KeyDown(), KeyChar(), MouseLeave(), NcMouseMove(): These methods handle various Windows messages and events, allowing the TXBrowse to respond to user interactions (mouse clicks, keyboard input, scrolling, gestures) and system events.
Analogy: These are like the car's sensors and controls that respond to the driver's actions and the environment.
9. Utility/Helper Methods:
MakeBlock(), ArrCalcWidths(), CalcHdrHeight(), CalcRowSelPos(), Check_oSeek(), CheckSize(), ColStretch(), DestroyToolTip(), ColAtPos(), ColPos(), SelectedCol(), IsDisplayPosVisible(), LastDisplayPos(), GetDisplayCols(), GetDisplayColsWidth(), GetPaintCols(), Eval(), SafeEval(), BrwFitSize(), CancelEdit(), CheckSortCbx(), DelRepos(), DrawLine(), EraseData(), GetDlgCode(), HasBorder(), LButtonDown(), LButtonUp(), MouseMove(), LDblClick(), RButtonDown(), MouseWheel(), HorzLine(), MouseAtHeader(), MouseAtFooter(), MouseColPos(), MouseRowPos(), EraseData(), KeyDown(), KeyChar(), HScroll(), VScroll(), VUpdatePos(), VUpdateAll(), VSetPos(), VThumbPos(), VGetPos(), VGetMax(), VGoDown(), VGoUp(), VGetThumbPos(), VGoBottom(), VGoTop(), GetDisplayCols(), GetVisibleCols(), GetDisplayColsWidth(), IsDisplayPosVisible(), LastDisplayPos(), BrwWidth(), GridWidth(), BrwHeight(), HeaderHeight(), FooterHeight(), CalcHdrHeight(), RowCount(), FirstRow(), LastRow(), FooterRow(), DataHeight(), BrwFitSize(), CancelEdit(), Check_oSeek(), SetSortBmp(), AutoFit(), CheckSize(), Resize(), Change(), MakeTotals(), SaveTotals(), ReCalcTotals(), Eval(), Report(), ToWord(), ToHTML(), ToCSV(), ToExcel(), ToXlsx(), ToCalc(), ToArray(), CurrentRow(), AddBitmap(), aBitmap(), Initiate(), Display(), Paint(), DrawBorder(), CheckSortCbx(), GetPaintCols(), PaintHDivider(), PaintVDivider(), PaintHeader(), PaintTopBar(), PaintFooter(), Refresh(), CalcRowSelPos(), DelRepos(), KeyCount(), BookMark(), KeyNo(), Skip(), Bof(), Eof(), GoTop(), GoBottom(), GoUp(), GoDown(), PageUp(), PageDown(), GoLeft(), GoRight(), GoLeftMost(), GoRightMost(), GoFirstEditCol(), HandleEvent(), HandleGesture(), GesturePan(), KeyCount(), BookMark(), KeyNo(), Skip(), Bof(), Eof(), GoFltRow(), SaveState(), RestoreState(), OldRestoreState(), Lock(), UnLock(), SaveData(), ShowSeek(), Seek(), Adjust(), Check_oSeek(), SetSortBmp(), AutoFit(), CheckSize(), Resize(), Change(), MakeTotals(), SaveTotals(), ReCalcTotals(), Eval(), Report(), ToWord(), ToHTML(), ToCSV(), ToExcel(), ToXlsx(), ToCalc(), ToArray(), CurrentRow(), AddBitmap(), aBitmap(), Initiate(), Display(), Paint(), DrawBorder(), CheckSortCbx(), GetPaintCols(), PaintHDivider(), PaintVDivider(), PaintHeader(), PaintTopBar(), PaintFooter(), Refresh(), CalcRowSelPos(), DelRepos(), KeyCount(), BookMark(), KeyNo(), Skip(), Bof(), Eof(), GoTop(), GoBottom(), GoUp(), GoDown(), PageUp(), PageDown(), GoLeft(), GoRight(), GoLeftMost(), GoRightMost(), GoFirstEditCol(), HandleEvent(), HandleGesture(), GesturePan(): A massive category of internal helper methods used for various tasks like calculations, drawing, size adjustments, event handling, and data manipulation. They are not typically called directly by users but are essential for the internal workings of TXBrowse.
Analogy: These are like the nuts, bolts, wires, and smaller components that make up the car's engine, chassis, and electrical system. They are essential for the car to function correctly, but you don't interact with them directly as a driver.
10. Accessor Methods (SET/GET for DATA members):
Many DATA members have associated ACCESS and ASSIGN methods (often INLINE) that provide controlled access to their values. For example, lSeekBar, lGetBar, l2007, lFlatStyle, l2000, lMultiSelect, lIncrSearch, BookMark, KeyNo, Skip, Bof, Eof, GoFltRow, SaveState, RestoreState, OldRestoreState, Lock, UnLock, SaveData, ShowSeek, Seek, Adjust, Check_oSeek, SetSortBmp, AutoFit, CheckSize, Resize, Change, MakeTotals, SaveTotals, ReCalcTotals, Eval, Report, ToWord, ToHTML, ToCSV, ToExcel, ToXlsx, ToCalc, ToArray, CurrentRow, AddBitmap, aBitmap, Initiate, Display, Paint, DrawBorder, CheckSortCbx, GetPaintCols, PaintHDivider, PaintVDivider, PaintHeader, PaintTopBar, PaintFooter, Refresh, CalcRowSelPos, DelRepos, KeyCount, BookMark, KeyNo, Skip, Bof, Eof, GoTop, GoBottom, GoUp, GoDown, PageUp, PageDown, GoLeft, GoRight, GoLeftMost, GoRightMost, GoFirstEditCol, HandleEvent, HandleGesture, GesturePan().
Analogy: These are like the car's gauges and controls on the dashboard. They allow you to monitor and adjust certain aspects of the car's behavior (browse control's properties).
Interrelationships in Action (Example Workflow):
Let's consider a user sorting a TXBrowse by clicking a header:
User Clicks Header: Mouse click event is captured by HandleEvent().
Header Click Detection: MouseAtHeader() determines the click is in the header area and identifies the clicked column.
Sorting Initiation: HeaderLButtonUp() is called for the clicked column (TxBrwColumn object).
SetOrder() is Called: The SetOrder() method of the TxBrwColumn is invoked, which:
Determines the sort order (ascending/descending).
Updates the cOrder DATA member of the column.
Calls the SetOrder() method of the TXBrowse class.
SetOrder() in TXBrowse Class:
Calls SortArrayData() (if array data source) or initiates SQL sorting (if RDD/SQLRDD).
Sets the lAutoSort flag to .T..
Sets the aSortBmp bitmaps to indicate sort order in header.
Refresh() is Called: Triggers a full refresh of the browse to reflect the sorted data.
Paint() is Called: Redraws the entire browse control, including the sorted data and sort indicator bitmaps in the header.
This example illustrates how various methods from different categories work together to handle a single user action. Many other workflows, like navigation, editing, and filtering, involve similar interactions between different sets of methods.
This detailed breakdown should provide a better understanding of how the numerous methods within the TXBrowse class are interconnected and contribute to its overall functionality. Let me know if you have any specific methods or categories you'd like to explore further!