Page 1 of 35 123411 ... LastLast
Results 1 to 40 of 1392

Thread: VBFlexGrid Control (Replacement of the MSFlexGrid control)

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,450

    VBFlexGrid Control (Replacement of the MSFlexGrid control)

    This project is intended to replace the MSFlexGrid control for VB6.

    The "MSFLXGRD.OCX" can be replaced completly.

    Even though some enhancements of the MSHFlexGrid control are included, it can't replace it completly (yet).
    But there are also new features included that are not available on both MSFlexGrid and MSHFlexGrid.

    The VBFlexGrid supports Unicode, is DPI-Aware and ready for 64-bit.

    At design-time (IDE) there is only one dependency. (OLEGuids.tlb)
    This is a modified version of the original .tlb from the vbaccelerator website.
    But for the compiled .exe there are no dependencies, because the .tlb gets then compiled into the executable.

    In order to use the DataSource/DataMember property a reference to msdatsrc.tlb (pre-installed since Win2k) is required.

    Everything should be self explained, because all functions and properties have a description.

    The source code of the project can also be viewed on GitHub.

    ActiveX Control version, together with a Registration-Free (Side-by-side) solution:
    Version 1.7

    Notes:
    - When using the SetParent or MoveWindow API, pass .hWndUserControl and not .hWnd.
    - When changing the "Project Name", have all forms open, else all properties are lost. Because the library to which the controls are referring to is the "Project Name" itself. Having all forms open will ensure that the .frx files will be updated with the new "Project Name".

    List of revisions:
    Code:
    18-Jun-2024
    - Optimized the TextArray property.
    11-Jun-2024
    - Invoke .Clear after row/col setup on set of .DataSource. (like MS(H)FlexGrid)
    - Remove .FlexDataSource when setting .DataSource. (like vsFlexGrid)
    09-Jun-2024
    - Support of the VP_FORMATRANGE message. (like MS(H)FlexGrid and vsFlexGrid)
      This allows for easy rendering for page print (and multi-page) incl. print preview.
      https://www.vbforums.com/showthread.php?752333-VB6-Simple-EMF-based-FlexPrint-Reporting-(incl-Print-Preview)
    30-May-2024
    - Improvement in the "capture mouse move" scroll.
      The "down" and "right" scroll build up acceleration due to MouseRow/MouseCol.
      However, the "up" and "left" scroll was too simple and just did a single line scroll.
      Now the number of lines are calculated based on the distance and edge of fixed rows/cols.
      So, all directions behave and feel now the same for the user.
    11-Apr-2024
    - Return key will be forwarded according to DirectionAfterReturn property after editing. (like as the TabBehavior property)
    29-Mar-2024
    - Included the MimicTextBox and ColMimicTextBox/ColMimicTextBoxFixed property. (Defaults to False)
      DT_EDITCONTROL will mimic the text-displaying characteristics of a multiline text box. This includes to break on characters instead on words.
      This is only meaningful if the word wrap property is set to true.
      The main benefit is to have no drawing difference anymore when editing a cell.
    11-Mar-2024
    - Included the LookupConv function which returns a converted lookup string of the current or a specified column.
      Use either FlexLookupConvValue or FlexLookupConvKey. (new enum)
    18-Feb-2024
    - Included the DragRow/DragCol function used to rearrange rows/cols by dragging the specified row/col with the mouse to a new position.
      To note is that this is NOT an OLE drag/drop operation and the function will enter a modal message loop to just return the new moved position.
      Example code: .RowPosition(i) = .DragRow(i)
      The demo project is updated to use this new function.
    - Combo list locked (not clickable) when it has no items.
      This avoids release of mouse capture when clicking inside a no items drop-down list. Just like a ComboBox does.
    09-Feb-2024
    - Included enum FlexDirectionAfterReturnEdit/FlexEditReasonReturn.
      By this the edit mode is initiated by the return key, but only when shift state is 0.
      It is intentionality included in the DirectionAfterReturn property to not
      change default behavior and it's logical because you can either move the cursor or start edit mode, but not both.
    02-Feb-2024
    - Space/BackSpace key now only invoke cell editing when shift state is 0.
    - Space key now only invoke cell checkbox check when shift state is 0.
    30-Jan-2024
    - Included the OLEDragDropScrollOrientation property which can be 0 - Horizontal, 1 - Vertical or 2 - Both (default).
    - Included the IncrementalSearch event.
    - WM_CANCELMODE will now cancel the incremental search, if applicable.
    29-Jan-2024
    - Included the CanPaste function. The Paste method pastes only when there is a text format available in the clipboard.
    - Included the IncrementalSearchTime run-time property.
    - Included the AllowDropFiles property and DropFiles event.
    24-Jan-2024
    - Label tips now updated to cell font over which it is displayed to have an perfect overlay.
      Info and scroll tips remain on the standard default font of the tool tip.
    23-Jan-2024
    - FlexClearText for the .Clear method can now be used even when a custom data source is set.
    - Added FlexClearClip enum (clip range) which the .Delete method now uses instead of FlexClearSelection.
    - Added FlexClipPasteModeExtended/FlexClipPasteModeExtendedAutoSelection enum.
      If ClipPasteMode is >= Extended then FlexClearClip deletes also the extended selection. (opposite action)
    11-Jan-2024
    - ReaderMode shows now a half blended cursor image indicating the anchor position. (like in WordPad)
    10-Jan-2024
    - Included the AllowReaderMode property. (auto-scrolling and panning)
      It defaults to False, when set to True it uses the DoReaderMode API upon WM_MBUTTONDOWN.
    09-Jan-2024
    - WM_MOUSEHWHEEL support. (horizontal mouse wheel)
    30-Dec-2023
    - Const VARIANT_CB now 24 instead of 16 for Win64.
    12-Dec-2023
    - Included the ColCheckBoxesHitTestInvisible/ColCheckBoxesHitTestInvisibleFixed run-time property.
      It determines whether check boxes are visible but not hit-testable. (cannot interact with mouse cursor)
      This can be useful for representation only check boxes (e.g. FlexTextAsCheckBox) where hot-light is not needed and CellClick (etc.) events should fire.
      However, this does not avoid changing the checked state by space key.
      To avoid that use the FlexDisabled* checked states or set Cancel = True on the CellBeforeCheck event.
    09-Dec-2023
    - Fixed that no invalidation occurs when setting Rows/Cols to 0. (regression 13-Nov-2023)
    - Included the ClearRowInfo/ClearColInfo method which clears the info structure for the specified row/column.
      An index of -1 will clear the info structure for all rows/columns.
    02-Dec-2023
    - Included the SelectAll method which is useful to call for providing a Ctrl + A feature within the KeyDown event.
    14-Nov-2023
    - Added enum 4 - Extended for the ClipCopyMode property. (and 5,6,7 for Fixed* variants)
      This is useful for FreeByRow, FreeByColumn selection mode or for AllowMultiSelection.
      The extended clip copy mode contains the visual selection and not the technical single selection.
    13-Nov-2023
    - No crash anymore in internal AddSelectedRows/RemoveSelectedRows when grid is empty. (AllowMultiSelection property)
    - No illogical Row/Col combination (e.g. -1/0) possible anymore when grid is empty. (Rows = 0 or Cols = 0)
      Such combination could occur when changing for example FixedRows and Rows is > 0 but Cols still 0.
    07-Nov-2023
    - Included the ComboButtonNonClientWidth/ComboButtonNonClientHeight property.
    - Exposed the GetGridLineOffsets method which retrieves the grid line offsets between cells. (optional row/col subscripts)
      The internal method got renamed to GetGridLineOffsetsStruct.
    03-Nov-2023
    - Edge case bugfix in the CopyFromRecordset function and minor tweaks.
    02-Nov-2023
    - Included the CopyFromRecordset function which copies the contents of an ADO or DAO Recordset onto the flex grid.
      It works like the Excel function which returns the number of fetched records and copies from the current position to EOF.
      The number of maximum rows and columns can be specified.
      If omitted it is maximum remaining rows and columns that the grid can receive relative to the destination starting point.
      The grid will not grow and it just ignores the overflow of rows and columns. (like Excel)
      The destination row/col can be specified where the pasting onto the flex grid starts.
      If omitted it is the first non-fixed row and first non-fixed column.
    30-Oct-2023
    - Divider resize drag will not be applied anymore when the divider drag never moved. (like MS(H)FlexGrid)
      This solves also the problem with FlexRowSizingModeUniform and double click divider to auto size.
    28-Oct-2023
    - Changing SelectionMode property does not reset selection anymore. (like MS(H)FlexGrid)
      However, at design-time it still does change and reset the selection.
    26-Oct-2023
    - Included the InsertMark/InsertMarkMode run-time property.
      The InsertMarkMode can be set to 0 - ByRow (default) or 1 - ByColumn.
    - Included the HitTestInsertMark function which returns the insert mark row or column.
    - Included the InsertMarkColor property.
    25-Oct-2023
    - Included the DropHighlight/DropHighlightMode run-time property.
      The DropHighlightMode can be set to 0 - ByRow (default) or 1 - ByColumn.
    24-Oct-2023
    - Internal DrawCellCheckBox function now clipped to the cell rect boundaries.
    - Included the OLEDragDropScroll property which defaults to True.
    23-Oct-2023
    - Internal GetBestWidth/GetBestHeight doesn't measure anymore hidden text.
      Text can become hidden by FlexTextAsCheckBox or by an image list.
    - Added enum FlexCellTextHidden for the Cell property. (read-only)
    - Added enum FlexCellHasCustomFormatting/FlexCellHasTag for the Cell property.
      It returns True if memory is allocated. Set to False to release the memory or True to force allocation.
    22-Oct-2023
    - Included the ColImageList As Variant property. (like in vsFlexGrid)
      Either an ImageList object or an hImageList handle can be set. (vsFlexGrid allows only handle)
      Numeric text will be treated as an image index. (both, object or handle)
      Otherwise it will be tried to access the image index by it's key. (object only)
      The image alignment is based on the text alignment. (CellAlignment/ColAlignment/FixedAlignment)
      The cell text will become hidden if an image got drawn.
    - Included the CellImageCallback event where the app can provide the image value.
      The Handled parameter must be set to True to overwrite the default behavior.
      It enables also a way to ensure that no image will be tried to retrieve for certain cells. (e.g. for fixed rows)
    20-Oct-2023
    - Included enum FlexAlignmentGeneralTop/FlexAlignmentGeneralCenter/FlexAlignmentGeneralBottom.
      The enum FlexAlignmentGeneral keeps valid and is the default column alignment value.
    19-Oct-2023
    - Included the CellTag property which holds a variant to store any extra data.
      The variant is allocated only when needed to keep memory usage low.
    - Included enum FlexClearTag for the .Clear method.
    - Included enum FlexCellTag for the .Cell property.
    09-Oct-2023
    - Bugfix for CellLeft/ClientLeft and WS_EX_LAYOUTRTL. (Container vs. Control)
    05-Oct-2023
    - Changing TopRow/LeftCol by app code now works even when there are no scrollbars. (like in vsFlexGrid)
      It can be considered a mis-behavior in the MS(H)FlexGrid that this is not possible.
      This allows to sync column scroll to a footer style grid that has no scrollbars.
    04-Oct-2023
    - Included the ColWordWrapOption/ColWordWrapOptionFixed run-time property.
      This allows to change per column of how text is displayed. Like in the MSHFlexGrid.
      Enum FlexWordWrapOptions: 0 - None (default), 1 - WordBreak, 2 - SingleLine and more..
    02-Oct-2023
    - Included the ClientLeft/ClientTop and ClientWidth/ClientHeight read-only/run-time property.
    01-Oct-2023
    - Linefeed character (Ctrl+Enter) now allowed for incremental searches.
    - Backspace character now allowed for incremental searches.
      It undoes the last typed letter. Continuing to hit the backspace key takes you back farther.
    - Enhanced the internal DrawIncrementalSearch method so it can highlight multiple lines of word break text. (recursion)
    28-Sep-2023
    - Included the BeforeClipboardAction/AfterClipboardAction event.
      Enum 'FlexClipboardActionConstants' included to distinguish between Copy, Cut, Paste and Delete.
      The BeforePaste/AfterPaste event got removed.
    - RowData/ColData property now 'As LongPtr' instead of 'As Long'.
    27-Sep-2023
    - Included the BeginIncrementalSearch/EndIncrementalSearch event.
      The BeginIncrementalSearch event is fired initially to customize behavior. (row/col, case sensitive, no wrap etc.)
      Or the Cancel parameter can be used to disallow incremental search for a specific row/col.
      EndIncrementalSearch event is fired when the search has elapsed or ended.
      Now BeginIncrementalSearch can be fired again.
    - Included IncrementalSearchString/IncrementalSearchRow/IncrementalSearchCol run-time property.
    25-Sep-2023
    - Included the BeforePaste/AfterPaste event.
    - Included the ParseClip/ConstructClip function.
      ParseClip will parse a clip string into an two-dimensional array.
      ConstructClip will construct a clip string from an two-dimensional array.
    - Info and label tips now only shown when hit result is the cell content.
      Thus a tool tip will not overlap anymore when the mouse is over a combo cue, check box etc.
    - Bugfix in the Clip property when ClipPasteMode = FlexClipPasteModeAutoSelection and ClipMode = FlexClipModeExcludeHidden.
    23-Sep-2023
    - Included the AllowIncrementalSearch property.
    - Included optional argument TextDisplay in the FindItem function.
    - Added enum FlexFindDirectionRight/FlexFindDirectionLeft for the FindItem function.
    16-Sep-2023
    - Replaced 'Partial As Boolean' argument to 'Match As FlexFindMatchConstants' in the FindItem function.
      Enums are FlexFindMatchExact, FlexFindMatchPartial, FlexFindMatchStartsWith, FlexFindMatchEndsWith.
      vbTrue will be handled as FlexFindMatchPartial for compatibility.
    14-Sep-2023
    - Usage of hashes for the keys in the ColLookup property.
      This ensure no more exponential performance decrease when there are more than 10 lookup entries.
    13-Sep-2023
    - Included the WallPaper/WallPaperAlignment property. (like in vsFlexGrid)
    07-Sep-2023
    - Included the ColComboCue property. (order is CellComboCue > ColComboCue > ComboCue)
      ColComboCue excludes for fixed rows. Use the CellComboCue to fill the gap, if necessary.
    - Added enum FlexComboCueHidden.
      This may be useful to exclude cells in a ColComboCue via CellComboCue. (e.g. frozen row)
    06-Sep-2023
    - Included the EditLocked property.
    03-Sep-2023
    - Included the ColLookup property used to map keys to associated values.
      This is useful for translating database values to user-friendly descriptions.
      Example: (it can be used also without a combo list)
      ColLookup(i) = ";NULL|0;|1;Full time|2;Part time|3;Contractor|4;Other"
      ColComboItems(i) = "|Full time|Part time|Contractor|Other"
      If a cell text is "3" then .Cell(FlexCellTextDisplay) will return "Contractor".
      Choosing "Contractor" in the combo drop-down will put a cell text of "3".
    01-Sep-2023
    - Bugfix that LBN_SELCHANGE handler got misplaced in WM_COMMAND. (regression since 03-Nov-2021)
      This resulted that arrow keys in the combo box did not update the edit text!
    31-Aug-2023
    - ColComboMode precede over ComboMode now. (like in vsFlexGrid)
      This is now in sync as other properties. (e.g. ColComboButtonAlignment over ComboButtonAlignment)
    29-Aug-2023
    - Bugfix that the edit control back color did not consider the BackColorAlt property.
    - Certain run-time properties now throw error 5 to avoid mis-use instead of silently doing nothing.
    28-Jul-2023
    - Bugfix in the ComboListIndex property that the new selection was not commited to the edit control.
    22-Jul-2023
    - Minor behavior bugfix for SelectionMode ByRow/ByColumn in relation to MS(H)FlexGrid.
    15-Jul-2023
    - FlexSortCustom now uses a indirect MergeSort instead of BubbleSort. (like FlexSortCustomText)
      It is a bit slower than the normal MergeSort but compared to BubbleSort very fast.
    08-Jul-2023
    - CompareText event args fixed.
    07-Jul-2023
    - Modified OLEGuids.tlb as following: (compiled with same uuid)
      - replaced LPSTR and LPWSTR to LONG StrPtr() to get compatibility with x64 OLEGuids twinBASIC package.
      Unregister to old OLEGuids.tlb is not necessary, just overwrite the file.
    01-Jul-2023
    - PtInRect/LBItemFromPt/ChildWindowFromPoint API and code adaptions so it can be migrated to x64 more easily.
    30-Jun-2023
    - Missing invalidation fixed in the ColCheckBoxes property.
    29-Jun-2023
    - Memory leak fixed in the CellPicture property.
      This is related to 26-Jun-2023 update.
    28-Jun-2023
    - Bugfix in the drawing of the text styles.
    26-Jun-2023
    - Major memory reduction for default formatted cells.
      Once a cell gets custom formatted additional memory will be allocated.
      It can only be freed by removing those cells or call .Clear method with FlexClearFormatting or FlexClearEverything.
    - Major performance boost for AddItem/RemoveItem method.
      The TCOL elements are now moved by the pointers only and not by copying the content over.
    24-Jun-2023
    - Major performance boost for InplaceMergeSort/BubbleSortIter (.Sort) and .RowPosition property.
      The TCOL elements are now swapped by the pointers only and not by copying the content over.
    23-Jun-2023
    - Bugfix in the CellFloodColor property.
    20-Jun-2023
    - Memory consumption of TCELL struct reduced from 64 bytes to 52 bytes.
    15-Jun-2023
    - Bugfix for FlexCheckBoxAlignmentRightCenter.
    13-Jun-2023
    - FlexComboModeCalendar now behaves like FlexComboModeDropDown when the edit control has ES_READONLY.
      It means always immediately popup of the calendar and commit on a date click.
    11-Jun-2023
    - No crash anymore for a NULL StrPtr() in EM_REPLACESEL. (EditSelText/FlexEditReasonBackSpace)
      Though, the fix concerns only Windows XP or below.
    31-Mar-2023
    - Included ComboButtonClientWidth read-only property.
    - Included ComboButtonWidth/ColComboButtonWidth run-time property.
    28-Mar-2023
    - Included ComboButtonPicture/ColComboButtonPicture run-time property which allows to customize the appearance of cell combo buttons.
      Only applicable if the combo button draw mode property is set to 0 - Normal and the combo mode property is set to 3 - Button.
    - Included Row/Col and Cancel parameter in the ComboButtonOwnerDraw event.
    13-Mar-2023
    - Included CheckBoxDrawMode run-time property and corresponding CheckBoxOwnerDraw event.
    - Bugfix for FlexDisabledChecked when visual styles are off.
    28-Feb-2023
    - Added enum FlexCellTextDisplay for the Cell property.
    - Included the FixedFormat property.
      It defaults to vbNullString (StrPtr() = 0) and thus inherits from ColFormat.
      Use "" to disable formatting for fixed cells in a column.
    22-Feb-2023
    - Included ColCheckBoxes property. (As Boolean; added CLIS_CHECKBOXES)
      This allows a column to have predefined check boxes. (FlexNoCheckBox -> FlexUnchecked; fixed rows excluded)
    - Included GetChecked/SetChecked to the IVBFlexDataSource2 interface.
      Added FlexDataSourceChecked enum to FlexDataSourceFlags.
      Only those columns with CLIS_CHECKBOXES will fetch from the custom data source.
    - Added FlexNoCheckBoxEver enum to FlexCheckBoxConstants.
      This allows to have no check box for individual cells even when ColCheckBoxes is set to True. (e.g. for frozen rows)
    08-Feb-2023
    - Internal 'UpdateEditRect' now takes the window sizes into account.
      This makes it possible to use it not only for scroll updates but to use it also for other cases.
      To call UpdateEditRect from outside just use the .Refresh method.
    - Bugfix when canceling the BeforeUserResize event to return ProcessLButtonDown = True.
    04-Feb-2023
    - Included the ShowScrollTips property.
      Use the ScrollTip event and ScrollTipText run-time property.
      The scroll tip appears at the original thumb position and does not follow the thumb as the user scrolls.
      If you prefer otherwise set the ScrollTipFollowThumb property to True.
    28-Jan-2023
    - Included the ColResizable/RowResizable property. (As Boolean; added CLIS_NOSIZING/RWIS_NOSIZING)
    - Added FlexDataSourceNoData enum to FlexDataSourceFlags.
    25-Jan-2023
    - Added FlexRowSizingModeUniform enum to FlexRowSizingModeConstants.
      Included related RowHeightUniform run-time property. The default value is -1 as disabled alias.
      A uniform row height is applicable for all rows that do not have a specific height assigned to them.
    23-Jan-2023
    - Included ColCheckBoxAlignment/FixedCheckBoxAlignment property.
      ColCheckBoxAlignment defaults to FlexCheckBoxAlignmentUsePictureAlignment.
      FixedCheckBoxAlignment defaults to -1 and thus inherits from ColCheckBoxAlignment.
    21-Jan-2023
    - Added FlexDataSourceUnboundFixedColumns enum to FlexDataSourceFlags.
    20-Jan-2023
    - Setting FlexDataSource will predefine the column keys. (.ColKey(i) property, like vsFlexGrid)
    - Included the IVBFlexDataSource2 interface that can be implemented in addition to the primary IVBFlexDataSource interface.
      The new interface enables some further enhancements, but it may be extended in future releases.
    18-Jan-2023
    - Included the ColNullable property. (As Boolean; added CLIS_NULLABLE)
      Setting ADO DataSource will predefine the information only property.
    11-Jan-2023
    - Added FlexTextAsCheckBox/FlexDisabledTextAsCheckBox enum to FlexCheckBoxConstants.
      This maps the cell text to a check box state dynamically.
      Empty text (like DBNull) as grayed state, else text to boolean conversion to either checked or unchecked state.
      The application is responsible to react on CellCheck event to update the cell text to the new state.
      Furthermore the cell text gets hidden/not drawn. Also the label info is as if the cell has no text.
    
    [...]
    
    14-Jun-2017
    - First release.
    Name:  VBFlexGridDemo.jpg
Views: 2173
Size:  93.6 KB
    Attached Files Attached Files
    Last edited by Krool; Yesterday at 10:56 AM.

  2. #2

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,450

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    List of enhancements and improvements in relation to the MSFlexGrid and/or MSHFlexGrid control:
    Code:
    - Scrolling beyond 65,535 rows possible. (16-bit barrier in MSHFlexGrid)
    - Changing TopRow/LeftCol property possible even when there are no scroll bars. (limitation in MSFlexGrid and MSHFlexGrid)
    - MouseWheel can be used to scroll. (limitation in MSFlexGrid and MSHFlexGrid)
    - Horizontal MouseWheel supported.
    - AllowReaderMode property included to support reader-mode for auto-scrolling and panning.
    - No cell count limit of 350000, only available memory space determines the cell count limit. (limitation in MSFlexGrid)
    - FrozenRows/FrozenCols property included.
    - AllowUserFreezing property included.
    - AfterUserFreeze event included.
    - RowSizingMode property included. (like in MSHFlexGrid)
    - Align property included.
    - DisableNoScroll property included.
    - Added the Col param in the Compare event as it helps when doing multi-column sorts.
    - WM_ERASEBKGND can be intercepted in a subclass to fill a custom background, if necessary.
    - BackColorAlt property included to set alternate row back colors. (setting BackColor automatically sets BackColorAlt to the same value)
    - DoubleBuffer property included.
    - RightToLeft property included.
    - AllowMultiSelection property included with related RowSelected/SelectedRow/SelectedRows property.
    - AllowSelection property included.
    - TabBehavior property included.
    - DirectionAfterReturn property included.
    - WantReturn property included.
    - ExtendLastCol property included.
    - SheetBorder property included. (Default is True to behave like MSFlexGrid else no border like MSHFlexGrid)
    - WrapCellBehavior property included.
    - ClipSeparators property included.
    - ClipSeparatorCol/ClipSeparatorRow property (run-time only) included to change the defaults and to support more than 1 character for a separator.
    - ClipMode property included to include (default) or exclude hidden cells in a clip command.
    - ClipCopyMode property included to determine what parts are copied to the clipboard or returned by a clip command.
    - ClipPasteMode property included to determine how content is pasted from the clipboard or by doing a clip command.
    - ParseClip/ConstructClip function included. (parse/construct clip string into an/from an two-dimensional array)
    - BeforeClipboardAction/AfterClipboardAction event included.
    - ShowInfoTips, ShowLabelTips and CellToolTipText property included.
    - ShowScrollTips property included with related ScrollTip event and ScrollTipText property. (run-time only)
    - ScrollTipFollowThumb property included.
    - ScrollTrack property included.
    - EllipsisFormat/EllipsisFormatFixed property included.
    - ColImageList property included (Variant, either control or handle) and related CellImageCallback event.
    - ColWordWrapOption/ColWordWrapOptionFixed property included. (like in MSHFlexGrid)
    - MimicTextBox and ColMimicTextBox/ColMimicTextBoxFixed property included.
    - Dashes/Dots enum included in the GridLine property. (like in MSHFlexGrid)
    - FontFixed property included. (like in MSHFlexGrid)
    - GridLineWidthFixed property included. (like in MSHFlexGrid)
    - FixGridLineOffsets property included.
    - MirrorAlignGeneral property included.
    - SingleLine property included.
    - Flat enum included in the FocusRect property.
    - Cell property included which allows to get or set cell settings directly for an arbitrary cell or range of cells without selecting them.
    - CellTextStyle returns the TextStyle/TextStyleFixed from the Control when not preset instead of 0.
    - CellAlignment returns the alignment from the column (ColAlignment or FixedAlignment) when not preset instead of 0.
    - CellBackColor/CellForeColor returns the BackColor/ForeColor from the Control when not preset instead of 0.
    - CellTextStyle/CellAlignment/CellBackColor/CellForeColor are not preset anymore when setting a value of -1.
    - CellChecked property for checkboxes along with CellBeforeCheck/CellCheck event.
    - ColCheckBoxAlignment/FixedCheckBoxAlignment/ColCheckBoxes property included.
    - ColCheckBoxesHitTestInvisible/ColCheckBoxesHitTestInvisibleFixed property included. (cannot interact with mouse cursor)
    - CheckBoxDrawMode property included and corresponding CheckBoxOwnerDraw event.
    - ColWidthMin property included. (analogous to the RowHeightMin property)
    - RowHeightMax/ColWidthMax property included.
    - RowHeightUniform (run-time only) property included. (for use with FlexRowSizingModeUniform)
    - MouseEnter/MouseLeave event included.
    - HitTest method included with a specified X and Y. The return values are in the HitRow/HitCol/HitRowDivider/HitColDivider/HitResult property.
    - DragRow/DragCol function used to rearrange rows/cols by dragging the specified row/col with the mouse to a new position.
    - OLEDragDropScroll/OLEDragDropScrollOrientation property included.
    - DropHighlight/DropHighlightMode property (run-time only) included.
    - InsertMark/InsertMarkMode property (run-time only) included.
    - HitTestInsertMark function included with a specified X and Y and optional After parameter.
    - InsertMarkColor property included.
    - FindItem function included.
    - FixedAlignment property accepts an index of -1 (like ColAlignment) to apply the value to all columns.
    - FixedAlignment is not preset anymore when setting a value of -1.
    - Mouse cursor is now clipped when user resizing rows and columns.
    - CellHasCustomFormatting/CellHasTag property which returns True if memory is allocated. Set to False to release the memory or True to force allocation.
    - CellTag property which holds a variant to store any extra data.
    - CellEnsureVisible method included with optional visibility parameter. (default is FlexVisibilityCompleteOnly)
    - BottomRow/RightCol property included with optional visibility parameter. (default is FlexVisibilityPartialOK)
    - RowsVisible/ColsVisible/FixedRowsVisible/FixedColsVisible/FrozenRowsVisible/FrozenColsVisible property with an optional visibility parameter. (default is FlexVisibilityCompleteOnly)
    - RowIsVisible/ColIsVisible property optional visibility parameter included. (default is FlexVisibilityPartialOK)
    - RowHidden/ColHidden property included. (same as RowHeight/ColWidth set to 0, but this approach preserves the original setting)
    - ColKey/ColIndex and RowID/RowIndex property included. (used to identify specified column/row)
    - ColDataType/ColNullable/ColNumericPrecision/ColNumericScale/ColDataCapacity property included.
    - ColResizable property included.
    - ColLookup property and LookupConv function included.
    - ColFormat/FixedFormat property included.
    - RowsPerPage/ColsPerPage property included that returns the number of non-fixed columns/rows displayed on the current page to scroll through. (no visibility parameter here)
    - GetSelRange method included to retrieve selection range of cells ordered so that Row1 <= Row2 and Col1 <= Col2.
    - SelectRange method which selects a range of cells or a cell (by omitting RowSel/ColSel) with a single command.
    - SelectAll method which selects all cells with a single command.
    - GetMergedRange method included to retrieve the merged cells on a given row/col.
    - SelChange event is also fired while the user extends the selection with the mouse. (limitation in MSFlexGrid and MSHFlexGrid)
    - Scroll event is fired whenever the TopRow/LeftCol property changes. (limitation in MSFlexGrid and MSHFlexGrid)
    - BeforeUserResize/AfterUserResize/AfterUserResizeEnd event included.
    - BeforeRowColChange/BeforeSelChange event included.
    - Copy/Cut/Paste/Delete method, AutoClipboard property and BeforeClipboardAction/AfterClipboardAction event.
    - Clear method optional Where/What parameter included.
    - ClearRowInfo/ClearColInfo method to clear the info structure. An index of -1 will clear the info structure of all rows/columns.
    - When MergeCells is set to a value other than 0 (Never), selection highlighting is still possible. (limitation in MSFlexGrid and MSHFlexGrid)
    - MergeCells can span multiple rows and columns together. (limitation or bug in MSFlexGrid and MSHFlexGrid)
    - FixedOnly enum included in the MergeCells property.
    - UseColSort enum included in the Sort property and corresponding ColSort property included.
    - ColSortArrow/ColSortArrowAlignment/ColSortArrowColor property included.
    - SortArrowColor/RowSortArrows property included.
    - CurrencyAscending/CurrencyDescending and DateAscending/DateDescending enum included in the Sort/ColSort property.
    - CellFloodPercent/CellFloodColor/FloodColor property included.
    - AutoSize method included.
    - BestFitMode property included which is used for AutoSize/FormatString.
    - WallPaper/WallPaperAlignment property included.
    - AllowIncrementalSearch property included with events and run-time properties. (incremental search functionality)
    - TextWidth/TextHeight function included.
    - DividerDblClick event included.
    - DataRefresh method included.
    - FlexDataSource property (run-time only) included to set a custom data source via the IVBFlexDataSource interface.
    - AllowUserEditing property included with events and run-time properties. (in-cell editing functionality)
    - AllowScrollLock property to check the toggled state of vbKeyScrollLock to let the users use the arrow keys to scroll. (like in Excel)
    - Some other minor improvements.
    List of incompatibilities in relation to the MSFlexGrid control:
    Code:
    - FontWidth and CellFontWidth property not implemented.
    Last edited by Krool; Mar 29th, 2024 at 01:12 PM.

  3. #3
    Addicted Member
    Join Date
    May 2016
    Location
    China
    Posts
    197

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Very much and need this OCX to support print preview and paging? There is a great need for this feature: you can directly set the image read from the database and display it in each cell.
    QQ: 289778005

  4. #4

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,450

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by ChenLin View Post
    Very much and need this OCX to support print preview and paging?
    There will be no OCX for the moment as I want to wait a certain period for potential bugfixes etc. (trial period)
    You can make your own Print Preview. You can extract via the .Picture property a StdPicture object which holds a "printed" content of the grid.
    However it prints always the whole grid (like in MSFlexGrid). However, when there is a need to include optional parameters to "print" only a part (e.g. current view) then we can look further.
    What do you mean by paging?
    Again this is certainly a job for the app to break according to printer settings etc.

  5. #5
    Addicted Member
    Join Date
    May 2016
    Location
    China
    Posts
    197

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Paging I have done using SQL SERVER, the main thing is to show the image in the database, MSHFLEXGRID is not very convenient to display the image in the database.
    QQ: 289778005

  6. #6
    PowerPoster ChrisE's Avatar
    Join Date
    Jun 2017
    Location
    Frankfurt
    Posts
    3,074

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Hello Krool,

    I just tried your VBFlexGrid, I was surprised how easy it was to change
    my code from MsFlexGrid to VBFlexgrid. And the Project executed with now faults.

    here is what I tried out and what I had to change, I marked my changes
    like this:
    '// had to change this
    '.CellAlignment = flexAlignCenterCenter
    '// to :

    in Modul:
    Code:
    Option Explicit
    
    Public Sub KalenderFlexShow(Flex As VBFlexGrid, Jahr As Long)
       Dim i As Long, j As Long
       Dim Days As Long
       Dim Datum As Date
          With Flex
             .Redraw = False
             .Rows = 33
             .Cols = 14
             .FixedCols = 0
             .FixedRows = 2
             .Clear
             .TextMatrix(0, 0) = CStr(Jahr - 1)
             .TextMatrix(1, 0) = MonthName(12)
             For i = 1 To 12
                .TextMatrix(0, i) = CStr(Jahr)
                .TextMatrix(1, i) = MonthName(i)
             Next
             .TextMatrix(0, 13) = CStr(Jahr + 1)
             .TextMatrix(1, 13) = MonthName(1)
             .Row = 0
             For i = 0 To .Cols - 1
                .Col = i
                '// had to change this
                '.CellAlignment = flexAlignCenterCenter
                '// to :
                .CellAlignment = FlexAlignmentCenterCenter
             Next
             For i = 1 To 12
                KalenderFlexMonat Flex, i, Jahr, i
             Next
             KalenderFlexMonat Flex, 12, Jahr - 1, 0
             KalenderFlexMonat Flex, 1, Jahr + 1, 13
             If Jahr = Year(Now) Then
                .Col = Month(Now)
                .Row = Day(Now) + 1
             ElseIf (Jahr = Year(Now) - 1) And (Month(Now) = 12) Then
                .Col = 0
                .Row = Day(Now) + 1
             ElseIf (Jahr = Year(Now) + 1) And (Month(Now) = 1) Then
                .Col = 13
                .Row = Day(Now) + 1
             Else
                .Col = 1
                .Row = 0
             End If
             .Redraw = True
          End With
    End Sub
    
    Private Sub KalenderFlexMonat(Flex As VBFlexGrid, Monat As Long, _
                                  Jahr As Long, Col As Long)
    
       Dim Days As Long, i As Long
       Dim Datum As Date
       Dim s As String
          Datum = DateSerial(Jahr, Monat, 1)
          Days = Day(DateAdd("m", 1, Datum) - 1)
          With Flex
             .Col = Col
             For i = 1 To Days
                .Row = i + 1
                s = Format(i, "00") & Space(2)
                If Weekday(Datum, vbMonday) = 7 Then
                   s = s & Format(Datum, "ddd")
                   .CellForeColor = vbRed
                Else
                   s = s & Format(Datum, "ddd")
                   .CellForeColor = vbBlack
                End If
                .Text = s
               '// had to change this
                '.CellAlignment = flexAlignLeftCenter
                '// to :
                .CellAlignment = FlexAlignmentLeftCenter
                Datum = Datum + 1
             Next
          End With
    End Sub
    in Form:
    Code:
    Option Explicit
    Private Sub Command1_Click()
       Dim s As String
          s = InputBox("Jahr eingeben", "Kalender", Year(Now))
          If Len(s) = 0 Then
             Exit Sub
          ElseIf Not IsNumeric(s) Then
             Exit Sub
          End If
          KalenderFlexShow VBFlexGrid1, Val(s)
    End Sub
    
    Private Sub Form_Load()
          With VBFlexGrid1
           '  .FocusRect = flexFocusHeavy
             .FocusRect = FlexFocusRectHeavy
             .BackColorBkg = Me.BackColor
             .AllowBigSelection = False
            ' .SelectionMode = flexSelectionFree
             .SelectionMode = FlexSelectionModeFree
          End With
          KalenderFlexShow VBFlexGrid1, Year(Now)
    End Sub
    
    Private Sub Form_Resize()
          If Me.WindowState = vbMinimized Then
             Exit Sub
          End If
          On Error Resume Next
          With VBFlexGrid1
             .Top = 300
             .Left = 0
             .Width = Me.ScaleWidth
             .Height = Me.ScaleHeight - .Top
          End With
          On Error GoTo 0
    End Sub
    I haven't looked threw your complete List of enhancements and improvements
    but for the first test I am impressed!!!!!!!

    regards
    Chris

  7. #7
    PowerPoster
    Join Date
    Jun 2015
    Posts
    2,224

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    2 questions:
    Are you going to implement data binding?
    How would you implement a virtual/on demand data source?

  8. #8

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,450

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by DEXWERX View Post
    2 questions:
    Are you going to implement data binding?
    How would you implement a virtual/on demand data source?
    It is planned to be implemented.

    1. Making the UserControl.DataBindingBehavior set to 'vbComplexBound' and provide a 'DataSource' and 'DataMember' property. (like in MSHFlexGrid, only ADO)
    However, that needs to include the 'msdatsrc.tlb' type library and expose its DataSource interface. (=Dependency; as exposed publicly)
    So I need to check if there would be no issue to make such a "dependency" with the 'msdatasrc.tlb' type library. It is part of MDAC, which should be pre-installed since Windows 2000. Or am I wrong?

    2. Providing a run-time .Recordset property (Also like in MSHFlexGrid, could be 'As Object' thus supporting both DAO and ADO Recordsets)
    Last edited by Krool; Jun 20th, 2017 at 04:29 PM.

  9. #9
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    6,072

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    I'm using the vsFlexGrid control and this control has quick access to ranges of cells to change the layout and content.
    So instead of settings ROW, COL, ROWSEL, COLSEL and FILLSTYLE you just specify the range of the cells on which a method is executed, advantage that you don't have to change the active selection to modify cell content/layout.

    Idea for vbFlexGrid replacements for Cell* with Range* like:
    RangeFontBold(Row1, Col1, Row2, Col2)
    RangeForeColor(Row1, Col1, Row2, Col2)

    PS
    The vsFlexGrid control uses a different method using a single .Cell() method, in which you also specify what you want to do.

  10. #10

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,450

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by Arnoutdv View Post
    So instead of settings ROW, COL, ROWSEL, COLSEL and FILLSTYLE you just specify the range of the cells on which a method is executed, advantage that you don't have to change the active selection to modify cell content/layout.
    Good idea, thanks. Update released.

    Included the Cell property which allows to get or set cell settings directly for an arbitrary cell or range of cells without selecting them.
    However, when setting a range of cells via the Cell property it is dependent like in the normal Cell* properties how the FillStyle property is defined.
    So if FillStyle is Single you can select a range via the Cell property it will only set the arbitrary cell and not the selection. (Exception is when setting the Clip property via the Cell property)

  11. #11
    PowerPoster ChrisE's Avatar
    Join Date
    Jun 2017
    Location
    Frankfurt
    Posts
    3,074

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Hello Krool

    would it make sense to Hardcode some Funtions in the Grid ?

    like the Routine I used to create the Calendar, you would the just call somthing like

    Code:
      VBFlexGrid1.KalenderFlexShow,Year(Now)
    in regards to loading Data from a Database, I would do the same thing
    one for ADO Recordsets and one for DAO.

    something like this..
    Code:
    'ADO Version
    Public Function FlexFillFromRs(Rs As ADODB.Recordset, _
                                   Flex As MSFlexGrid)
    'loading Recordset
       Dim i As Long
       Dim j As Long
       Dim breit As Single
          
          With Flex
             .Redraw = False
             .AllowBigSelection = True
             .AllowUserResizing = flexResizeBoth
             .Appearance = flex3D
             .FocusRect = flexFocusNone
             .FixedRows = 1
             .FixedCols = 1
             'count cols
             .Cols = Rs.Fields.Count
             'Headers
             For i = 0 To Rs.Fields.Count - 1
                .TextMatrix(0, i) = Rs.Fields(i).Name
             Next
             'count rows
             .Rows = .FixedRows + Rs.RecordCount + 1
                                                          
             'fill Flex
             Do While Not Rs.EOF
                'Records
               i = Rs.AbsolutePosition
                For j = 0 To Rs.Fields.Count - 1
                   'Abfrage auf NULL
                   If Not IsNull(Rs.Fields(j).Value) Then
                      .TextMatrix(i, j) = Rs.Fields(j).Value
                   End If
                Next
                Rs.MoveNext
             Loop
             
             'optimise width
             For i = 0 To .Cols - 1
                breit = 0
                For j = 0 To .Rows - 1
                   If Me.TextWidth(.TextMatrix(j, i)) > breit Then
                      breit = Me.TextWidth(.TextMatrix(j, i))
                   End If
                Next
                .ColWidth(i) = breit + 120
             Next
             .Redraw = True
          End With
    End Function
    then you would just have to pass a valid ADO Recordset and Connection to the Grid like..

    Code:
     VBFlexGrid1.FlexFillFromRs(myADORecordset)
    just an Idea

    regards
    Chris

  12. #12
    Frenzied Member
    Join Date
    Dec 2008
    Location
    Melbourne Australia
    Posts
    1,487

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    I just downloaded and tried - VERY NICE
    There may be quite a few of us that don't need Unicode, and thus may not have bothered downloading your contribution.
    However if the title of your thread had been -
    VBFlexGrid User Control (Replacement of the MSFlexGrid control)
    And there had been a bit more emphasis on NO DEPENDENCIES
    I would have downloaded it before the ink on your OP had dried

    Thanks for sharing,
    Rob
    PS The Printscreen to Clipboard ain't too shabby either

  13. #13
    PowerPoster ChrisE's Avatar
    Join Date
    Jun 2017
    Location
    Frankfurt
    Posts
    3,074

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    I would have downloaded it before the ink on your OP had dried
    I agree;-))

  14. #14

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,450

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by Bobbles View Post
    There may be quite a few of us that don't need Unicode, and thus may not have bothered downloading your contribution.
    However if the title of your thread had been -
    VBFlexGrid User Control (Replacement of the MSFlexGrid control)
    And there had been a bit more emphasis on NO DEPENDENCIES
    I would have downloaded it before the ink on your OP had dried
    It is not only for Unicode. For me personally it was important to get some annoying bugs fixed and be indepedent of any OCX. And of course the additional features.
    For the thread title: UserControl would be even more directly, True. But I want to keep the wording dual-use as after this Std-EXE version there will also be an ActiveX Version (OCX), after a certain trial period.

  15. #15
    PowerPoster
    Join Date
    Jun 2015
    Posts
    2,224

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    can you add a VirtualMode to the demo when it's ready?

    ie: let's say you're scrolling through a half a million records, but you really only want to provide the data to the control when it's scrolled into view.

  16. #16
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,307

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by DEXWERX View Post
    can you add a VirtualMode to the demo when it's ready?

    ie: let's say you're scrolling through a half a million records, but you really only want to provide the data to the control when it's scrolled into view.
    To properly implement that, I'd suggest the exact same Interface (also IID-wise), as the vsFlexGrid is using
    (IVSFlexDataSource, ...it is a nice and small one - despite being universal for all kinds of "Data with Header-Descriptions"):

    Code:
    [
      odl,
      uuid(8E203240-537D-11D3-BD8C-000000000000),
      dual,
      oleautomation
    ]
    interface IVSFlexDataSource : IUnknown {
        [id(0x00000001)]
        HRESULT GetFieldCount([out, retval] long* pFields);
        [id(0x00000002)]
        HRESULT GetRecordCount([out, retval] long* pRecords);
        [id(0x00000003)]
        HRESULT GetFieldName(
                        [in] long Field, 
                        [out, retval] BSTR* pFieldName);
        [id(0x00000004)]
        HRESULT GetData(
                        [in] long Field, 
                        [in] long Record, 
                        [out, retval] BSTR* pData);
        [id(0x00000005)]
        HRESULT SetData(
                        [in] long Field, 
                        [in] long Record, 
                        [in] BSTR newData);
    };
    In the vsFlexGrid, VB6-Classes which implement it, are then used together with the vsFG.FlexDataSource-Property (of Type IVSFlexDataSource),
    to address external Data of DAO-, ADO- or SQLite-Recordsets, or just plain String- or Variant-Arrays outside the Control.

    Note that the vsFlexGrid.FlexDataSource-Prop is exposed as only a Get/Let-pair (just mentioning it,
    since that might irritate some VB6-devs, because it's a bit unusual, not being allowed to use a Property Set
    when passing an Object into a Control (so, perhaps best, to implement it as a "full VB6-Triple-Prop" Get/Let/Set)...

    Olaf

  17. #17

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,450

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by Schmidt View Post
    To properly implement that, I'd suggest the exact same Interface (also IID-wise), as the vsFlexGrid is using
    (IVSFlexDataSource, ...it is a nice and small one - despite being universal for all kinds of "Data with Header-Descriptions"):

    Code:
    [
      odl,
      uuid(8E203240-537D-11D3-BD8C-000000000000),
      dual,
      oleautomation
    ]
    interface IVSFlexDataSource : IUnknown {
        [id(0x00000001)]
        HRESULT GetFieldCount([out, retval] long* pFields);
        [id(0x00000002)]
        HRESULT GetRecordCount([out, retval] long* pRecords);
        [id(0x00000003)]
        HRESULT GetFieldName(
                        [in] long Field, 
                        [out, retval] BSTR* pFieldName);
        [id(0x00000004)]
        HRESULT GetData(
                        [in] long Field, 
                        [in] long Record, 
                        [out, retval] BSTR* pData);
        [id(0x00000005)]
        HRESULT SetData(
                        [in] long Field, 
                        [in] long Record, 
                        [in] BSTR newData);
    };
    In the vsFlexGrid, VB6-Classes which implement it, are then used together with the vsFG.FlexDataSource-Property (of Type IVSFlexDataSource),
    to address external Data of DAO-, ADO- or SQLite-Recordsets, or just plain String- or Variant-Arrays outside the Control.

    Note that the vsFlexGrid.FlexDataSource-Prop is exposed as only a Get/Let-pair (just mentioning it,
    since that might irritate some VB6-devs, because it's a bit unusual, not being allowed to use a Property Set
    when passing an Object into a Control (so, perhaps best, to implement it as a "full VB6-Triple-Prop" Get/Let/Set)...
    Good suggestion, thanks. But exposing an type lib interface with a public property brings type lib dependency in a later potential OCX...

    IMO would be a simple classic "event mechanism" for virtual data be sufficient? or would I overlook something in that case?
    Or put the type lib interface in a "like-wise" VB6 class.

  18. #18
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,307

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by Krool View Post
    Good suggestion, thanks. But exposing an type lib interface with a public property brings type lib dependency in a later potential OCX...

    IMO would be a simple classic "event mechanism" for virtual data be sufficient? or would I overlook something in that case?
    Or put the type lib interface in a "like-wise" VB6 class.
    The latter one (a simple interface-defining VBClass with the name IVSFlexDataSource would be sufficient) -
    I've just looked into our Project-Codes, the implementing Classes are all quite small Private ones in our Projects,
    so the exact same IID of the original Interface wouldn't be that important in our cases as I thought,
    just "Signature compatibility" would be enough).

    A (Latebound working) Event-mechanism could also do (performance not being such a critical factor here,
    since the "visible Rows and Cols" of the currently scrolled "ViewPort" are not all that many...

    In case of an (then earlybound) true Interface-Class, you could also enclose the points where you expect an "IVSFlexDataSource"-
    implementing Object in compiler-conditionals (#If CompileWithFlexDataSourceSupport .... or something, in the non-OCX-version).

    Olaf

  19. #19

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,450

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by Schmidt View Post
    A (Latebound working) Event-mechanism could also do (performance not being such a critical factor here,
    since the "visible Rows and Cols" of the currently scrolled "ViewPort" are not all that many...
    When there is a "search" trough a find function does it callback all items via GetData or is there is special callback (like LVN_ODFINDITEM style) where the client is responsible to return the found row/index?

  20. #20
    PowerPoster
    Join Date
    Jun 2015
    Posts
    2,224

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    I've always had to code custom search/find for the MSHFlexGrid anyway. (not sure)
    For efficiency I would think the LVN_ODFINDITEM approach would be best.

  21. #21

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,450

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by DEXWERX View Post
    I've always had to code custom search/find for the MSHFlexGrid anyway. (not sure)
    For efficiency I would think the LVN_ODFINDITEM approach would be best.
    And the same for a Sort?

  22. #22
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,307

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by Krool View Post
    And the same for a Sort?
    I'd not bother with Find and Sort (delegations) in case of external FlexDataSource-Data.

    The reason a developer is working with such an external DataSource is (beside others),
    that he probably wants to sort, filter, search the external containers much more comfortably (and faster) on their own
    (without any "help from a Grid-control").

    A Grid is mainly for managing and rendering the ViewPort, nothing much else.

    If I want external Data sorted in the vsFlexGrid I do it on the Rs or the Array itself -
    and then refresh the DataSource (which in this case only enforces a new rendering of the viewport).

    Olaf

  23. #23

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,450

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by Schmidt View Post
    I'd not bother with Find and Sort (delegations) in case of external FlexDataSource-Data.

    The reason a developer is working with such an external DataSource is (beside others),
    that he probably wants to sort, filter, search the external containers much more comfortably (and faster) on their own
    (without any "help from a Grid-control").

    A Grid is mainly for managing and rendering the ViewPort, nothing much else.

    If I want external Data sorted in the vsFlexGrid I do it on the Rs or the Array itself -
    and then refresh the DataSource (which in this case only enforces a new rendering of the viewport).
    Exactly. Just like in a ListBox with LBS_NODATA it is not possible to add LBS_SORT.
    Therefore in the FlexGrid the .FindItem and .Sort functionality just needs to be "disabled" by an error raise in case VirtualMode is turned on. (=Solved)

  24. #24
    PowerPoster
    Join Date
    Jun 2015
    Posts
    2,224

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    That works, and is in line with how MS handled mshflxgd also.

  25. #25

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,450

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    One further question for VirtualMode layout.
    What Schmidt suggested for the FlexDataSource interface means actually always 1 fixed row (field name) and 0 fixed columns.
    The GetFieldCount method would define the number of columns and the GetRecordCount the number of rows.
    However, that means I also need to disable the Rows/Cols and FixedRows/FixedCols properties.
    OR instead they are allowed (flexible) and just a 'RetrieveVirtualItem' event would be fired for all cells in viewport, regardless if they are 2 fixed rows or none. I think that would be a very flexible approach?

  26. #26
    PowerPoster
    Join Date
    Jun 2015
    Posts
    2,224

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    yes, you definitely don't want to lock fixed cells.
    Fixed cells are often used for row numbers or other indicators, which also need to be populated in virtualmode.

    It's a good idea to use the event/callback for all cells including fixed.

    you could also use a single call for the entire window update - as opposed to each cell. (just an idea)

  27. #27
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,307

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by Krool View Post
    The GetFieldCount method would define the number of columns and the GetRecordCount the number of rows.
    However, that means I also need to disable the Rows/Cols and FixedRows/FixedCols properties.
    OR instead they are allowed (flexible) and just a 'RetrieveVirtualItem' event would be fired for all cells in viewport, ...
    Sure, the vsFlexGrid allows free settings on the FixedRows/FixedCols also in "FlexDataSource"-mode...
    (the FixedRows-setting not affecting the Zerobased "Record-Param" which is passed into the Callback).

    Code:
    Private Function IVSFlexDataSource_GetData(Byval Field As Long, ByVal Record As Long) As String
      IVSFlexDataSource_GetData = RsSQLite.ValueMatrix(Record, Field) 'example for providing the Data from an SQLite-Recordset
    End Function
    It's just that the CallBack-Function in IVSFlexDataSource will be called for *only* the currently *visible* cells
    of the (potentially scrolled) Viewport-area (leaving "skipped gaps" between the zerobased FixedCol-indexes and the
    Col (Field) indexes of the scrollable Cells).

    You have to manage these "skips" internally when raising your Event or Callback (so that the Callback is not
    called unnecessarily for any cells which are currently not scrolled into the ViewPort).

    Olaf

  28. #28

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,450

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Updated released.

    Included the DataSource/DataMember property. The properties can be set at design-time and/or at run-time.
    The Adodc control, an DateEnvironment designer and a ordinary ADODB.Recordset object have been tested and are thus supported.

    If somebody don't want to use the new feature and want to avoid a reference to msdatsrc.tlb (pre-installed since Win2k) the whole thing can be turned off by setting the new conditional compilation constant 'ImplementDataSource' to False.
    When doing so (turn off) the 'DataBindingBehavior' might be changed back from 'vbComplexBound' to 'vbNone'.

    What is still missing is a run-time only 'Recordset' property. (like in MSHFlexGrid)
    But here I am still uncertain of how to best implement it and if and how to interact with the now implemented 'DataSource' property.

  29. #29
    Addicted Member
    Join Date
    May 2016
    Location
    China
    Posts
    197

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    This OLEGuids.tlb is 32 and cannot be referenced in win10 64.
    QQ: 289778005

  30. #30

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,450

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by ChenLin View Post
    This OLEGuids.tlb is 32 and cannot be referenced in win10 64.
    Did you put the OLEGuids.tlb in the SysWOW64 system folder?
    Also try to reference the file with Browse..

  31. #31
    Addicted Member
    Join Date
    May 2016
    Location
    China
    Posts
    197

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by Krool View Post
    Did you put the OLEGuids.tlb in the SysWOW64 system folder?
    Also try to reference the file with Browse..
    That's already done, but still not. The prompt version is incompatible, unable to register, and cannot refer to this TLB in VB6K.
    I referenced other OLEGuids.tlb, except for the function of "Show Property Pages".
    QQ: 289778005

  32. #32

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,450

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by ChenLin View Post
    That's already done, but still not. The prompt version is incompatible, unable to register, and cannot refer to this TLB in VB6K.
    I referenced other OLEGuids.tlb, except for the function of "Show Property Pages".
    Which other OLEGuids?
    In case you have multiple versions you can name this version OLEGuids2 and reference accordingly.
    This version is equal to the ComCtls version.
    Last year there was a new version released with new uuid. If you have an older version you might "unregister" that first.
    Last edited by Krool; Jul 24th, 2017 at 12:17 AM.

  33. #33
    Hyperactive Member
    Join Date
    Feb 2014
    Posts
    282

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Actually, I also have problem registering OLEGuids.tlb on Win10 x64.

    Name:  OLEGuids.jpg
Views: 30850
Size:  40.6 KB

  34. #34

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,450

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Regsvr32 is wrong. Just let VB register it.
    There is a also a tool for registeeing type libs (and unregister)
    http://www.vbaccelerator.com/home/VB...y/article.html

  35. #35
    Hyperactive Member
    Join Date
    Feb 2014
    Posts
    282

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Oh, I did not know VB can register it. I just tried and it works.

    I also use CCRP Reg Util to register tlb (it has a choice for tlb) and it works on Win7 but not on Win10.

  36. #36

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,450

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by chosk View Post
    Oh, I did not know VB can register it. I just tried and it works.
    Glad to hear. Does the vbAccelerator tool also work?

  37. #37
    Hyperactive Member
    Join Date
    Feb 2014
    Posts
    282

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    The vbAccelerator tool... I tried download on 2 computers but file is invalid.

  38. #38
    Hyperactive Member
    Join Date
    Feb 2014
    Posts
    282

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    I found it in my backup. I have forgotten I downloaded perhaps years back.

    It can register but unregister gives a 8002801C error.

  39. #39
    Addicted Member
    Join Date
    May 2016
    Location
    China
    Posts
    197

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by Krool View Post
    Which other OLEGuids?
    In case you have multiple versions you can name this version OLEGuids2 and reference accordingly.
    This version is equal to the ComCtls version.
    Last year there was a new version released with new uuid. If you have an older version you might "unregister" that first.
    TLB the problem is solved, and I did this: use this TLB to override the TLB in the system.
    QQ: 289778005

  40. #40
    Addicted Member
    Join Date
    May 2016
    Location
    China
    Posts
    197

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by chosk View Post
    Actually, I also have problem registering OLEGuids.tlb on Win10 x64.

    Name:  OLEGuids.jpg
Views: 30850
Size:  40.6 KB
    Try my way: use this TLB to override the TLB in the system
    QQ: 289778005

Page 1 of 35 123411 ... LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width