-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
[built-in drop-down-listings]
Quote:
Originally Posted by
Krool
What do you mean exactly?
I've not played around with the newer versions of the VBFlexGrid, but it seems (from the ScreenShots),
that ComboList-DropDown-areas can be shown when interacting with the Grid...
My suggestion was, to not show "normal Combo-Dropdown-areas", but instead show your own Popup-Window,
which doesn't contain a DropDown-Listing via CommonControls-functionality (or whatever is in use currently),
but instead shows a (VB-)PopUp-Window, with a dynamically created extra-Instance of the VBFlexGrid on it
(to easier support Multi-Column-DropDowns).
As for the vsFlex... and its Button- and DropDown-support...
This always seemed to me, like it didn't get much love from the developers (after the main-functionality was finished) -
meaning that it could be done nicer ... so, implementing it exactly as in the vsFlex would be worthwhile only,
when "strict vsFlex-compatibility" is a long-term-goal...
Olaf
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Hello,
I am using this control without problems in Windows 7 and Windows 10 64-bit.
But I found an error 50003 when using thsi control with Windows 10 Pro 32-bit.
Could you check this and make a new release?
Quote:
Originally Posted by
Krool
This project is intended to replace the MSFlexGrid control for VB6.
The "MSFLXGRD.OCX" can be replaced completly.
Even though some enhancements of the MS
HFlexGrid 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 and is
DPI-Aware.
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.2
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".
- In order to trap error raises via "On Error Goto ..." or "On Error Resume Next" it is necessary to have "Break on Unhandled Errors" selected instead of "Break in Class Module" on Tools -> Options... -> General -> Error Trapping.
List of revisions:
Code:
20-May-2019
- Removed ComboEditable/ColComboEditable as it got replaced by ComboMode/ColComboMode and ComboItems/ColComboItems.
- New ComboMode/ColComboMode property with FlexComboModeConstants
- FlexComboModeNone -> No combo button, normal editing.
- FlexComboModeDropDown -> Allows to modify by drop-down list only.
- FlexComboModeEditable -> Allows to modify by edit and drop-down list.
- New ComboItems/ColComboItems property that defines the list items to be used when ComboMode is DropDown or Editable.
19-May-2019
- Bugfix in the Picture property. (related to 08-May-2019 update)
- Combo button window now drawm themed, if applicable.
18-May-2019
- Bugfix concerning RightToLeftLayout for in-cell editing combo button and combo list window.
- Combo button window is now being hot-tracked.
16-May-2019
- Renaming of properties related to 15-May-2019 update:
- ComboList -> ComboEditable
- ColComboList -> ColComboEditable
- ComboItem -> ComboList
- ComboCount -> ComboListCount
- ComboIndex -> ComboListIndex
- Incremental search now enabled for the drop-down list when editing a cell.
15-May-2019
- Renaming of properties related to 13-May-2019 update
- EditDropDownList -> ComboList
- EditDroppedDown -> ComboDroppedDown
- hWndEditButton -> hWndComboButton
- hWndEditList -> hWndComboList
- Included ComboCount/ComboItem/ComboIndex run-time property that are valid when using drop-down combo lists.
- Included ComboDropDown/ComboCloseUp event.
- Included ColComboList run-time property. It works similar to the ComboList property, except it applies to entire columns.
14-May-2019
- Eliminated run-time limitation of no support for having fixed cell(s) without cell(s). (e.g. FixedRows = 1 and Rows = 1)
13-May-2019
- Included the EditDropDownList/EditDroppedDown run-time property that allows to use a drop-down list when editing a cell.
10-May-2019
- Finetuning concerning RightToLeftLayout for in-cell editing window.
09-May-2019
- Bugfix related to 08-May-2019 update.
08-May-2019
- Major drawing performance boost. (~20%)
07-May-2019
- Bugfix related to 06-May-2019 update concerning in-cell editing window.
06-May-2019
- When in-cell editing window is scrolled off then any key input will now bring it back into view.
- Included WS_CLIPCHILDREN on VBFlexGridWndClass creation.
05-May-2019
- Included enum FlexSelectionModeFreeByRow and FlexSelectionModeFreeByColumn in the SelectionMode property.
01-May-2019
- Row/Col params in the BeforeEdit event now ByRef instead ByVal.
25-Apr-2019
- Finetuning with WM_NCCALCSIZE/WM_NCHITTEST/WM_NCPAINT for in-cell editing window.
23-Apr-2019
- Bugfix in the internal FlexTopParentValidateControls function.
17-Apr-2019
- Bugfix related to 15-Apr-2019 update when scrolling while editing fixed cells.
- Finetuning with EM_SETMARGINS for in-cell editing window.
15-Apr-2019
- Scrolling will now update the in-cell editing window accordingly.
13-Apr-2019
- Included the in-cell editing functionality.
- AllowUserEditing property.
- StartEdit/CancelEdit/CommitEdit method. (works even if AllowUserEditing is False)
- BeforeEdit/EnterEdit/ValidateEdit/LeaveEdit/AfterEdit events.
- EditSetupStyle/EditSetupWindow/EditQueryClose/EditChange/EditKeyDown/EditKeyUp/EditKeyPress events.
- hWndEdit/EditRow/EditCol/EditReason/EditCloseMode read-only run-time property.
- EditText/EditMaxLength/EditSelStart/EditSelLength/EditSelText run-time property.
- Included the IMEMode property.
- Included the GetMergedRange method.
12-Apr-2019
- Merged cells are now able to fetch custom data source 'FlexDataSource'.
11-Apr-2019
- Minor modification in the internal ProcessKeyDown method.
10-Apr-2019
- Minor modification in the WM_LBUTTONDOWN handler.
04-Apr-2019
- Included optional parameter Row and Col in the CellEnsureVisible method.
So instead the current cell an arbitrary cell can now be ensured to be visible, scrolling if necessary.
03-Apr-2019
- Bugfix in CellWrapBehavior property.
It didn't work as expected when there were hidden or zero height/width rows/cols.
02-Apr-2019
- Bugfix in FormatString property when no alignment prefix for a column was specified.
FlexAlignmentGeneral is now used then instead of FlexAlignmentLeftCenter.
26-Mar-2019
- Minor bugfix in the WM_MOUSEACTIVATE handler.
24-Mar-2019
- Compatibility fix for the CellWidth/CellHeight property.
18-Mar-2019
- Internal performance improvement.
10-Mar-2019
- Improvement in VTableHandle.bas concerning 'DeactivateIPAO'.
02-Mar-2019
- More user friendly behavior when SelectionMode is ByRow/ByCol and pressing cursor keys.
26-Feb-2019
- Included the CellClick and CellDblClick event.
30-Jan-2019
- CellPicture property can now render 32bpp alpha bitmaps.
23-Jan-2019
- VBA bugfix.
17-Jan-2019
- Improvement in VTableHandle.bas concerning 'DeactivateIPAO'.
09-Nov-2018
- Internal improvement concerning design-mode handling.
26-Oct-2018
- Bugfix related to 25-Oct-2018 update.
- Minor internal improvements.
25-Oct-2018
- Internal improvement concerning divider drag of the last row or col.
09-Oct-2018
- WM_SYSKEYDOWN/WM_SYSKEYUP considered now for KeyDown/KeyUp events.
04-Oct-2018
- RowID/RowIndex property included. The usage is similar to the ColKey/ColIndex property.
RowIndex returns a row given its ID, whereas RowID returns/sets the ID given its row.
27-Sep-2018
- Included the SingleLine property.
12-Sep-2018
- Included optional argument Direction in the FindItem function. Also FindItem cannot be used anymore on a fixed row.
11-Sep-2018
- Included the FlexDataSource property (run-time only) to set a custom data source which fetches data from the IVBFlexDataSource interface.
It comes along with several limitations (e.g. cannot use .Sort) and the behavior/definitions are similar to the IVSFlexDataSource from VSFlexGrid.
- Included the DataRefresh method which forces the control to re-fetch all data from its data source. (and/or custom data source)
- Included optional argument Wrap in the FindItem function.
- The AddItem method now respects the ClipMode property setting.
04-Sep-2018
- Included optional argument ExcludeHidden in the FindItem function.
- Added WS_EX_TRANSPARENT for the internal tooltip control which solved two issues:
- The control did not receive focus when clicking on a tip from another control.
- In Win10 the mouse wheel will scroll even if the mouse hovers over a tip. (in-place tip)
03-Sep-2018
- Bugfix in the Cell property for FlexCellSort setting.
27-Aug-2018
- Further optimization of the internal GetHitTestInfo function.
26-Aug-2018
- Major performance boost for internal GetHitTestInfo function.
12-Aug-2018
- TEXTMETRIC structure was declared as ANSI. Fixed to WIDE version.
Unicode did not lack due to this bug, but it was a memory risk as WIDE version is larger than ANSI.
28-Jul-2018
- Internal GDI leak fixed. (forgot to restore old font handle in a hDCScreen)
09-Jul-2018
- Bugfix in the WrapCellBehavior property. Bug only affected when SelectionMode was ByRow or ByColumn.
02-May-2018
- Renamed enum 'FlexClipModeIncludeHidden' to 'FlexClipModeNormal'.
- Included optional argument ExcludeHidden in the AutoSize method.
22-Apr-2018
- Included the ClipMode property that controls whether to include or exclude hidden cells in a clip command.
20-Apr-2018
- Internal bugfix in page scroll up and down in relation to zero width rows.
- WM_LBUTTONDOWN intercepted (no MouseDown event) in case of divider row/col dragging.
This is the same behavior as in the original MS(H)FlexGrid.
16-Apr-2018
- Bugfix in the CellFontName property, related to update on 05-Dec-2017. (This bug had only effect when FillStyle is set to FlexFillStyleRepeat)
14-Mar-2018
- Optimized the divider row/col dragging.
- Included the HitRowDivider/HitColDivider property which returns the divider row/col from the last invoked .HitTest.
The divider row/col contains already the necessary offset for FlexHitResultDividerRowTop and FlexHitResultDividerColumnLeft.
In addition the offset includes hidden rows/cols. (zero width rows/cols are not offset to preserve MSFlexGrid compatibility)
13-Mar-2018
- Included the DividerDblClick event.
09-Mar-2018
- Bugfix related to custom sorting bugfix on 08-Mar-2018.
08-Mar-2018
- Critical bugfix for custom sorting. (FlexSortCustom)
- Included enum FlexSortCurrencyAscending/FlexSortCurrencyDescending and FlexSortDateAscending/FlexSortDateDescending in Sort/ColSort property.
04-Mar-2018
- Bugfix in VTableHandle.bas related to 25-Feb-2018 update. (concerns unload stability in IDE only)
25-Feb-2018
- Major internal improvement in the VTableHandle.bas concerning IOleInPlaceActiveObject.
20-Feb-2018
- Unicode support when generating ASCII key combos, e.g. ALT + 3333.
11-Feb-2018
- Included the AutoSize method.
23-Jan-2018
- Included the TextWidth/TextHeight function that calculates for the current or an arbitrary cell the width and height length.
For multiline text the heights are cumulated and for the width the line with the greatest width is taken. Similar to VB.Form's TextWidth function.
21-Dec-2017
- Improved the WM_MOUSEWHEEL handler for fine-grained wheel changes.
09-Dec-2017
- Improved VTableHandle.bas so it does not crash anymore when using VBCCRxx.OCX and VBFLXGRDxx.OCX in paralell. (concerns ActiveX control only)
05-Dec-2017
- Major performance fix. (Caused by update on 23-Nov-2017)
- Bugfix in the CellFontName property.
A change will now overwrite the CellFontCharset settings.
23-Nov-2017
- Final tweak to run in the VBA environment. (meaningful for OCX only)
22-Nov-2017
- Minor internal improvements.
18-Nov-2017
- Bugfix for generic sorting.
27-Oct-2017
- Again minor tweaks to run better in the VBA environment. (meaningful for OCX only)
20-Oct-2017
- Minor tweaks to run better in the VBA environment. (meaningful for OCX only)
26-Sep-2017
- Included the BeforeMouseDown event.
The event is identical as in the MouseDown event, but an additional Cancel parameter allows you to prevent the default processing.
22-Sep-2017
- Minor bugfix in the internal GetHitTestInfo function.
19-Sep-2017
- Included the FormatString property.
- Bugfix that the FixedAlignment returned not the ColAlignment when not preset.
- FixedAlignment accepts now a value of -1 so that it is not preset anymore.
17-Sep-2017
- The Rows/Cols property can now be set lower or equal to the FixedRows/FixedCols property without raising an error.
Like in the MS(H)FlexGrid the FixedRows/FixedCols property will be adjusted then accordingly.
02-Sep-2017
- The Font property is not written to the property bag anymore when it equals to Ambient.Font.
Included new function OLEFontIsEqual in Common.bas.
01-Sep-2017
- Included the ClipSeparators property which enables to define two custom distinct characters to be used in clip strings.
26-Aug-2017
- Alpha (32bpp) icons in 'CellPicture' now drawn correctly per DrawIconEx instead of Picture.Render.
07-Aug-2017
- The HelpContextID and WhatsThisHelpID property is now also available when setting to a shadow object. ('Set' command)
27-Jul-2017
- Internal "DPI Aware" improvements.
Improved the functions PixelsPerDIP_X/PixelsPerDIP_Y in Common.bas.
25-Jul-2017
- Pixels in the property bag are now treated as DIPs. (Device-independent pixels)
There is no compatibility break in the property bag when there were saved at 100% (96) DPI.
Included new functions PixelsPerDIP_X/PixelsPerDIP_Y in Common.bas.
This "DPI Aware" enhancement affects the RowHeightMin/RowHeightMax and ColWidthMin/ColWidthMax property.
24-Jul-2017
- Included the EllipsisFormatFixed property which enables the setting to be differentiated between fixed and non-fixed cells.
23-Jul-2017
- Included the DataSource/DataMember property which allows to bind an Adodc control, DateEnvironment designer or ADODB.Recordset object.
A reference to the msdatsrc.tlb (pre-installed since Win2k) is required.
The new conditional compiliation constant 'ImplementDataSource' controls if the new feature is turned on.
If turned off the 'DataBindingBehavior' might be changed back from 'vbComplexBound' to 'vbNone'.
[...]
14-Jun-2017
- First release.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Hello,
i found an error 50003 when using this control with Windows 10 Pro 32-Bit.
Could you check thsi and release an update?
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Update released to cleanup the combo functionality and make definitive decision about the namings.
The ComboMode/ColComboMode run-time property allows to use combo functionality when editing a cell, it returns/sets.
- FlexComboModeNone -> Normal editing.
- FlexComboModeDropDown -> Allows to modify by drop-down list only.
- FlexComboModeEditable -> Allows to modify by normal editing and drop-down list.
- FlexComboModeButton -> Allows to modify by button only, which is a request to open a custom editor.
The ComboButtonValue run-time property which sets the value of the combo button by code, it returns/sets:
- FlexComboButtonValueUnpressed -> Normal.
- FlexComboButtonValuePressed -> Shows drop-down list or raises ComboButtonClick. (depending on ComboMode)
- FlexComboButtonValueDisabled -> Cannot click, grayed and closes up drop-down list if necessary.
ComboItems/ColComboItems run-time property is the definition of the strings to be used for the drop-down list.
Each item is separated with "|". If ComboMode property is Button then this property is ignored.
ComboList/ComboListCount/ComboListIndex run-time property are helping to interact with the drop-down list by code.
ComboDropDown/ComboCloseUp event, which occurs only when ComboMode is DropDown or Editable.
ComboButtonClick event, which occurs only when ComboMode is Button.
ComboButtonDrawMode run-time property and corresponding ComboButtonOwnerDraw event.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Hello,
will the new release also solve the mentioned run time error 50003?
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
polytron
Hello,
will the new release also solve the mentioned run time error 50003?
Did you use google? It seems a registration issue on your machine.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
OCX version 1.3 released.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Update released.
If drop-down list extends beyond bottom edge of the screen (MonitorFromWindow API) then it will be displayed above the edit window.
Just like a normal ComboBox would behave.
http://krool.mooo.com/Data/VBForums/...istMonitor.gif
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
hi Krool,Can I specify a format for the column? For example
Code:
Set vbgflexgrid.DataSource = adoGh
Vbgflexgrid.colformat(1,"0.00")
-
1 Attachment(s)
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Update released.
Included additional PictureAlignment enum constants to allow pictures to not overlap with the text.
Red ones are new and blue ones are the related "normal" enums.
So the normal enum + 20 is the NoOverlap range. I reserved some space to maybe also allow Center* pictures to have no overlap counterpart, but I think there is no need for it. (?)
And for Stretch or Tile it never makes sense to have a NoOverlap counterpart.
Code:
Public Enum FlexPictureAlignmentConstants
FlexPictureAlignmentLeftTop = 0
FlexPictureAlignmentLeftCenter = 1
FlexPictureAlignmentLeftBottom = 2
FlexPictureAlignmentCenterTop = 3
FlexPictureAlignmentCenterCenter = 4
FlexPictureAlignmentCenterBottom = 5
FlexPictureAlignmentRightTop = 6
FlexPictureAlignmentRightCenter = 7
FlexPictureAlignmentRightBottom = 8
FlexPictureAlignmentStretch = 9
FlexPictureAlignmentTile = 10
FlexPictureAlignmentLeftTopNoOverlap = 20
FlexPictureAlignmentLeftCenterNoOverlap = 21
FlexPictureAlignmentLeftBottomNoOverlap = 22
FlexPictureAlignmentRightTopNoOverlap = 26
FlexPictureAlignmentRightCenterNoOverlap = 27
FlexPictureAlignmentRightBottomNoOverlap = 28
End Enum
Illustration to show the difference: (Alignment of the text is in both cases left; so to effectively see the difference)
Attachment 169213
This way the CellPicture behaves more like an 'icon' instead like a background picture.
Quote:
Originally Posted by
ChenLin
Can I specify a format for the column?
Noted. Feature will be added soon. (ColFormat property)
In the meantime you may loop the column and format each cell manually. (via .TextMatrix)
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
ChenLin
Can I specify a format for the column? For example
Code:
Set vbgflexgrid.DataSource = adoGh
Vbgflexgrid.colformat(1,"0.00")
Done.
-
1 Attachment(s)
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Already tested and successful, thank you @Krool
Attachment 169281
-
1 Attachment(s)
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Another idea: If you have a lot of columns, maybe adding a freeze pane will make it easier to view, just like Excel does.
Attachment 169287
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
ChenLin
Another idea: If you have a lot of columns, maybe adding a freeze pane will make it easier to view, just like Excel does.
Attachment 169287
Good suggestion. In Farpoint Spread and my Spread, there are ColsFrozen and RowsFrozen properties. Maybe Excel uses different names.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Same for the vsFlexGrid control.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Hi.
some time ago it worked for me but now it does not compile or run in the ide closes everything completely.
commoncontrol does not work as it closes.
the reference is correct OLEGuids\OLEGuids.tlb
use windows 10 home
a greeting and forgiveness for the language
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
DirectionAfterReturn property included.
This is actually a simple feature and long overdue..
It allows to move the position of the current cell when the user presses return (Enter) key.
It also works in conjunction with the WrapCellBehavior property. (like the TabBehavior property does)
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Krool, thank you for this grid. Could you activate property AllowUserEditing? I would like to forbid cell's editing.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
SPB-667
Could you activate property AllowUserEditing? I would like to forbid cell's editing.
I don't understand. If you want to forbid cell's editing then set AllowUserEditing to False (Default)
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
SPB-667
Krool, thank you for this grid. Could you activate property AllowUserEditing? I would like to forbid cell's editing.
Nevermind. I found it )
But I have another question: can you add autosave of data from grid to database (like MS DataGrid 6.0) after changing cells.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
I don't understand. If you want to forbid cell's editing then set AllowUserEditing to False (Default)
Nevermind. I found it already)
But I have another question: can you add autosave of data from grid to database (like MS DataGrid 6.0) after changing cells.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
SPB-667
But I have another question: can you add autosave of data from grid to database (like MS DataGrid 6.0) after changing cells.
This a replacement for the FlexGrid control and not for the DataGrid control. There is no direct binding available in the MSFlexGrid control, so the VBFlexGrid doesn't either.
However, in my opinion, it is anway better to have the database unbound to the grid. If you change something in the grid it's in your control what happens after that in the database.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Hi,
I've tried this on 2 different machines, both Win 10 64bit, but the IDE just crashes when I run, compile or try to view MainForm.
I've put the OLEGuids files in SysWOW64 and the IDE looks to find them OK. I have not registered them in any way. Just overwrote the old OLEGuids I had there.
Any ideas?
Update: removed "MainForm" and changed Sub Main() to show "UserEditingForm" instead and then the program runs fine.
-Leifster
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
leifmb
I've tried this on 2 different machines, both Win 10 64bit, but the IDE just crashes when I run, compile or try to view MainForm.
I've put the OLEGuids files in SysWOW64 and the IDE looks to find them OK. I have not registered them in any way. Just overwrote the old OLEGuids I had there.
Any ideas?
Update: removed "MainForm" and changed Sub Main() to show "UserEditingForm" instead and then the program runs fine.
To be honest. I understanding nothing what you are describing.
For me the MainForm works. And that only UserEditingForm works but not MainForm is an indication that it's not the VBFlexGrid's nor OLEGuids.tlb's fault.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
I guess it's something wrong with my VB6 setup/installation then. I've seen similar behavior once or twice before.
Just tested on my 3rd VB6 machine and it has the very same problem :-(
Off topic: There are many different guides on how to install VB6 on Windows 10, all with some variations. Is there a definitive guide somewhere?
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
leifmb
I guess it's something wrong with my VB6 setup/installation then. I've seen similar behavior once or twice before.
Just tested on my 3rd VB6 machine and it has the very same problem :-(
Off topic: There are many different guides on how to install VB6 on Windows 10, all with some variations. Is there a definitive guide somewhere?
I suggest to ask this question in the general forum.
If it is of any comfort to you, from time to time (may be every two or three months) I need to uninstall and reinstall VB6 because I start to experience quasi random crashes of the IDE (I have Windows 10 - 64 bits).
I usually also clean the registry with a registry cleaner after uninstalling and before reinstalling (but I don't know if that is necessary).
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Often I need to indicate "sort arrows".
I would like to integrate such thing as a default in-built feature to reduce code lines on form level etc.
Any suggestions how to look like and integration?
I thought maybe with a .ColSortArrow property with enums None, Up and Down.
But how to draw, default or app should provide picture? How to align? (Text truncate problem?)
Thanks
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Update released.
The 'DataSource' property for reading ADO recordsets is now much faster reading the data.
Instead of looping trough all records/fields, the .GetRows method is used to extract all into an array.
In addition the cursor position does not need to be modified anymore as 'adBookmarkFirst' is used on .GetRows method.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Updated released. (also for OCX)
No VTable subclassing anymore at all. VTableSubclass.cls got removed.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
OCX 1.4 released.
Both versions are now in sync. (Std-EXE)
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
Updated released. (also for OCX)
No VTable subclassing anymore at all. VTableSubclass.cls got removed.
Hi Krool, Could you explain why the new subclassing is better?
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
dreammanor
Hi Krool, Could you explain why the new subclassing is better?
Hello, the explanation is in post # 2472 of the CCR thread.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Update released.
Bugfix in the ShowLabelTips property.
That property is intended to show tooltips on folded cells. However, it didn't show on fixed cells even though it was designed to work also on fixed cells.
The small bug was in the internal GetLabelInfo function.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
I am using this grid in a program where I need to format (color) certain words in a cell (but not all). Possible? (I started a thread in VB6 And Earlier about (erroneously) RTBs.)
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Update released.
Stupid bugfix in the internal MoveNextRow and MoveNextCol function. It could malfunction on a filtered grid and on the last row/col.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Hi Krool,
I'm binding VBFlexGrid to sqlite database
Code:
Set VBFlexGrid1.FlexDataSource = DataSource.BindTo(Rs)
However it is Impossile to sort columns order
I got a message: This funtionality is disabled when custom datasource is set
is there a work around?
thanks
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
newbie2
Hi Krool,
I'm binding VBFlexGrid to sqlite database
Code:
Set VBFlexGrid1.FlexDataSource = DataSource.BindTo(Rs)
However it is Impossile to sort columns order
I got a message: This funtionality is disabled when custom datasource is set
is there a work around?
thanks
The error says "functionality is disabled".
Reason is crystal clear as you have a virtual binding to a sqlite recordset.
If you want sorting - fine. Just append a "ORDER BY ..." in your sqlite SELECT statement.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
The error says "functionality is disabled".
Reason is crystal clear as you have a virtual binding to a sqlite recordset.
If you want sorting - fine. Just append a "ORDER BY ..." in your sqlite SELECT statement.
Thank you.
In fact I need to sort them after having fed the flexgrid control.
I have two command buttons.
one is
Code:
VBFlexGrid1.Sort = FlexSortGenericAscending
and the other is VBFlexGrid1.Sort = FlexSortGenericDescending
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
newbie2
Thank you.
In fact I need to sort them after having fed the flexgrid control.
I have two command buttons.
one is
Code:
VBFlexGrid1.Sort = FlexSortGenericAscending
and the other is VBFlexGrid1.Sort = FlexSortGenericDescending
In virtual bindig the grid is never fed. It just reads the data needed for the current view.
When you need to sort after binding then re-fetch the data again in your custom data source (SELECT statement with ORDER BY) and make a .Refresh on the VBFlexGrid so it reads the new current view.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
very clear
thank you Krool
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
very clear
thank you Krool
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Krool
Sorry to bother you again
Does VBFlexGrid support checkbox?
I need to delete multiple records from VBFlexGrid
thank you
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
newbie2
Krool
Sorry to bother you again
Does VBFlexGrid support checkbox?
I need to delete multiple records from VBFlexGrid
thank you
http://www.vbforums.com/showthread.p...-in-MsFlexGrid
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
thanks again
I tested the two methods in the link provided but unluckily none of them succeeded
One method is not possible with virtual binding
And the the other method failed because VBFlexGrid seems not supporting CellPicture property.
Edit
I jus noticed in your Demo that CellPicture property is supported but in the sample demo provided in the link I get Method or Data member not found in the line
Code:
if VBFlexGrid1.CellPicture = picChecked then
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
newbie2
thanks again
I tested the two methods in the link provided but unluckily none of them succeeded
One method is not possible with virtual binding
And the the other method failed because VBFlexGrid seems not supporting CellPicture property.
Edit
I jus noticed in your Demo that CellPicture property is supported but in the sample demo provided in the link I get Method or Data member not found in the line
Code:
if VBFlexGrid1.CellPicture = picChecked then
I cannot reproduce your error. Please provide a demo.
I also recommend you to set CellPictureAlignment to 'FlexPictureAlignmentLeftCenterNoOverlap'.
-
1 Attachment(s)
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
I cannot reproduce your error. Please provide a demo.
I also recommend you to set CellPictureAlignment to 'FlexPictureAlignmentLeftCenterNoOverlap'.
Hello Krool
Here is the demo
I should note that with the MSFlexGrid control doesn't throw the error
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
newbie2
Here is the demo
I should note that with the MSFlexGrid control doesn't throw the error
Thanks. I found the error.. Update released.
In the internal structure the cell picture is stored as 'IPictureDisp'.
However, somehow I exposed the cell picture back to the outside as 'IPicture'. (.CellPicture property)
And that 'IPicture' is not "comparable" via "If Pic1 = Pic2 Then".
I also updated the OCX version. Even as it was a "technical compatibility break" I choosed the "Preserve Compatibility (Advanced)" option.
Because in "real" it's not a compatibility break. Any app will continue to run as before.
So I encourage you to upgrade your 1.3 OCX you are currently using to the 1.4 OCX. (because 1.3 is not maintaned anymore)
If you want to stick with the 1.3 version there is this little workaround you can do:
Code:
Dim CellPic As IPictureDisp
Set CellPic = VBFlexGrid1.CellPicture
If CellPic = picChecked Then
If you go to 1.4 the above workaround is not necessary anymore. There you can do directly:
Code:
If VBFlexGrid1.CellPicture = picChecked Then
-
2 Attachment(s)
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Thank you Krool for all these efforts you are doing.
I registrered the 1.4 OCX . I could avoid the error but
i still can't check / uncheck as I do with the MsFlexGrid.
I attached the wo demos. one is working fine with the MsFlexGrid and the other is not working as expected with the VBFlexGrid
Thank you
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
I'm sorry
I should have set the VBFlexGrid in the control property to: Col = 1 Row = 1 FixedRows and Cols = 0
But something very strange is happening with virtual binding
I'm getting type mismatch error in
Code:
Set VBFlexGrid1.FlexDataSource = DataSource.BindTo(Rs)
When I drop version 1.4 and place Version 1.3, everything is OK
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
newbie2
I'm sorry
I should have set the VBFlexGrid in the control property to: Col = 1 Row = 1 FixedRows and Cols = 0
But something very strange is happening with virtual binding
I'm getting type mismatch error in
Code:
Set VBFlexGrid1.FlexDataSource = DataSource.BindTo(Rs)
When I drop version 1.4 and place Version 1.3, everything is OK
You need to change in your DataSource class the reference from IVBFlexDataSource from 1.3 to 1.4.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
You need to change in your DataSource class the reference from IVBFlexDataSource from 1.3 to 1.4.
There is no reference to the control version in the class
Code:
Option Explicit
Implements IVBFlexDataSource
Private mRs As cRecordset
'a Public Method, to allow Binding to an outside DataSource (in this case an SQLite-cRecordset)
Public Function BindTo(Rs As cRecordset) As IVBFlexDataSource
Set mRs = Rs
Set BindTo = Me 'return a reference of our Class-instance to the outside
End Function
'and the whole interface-implementation, which works against our internal SQLite-Recordset
Private Function IVBFlexDataSource_GetRecordCount() As Long
IVBFlexDataSource_GetRecordCount = mRs.RecordCount
End Function
Private Function IVBFlexDataSource_GetFieldCount() As Long
IVBFlexDataSource_GetFieldCount = mRs.Fields.Count
End Function
Private Function IVBFlexDataSource_GetFieldName(ByVal Field As Long) As String
IVBFlexDataSource_GetFieldName = mRs.Fields(Field).Name
End Function
Private Function IVBFlexDataSource_GetData(ByVal Field As Long, ByVal Record As Long) As String
IVBFlexDataSource_GetData = mRs.ValueMatrix(Record, Field)
End Function
Private Sub IVBFlexDataSource_SetData(ByVal Field As Long, ByVal Record As Long, ByVal NewData As String)
mRs.ValueMatrix(Record, Field) = NewData
End Sub
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
newbie2
There is no reference to the control version in the class
Code:
Option Explicit
Implements IVBFlexDataSource
Private mRs As cRecordset
'a Public Method, to allow Binding to an outside DataSource (in this case an SQLite-cRecordset)
Public Function BindTo(Rs As cRecordset) As IVBFlexDataSource
Set mRs = Rs
Set BindTo = Me 'return a reference of our Class-instance to the outside
End Function
'and the whole interface-implementation, which works against our internal SQLite-Recordset
Private Function IVBFlexDataSource_GetRecordCount() As Long
IVBFlexDataSource_GetRecordCount = mRs.RecordCount
End Function
Private Function IVBFlexDataSource_GetFieldCount() As Long
IVBFlexDataSource_GetFieldCount = mRs.Fields.Count
End Function
Private Function IVBFlexDataSource_GetFieldName(ByVal Field As Long) As String
IVBFlexDataSource_GetFieldName = mRs.Fields(Field).Name
End Function
Private Function IVBFlexDataSource_GetData(ByVal Field As Long, ByVal Record As Long) As String
IVBFlexDataSource_GetData = mRs.ValueMatrix(Record, Field)
End Function
Private Sub IVBFlexDataSource_SetData(ByVal Field As Long, ByVal Record As Long, ByVal NewData As String)
mRs.ValueMatrix(Record, Field) = NewData
End Sub
Does your vbp file references both 1.3 and 1.4?
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
Does your vbp file references both 1.3 and 1.4?
yes it does
Now I removed the reference to 1.3 and it worked
thank you a lot
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Hello
I need this selection rule by mouse or keyboard:
a)
single click into cell = single cell selected
mouse down and drag = select cells in the column (!) only, same for shift+cursor
b)
click on fixed row's cell
select the whole column
I already tried different combinations of the selection-related properties.
And couldn't find a combination.
What can I do to get the desired selection "mode"?
Thank you
Karl
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Karl77
b)
click on fixed row's cell
select the whole column
You need to have the .AllowBigSelection set to True. Then a click on a fixed row's cell automatically selects the whole column.
Quote:
Originally Posted by
Karl77
a)
single click into cell = single cell selected
mouse down and drag = select cells in the column (!) only, same for shift+cursor
To restrict a "mouse selection dragging" only to the current column you can use following code sample:
Code:
Private LButtonPressed As Boolean
Private Sub VBFlexGrid1_BeforeSelChange(ByVal NewRowSel As Long, ByVal NewColSel As Long, Cancel As Boolean)
If LButtonPressed = True Then
If NewColSel <> VBFlexGrid1.ColSel Then Cancel = True
End If
End Sub
Private Sub VBFlexGrid1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then LButtonPressed = True
End Sub
Private Sub VBFlexGrid1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
LButtonPressed = False
End Sub
The extension to include also shift+cursor would look like:
Code:
Private LButtonPressed As Boolean
Private ShiftPressed As Boolean
Private Sub VBFlexGrid1_BeforeSelChange(ByVal NewRowSel As Long, ByVal NewColSel As Long, Cancel As Boolean)
If LButtonPressed = True Or ShiftPressed = True Then
If NewColSel <> VBFlexGrid1.ColSel Then Cancel = True
End If
End Sub
Private Sub VBFlexGrid1_KeyDown(KeyCode As Integer, Shift As Integer)
ShiftPressed = CBool((Shift And vbShiftMask) <> 0)
End Sub
Private Sub VBFlexGrid1_KeyUp(KeyCode As Integer, Shift As Integer)
ShiftPressed = CBool((Shift And vbShiftMask) <> 0)
End Sub
Private Sub VBFlexGrid1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then LButtonPressed = True
End Sub
Private Sub VBFlexGrid1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
LButtonPressed = False
End Sub
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
You need to have the .AllowBigSelection set to True. Then a click on a fixed row's cell automatically selects the whole column.
Yes, I knew, I mentioned it only because I didn't want to lose this functionality along with the new 'mode'.
Quote:
To restrict a "mouse selection dragging" only to the current column you can use following code sample:
The extension to include also shift+cursor would look like:
Code:
Private LButtonPressed As Boolean
Private ShiftPressed As Boolean
Private Sub VBFlexGrid1_BeforeSelChange(ByVal NewRowSel As Long, ByVal NewColSel As Long, Cancel As Boolean)
If LButtonPressed = True Or ShiftPressed = True Then
If NewColSel <> VBFlexGrid1.ColSel Then Cancel = True
End If
End Sub
Private Sub VBFlexGrid1_KeyDown(KeyCode As Integer, Shift As Integer)
ShiftPressed = CBool((Shift And vbShiftMask) <> 0)
End Sub
Private Sub VBFlexGrid1_KeyUp(KeyCode As Integer, Shift As Integer)
ShiftPressed = CBool((Shift And vbShiftMask) <> 0)
End Sub
Private Sub VBFlexGrid1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then LButtonPressed = True
End Sub
Private Sub VBFlexGrid1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
LButtonPressed = False
End Sub
Works exactly as expected.
Thanks for you support Krool.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Thank you for this great grid.
I found a bug in the latest version. If I set SelectionMode to any other value then Free and I have AllowUserEdit set to True, with a double click, I can only edit the first cell in the row or column and not the cell I double clicked.
And there is one property missing. There is now BackgoundColorAlt, but no ForegroundColorAlt.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
0xDEADC0DE55
Thank you for this great grid.
I found a bug in the latest version. If I set SelectionMode to any other value then Free and I have AllowUserEdit set to True, with a double click, I can only edit the first cell in the row or column and not the cell I double clicked.
And there is one property missing. There is now BackgoundColorAlt, but no ForegroundColorAlt.
It's not a bug, it's a feature.
For SelectionMode Free, FreeByRow, FreeByCol it works as you desire.
For ByRow and ByCol it takes the first cell at it is the "focused" cell.
You can change behavior by code at the BeforeEdit event.
Check the "Reason" param for FlexEditReasonDblClick and as the Row and Col param in the event are "ByRef" you can make a .HitTest and apply .HitRow and .HitCol to it. (Or more convenient use .MouseRow and .MouseCol)
Everyone has different desires, therefore there is a strict flat default behavior and such extra things need to be done via code.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Update released.
Significant performance boost for the drawing operation.
~2% for
Usage of Polyline API (not PolylineTo !) instead of MoveToEx and LineTo. (for the grid lines)
Polyline is at device driver level, thus faster than LineTo and it doesn't change current position.
~1% for
Usage of PatBlt API instead of FillRect. (FillRect is a wrapper of PatBlt SelectObject'ing the specified Brush)
Of course when each cell has a different backcolor the effect is equal to FillRect.
~5% for
Preserving the memory DC & Bitmap (DoubleBuffer) for WM_PAINT and purge only upon WM_SIZE. (and cleanup on destroy window)
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
I just downloaded the package (VBFlexGridDemo.zip) attached to post #1
There is no ocx file in it.