-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
Update released.
Included enum FlexComboModeCalendar.
... .. .
To ensure unique format you may put following in ValidateEdit event.
Code:
If Cancel = False Then
' Ensure unique date format before commit. (override possible custom format of the text box)
VBFlexGrid1.EditText = VBFlexGrid1.ComboCalendarValue
End If
Beside ComboCalendarValue, there is also ComboCalendarMinDate/ComboCalendarMaxDate available.
Amazing, Krool. The project I am currently working on involves having dates in combo columns. While I was happy filling the combo column cells with dates itself, you have provided a calendar too additionally! Wow!!! Thanks a TON. I think I will be able to find a case to avail the calendar combo too in my project now!
Kind regards.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
That's an interesting question. So, a visual cue that a dropdown will appear when attempting to edit.
The not disturbing approach would be not to always show such a "chevron" but only when that cell is selected. Using the RowColChange event.
However, using a picture with right align and no overlap would be the easiest and dynamically set/clear upon RowColChange.
Difficult part is to create such a dynamic scaled picture at run-time. (Using DrawFrameControl etc.)
With respect to the above, can there be a boolean property in the vbFlexGrid (say 'ComboVisualCue') so that making it true will show the chevron while mouse hovers on the combo cells? Well, I understand the difficulty factor you mention in drawing the chevron during run-time, but since it is just for one cell only at any point of time, if and when you hit upon a way to achieve drawing the 'dynamically scaled' chevron in an easier manner, you may kindly think of my suggestion for a ComboVisualCue property. Thanks in advance.
And, I take this opportunity to once again thank you for the UseCrLf property in RichTextBox.
Kind regards.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
softv
Dear krool,
... .. . Object browser told me that .colsvisible "Returns the total number of columns or rows visible in the flex grid."
To understand the above statement from the Object Browser better, I just experimented with a sample 10*10 flex grid. I realised that even if I hide some columns (say 1, 2 and 3) and reduce the width of the grid to show only 2 columns (i.e. only column 0 and column 4), then also .colsvisible will return 5 and not 2. Is it so by design? Just a clarification. Thats all.
.rowsvisible also behaves similarly with a similar experiment as above. So, just wanted to clarify whether .colsvisible and .rowsvisible are designed to report values in the above manner only. ... .. .
I await your clarification on the above, Krool. In other words, suppose I have 20 columns in a grid; I set '.ColHidden = True' for columns 2 to 19; make columns 1 and 20 only visible to user, then also .ColsVisible reports 20 and not 2? Is that correct?
Kind regards.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
softv
I await your clarification on the above, Krool. In other words, suppose I have 20 columns in a grid; I set '.ColHidden = True' for columns 2 to 19; make columns 1 and 20 only visible to user, then also .ColsVisible reports 20 and not 2? Is that correct?
Kind regards.
20 are count before the first "non-visible".
Technically it is correct. What's your need?
-
1 Attachment(s)
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
20 are count before the first "non-visible".
Technically it is correct. What's your need?
Dear Krool,
Kindly please consider the 2 cases (Case 1 and Case 2) in the following code, for a 20 columns grid. As mentioned by me (in two of the comments in the following code), .ColsVisible prints "20" in both cases, whereas logically I was expecting only "2" to be printed, since I have hidden the other 18 columns. In other words, in my form itself, only 2 columns from the grid will be visible in both the cases.
So, I am honestly not able to understand why .ColsVisible should print "20" and not "2"? Is printing "20" only technically correct by design itself? I mean, .ColsVisible will always ignore hidden columns in its count? I just want your clarification/confirmation on this. Thanks.
Code:
For i = 2 To 19 'i.e. I have made 0th and 1st indexed columns alone to be visible in the grid. I have kept other columns hidden by setting .ColHidden = true for them
flx1000.ColHidden(i) = True
Next i
flx1000.TextMatrix(0, 0) = "Column 0"
flx1000.TextMatrix(0, 1) = "Column 1"
Debug.Print vbCrLf
Debug.Print "No. of visible columns in flx1000, in Case 1 = ", flx1000.ColsVisible
'the above prints "20" and not "2"
With flx1000
.ColHidden(.Cols - 1) = False '19th indexed column is made visible again
For i = 1 To 18 'i.e. I have made 0th and 19th indexed columns (in other words, first and last columns) alone to be visible in the grid. I have kept 1st to 18th indexed columns hidden
.ColHidden(i) = True
Next i
.TextMatrix(0, 0) = "Column 0"
.TextMatrix(0, 19) = "Column 19"
End With
Debug.Print "No. of visible columns in flx1000, in Case 2 = ", flx1000.ColsVisible
'the above also prints "20" and not "2"
Kind regards.
EDIT-1 (to add further more clarity [hopefully] to my query):
Suppose my code is just the following one line alone (i.e. completely ignoring the above code and the 2 cases in it), then, if I keep the width of my 20 columns grid in such a way that the first 2 columns alone are fully visible in my form, then flx1000.ColsVisible prints "2" which is correct, because out of the 20 columns, I have kept the width of the grid in such a way that the first 2 columns alone are fully visible in my form.
Code:
Debug.Print "No. of visible columns in flx1000 = ", flx1000.ColsVisible
'this prints "2" which is correct
Now, suppose I keep the width of my 20 columns grid in such a way that the first 5 columns alone are fully visible in my form. Then, flx1000.ColsVisible prints "5" which is again correct, because out of the 20 columns, I have kept the grid's width in such a way that the first 5 columns (0th to 4th indexed columns) alone are fully visible in my form.
But, if I hide columns 1 to 2 (i.e. for 1st and 2nd indexed columns, I set .ColHidden = True) and keep the width of my 20 columns grid in such a way that only 5 columns are visible (i.e. the 0th, 3rd, 4th, 5th and 6th indexed columns are only fully visible), then flx1000.ColsVisible prints "7" (and not "5") which, personally for me, sounds logically incorrect since I have already kept the width of the grid in such a way that only 5 columns are fully visible. Please see screenshot below.
Attachment 182753
The thing is that though ".ColHidden" has been set to "True" for 1st and 2nd indexed columns, they have also been included in the .ColsVisible count. Please see code below. But, if this is how .ColsVisible is set to behave technically, by design, then no issues at all. But, I just wanted a confirmation on that. That's all. Nothing else. Thanks.
Code:
With flx1000
For i = 1 To 2
.ColHidden(i) = True
Next i
.TextMatrix(0, 0) = "Column 0"
.TextMatrix(0, 1) = "Column 1"
.TextMatrix(0, 2) = "Column 2"
.TextMatrix(0, 3) = "Column 3"
.TextMatrix(0, 4) = "Column 4"
.TextMatrix(0, 5) = "Column 5"
.TextMatrix(0, 6) = "Column 6"
Debug.Print vbCrLf, Now
Debug.Print "No. of visible columns in flx1000 = ", .ColsVisible
End With
'the above prints 7 and not 5
Kind Regards.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
softv
Dear Krool,
Kindly please consider the 2 cases (Case 1 and Case 2) in the following code, for a 20 columns grid. As mentioned by me (in two of the comments in the following code), .ColsVisible prints "20" in both cases, whereas logically I was expecting only "2" to be printed, since I have hidden the other 18 columns. In other words, in my form itself, only 2 columns from the grid will be visible in both the cases.
So, I am honestly not able to understand why .ColsVisible should print "20" and not "2"? Is printing "20" only technically correct by design itself? I mean, .ColsVisible will always ignore hidden columns in its count? I just want your clarification/confirmation on this. Thanks.
Code:
For i = 2 To 19 'i.e. I have made 0th and 1st indexed columns alone to be visible in the grid. I have kept other columns hidden by setting .ColHidden = true for them
flx1000.ColHidden(i) = True
Next i
flx1000.TextMatrix(0, 0) = "Column 0"
flx1000.TextMatrix(0, 1) = "Column 1"
Debug.Print vbCrLf
Debug.Print "No. of visible columns in flx1000, in Case 1 = ", flx1000.ColsVisible
'the above prints "20" and not "2"
With flx1000
.ColHidden(.Cols - 1) = False '19th indexed column is made visible again
For i = 1 To 18 'i.e. I have made 0th and 19th indexed columns (in other words, first and last columns) alone to be visible in the grid. I have kept 1st to 18th indexed columns hidden
.ColHidden(i) = True
Next i
.TextMatrix(0, 0) = "Column 0"
.TextMatrix(0, 19) = "Column 19"
End With
Debug.Print "No. of visible columns in flx1000, in Case 2 = ", flx1000.ColsVisible
'the above also prints "20" and not "2"
Kind regards.
EDIT-1 (
to add further more clarity [hopefully] to my query):
Suppose my code is just the following one line alone (
i.e. completely ignoring the above code and the 2 cases in it), then, if I keep the width of my
20 columns grid in such a way that the first 2 columns alone are fully visible in my form, then flx1000.ColsVisible prints "2" which is correct, because out of the 20 columns, I have kept the width of the grid in such a way that the first 2 columns alone are fully visible in my form.
Code:
Debug.Print "No. of visible columns in flx1000 = ", flx1000.ColsVisible
'this prints "2" which is correct
Now, suppose I keep the width of my
20 columns grid in such a way that the first 5 columns alone are fully visible in my form. Then, flx1000.ColsVisible prints "5" which is again correct, because out of the 20 columns, I have kept the grid's width in such a way that the first 5 columns (0th to 4th indexed columns) alone are fully visible in my form.
But, if I
hide columns 1 to 2 (i.e. for 1st and 2nd indexed columns, I set .ColHidden = True) and keep the width of my
20 columns grid in such a way that only 5 columns are visible (i.e. the
0th, 3rd, 4th, 5th and 6th indexed columns are only fully visible), then flx1000.ColsVisible prints "7" (and not "5") which, personally for me, sounds logically incorrect since I have already kept the width of the grid in such a way that only 5 columns are fully visible. Please see screenshot below.
Attachment 182753
The thing is that
though ".ColHidden" has been set to "True" for 1st and 2nd indexed columns, they have also been included in the .ColsVisible count. Please see code below. But, if this is how .ColsVisible is set to behave technically, by design, then no issues at all. But, I just wanted a confirmation on that. That's all. Nothing else. Thanks.
Code:
With flx1000
For i = 1 To 2
.ColHidden(i) = True
Next i
.TextMatrix(0, 0) = "Column 0"
.TextMatrix(0, 1) = "Column 1"
.TextMatrix(0, 2) = "Column 2"
.TextMatrix(0, 3) = "Column 3"
.TextMatrix(0, 4) = "Column 4"
.TextMatrix(0, 5) = "Column 5"
.TextMatrix(0, 6) = "Column 6"
Debug.Print vbCrLf, Now
Debug.Print "No. of visible columns in flx1000 = ", .ColsVisible
End With
'the above prints 7 and not 5
Kind Regards.
That's discuss-able what is "correct".
However, the behavior is similar to the .ColIsVisible property.
Check this out in MS(H)FlexGrid what it prints on a column that is "hidden" (ColWidth = 0) but between two "visible" cols.
It returns True..
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
That's discuss-able what is "correct".
However, the behavior is similar to the .ColIsVisible property.
Check this out in MS(H)FlexGrid what it prints on a column that is "hidden" (ColWidth = 0) but between two "visible" cols.
It returns True..
Oh okay, Krool. So, it is like that, by design. Understood. No issues then. Thanks a TON.
Kind regards.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
-
1 Attachment(s)
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Update released.
Thanks to inspiration by softv I introduced now the ComboCue property.
It needs to be set at run-time to either 0 - None, 1 - DropDown or 2 - Button.
The demo project was updated to use this new functionality.
Attachment 182795
This is how it needs to be set. As you see below the ComboCue and the actual ComboMode for editing are independent of each other.
So, it is the app responsobility to apply the correct ComboCue upon RowColChange event.
Code:
Private Sub VBFlexGrid1_RowColChange()
' The combo cue can only be displayed on the current cell.
If VBFlexGrid1.Row >= VBFlexGrid1.FixedRows Then
Select Case VBFlexGrid1.Col
Case COL_CALENDARVALIDATION, COL_COMBODROPDOWN, COL_COMBOEDITABLE
VBFlexGrid1.ComboCue = FlexComboCueDropDown
Case COL_COMBOBUTTON
VBFlexGrid1.ComboCue = FlexComboCueButton
Case Else
VBFlexGrid1.ComboCue = FlexComboCueNone
End Select
Else
VBFlexGrid1.ComboCue = FlexComboCueNone
End If
End Sub
The new hit result enum FlexHitResultComboCue helps to identify the graphical cue.
However, it is not only a cue. It makes it also easier to start editing.
When a cue is displayed and you click on it then the editing is started and the drop-down list will be shown.
The new edit reason enums FlexEditReasonComboCueClick, FlexEditReasonComboCueDblClick and FlexEditReasonComboCueF4 helps for this.
What's missing (for now):
Like for ComboButtonValueDisabled maybe a disabled graphical cue might be helpful.
For ComboCueDropDown the alt-down arrow key may also start editing. (enum FlexEditReasonComboCueAltKey ?)
Hot-tracking for the graphical cue.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
Update released.
Thanks to inspiration by softv I introduced now the ComboCue property.
It needs to be set at run-time to either 0 - None, 1 - DropDown or 2 - Button.
The demo project was updated to use this new functionality.
Attachment 182795
This is how it needs to be set. As you see below the ComboCue and the actual ComboMode for editing are independent of each other.
So, it is the app responsobility to apply the correct ComboCue upon RowColChange event.
Code:
Private Sub VBFlexGrid1_RowColChange()
' The combo cue can only be displayed on the current cell.
If VBFlexGrid1.Row >= VBFlexGrid1.FixedRows Then
Select Case VBFlexGrid1.Col
Case COL_CALENDARVALIDATION, COL_COMBODROPDOWN, COL_COMBOEDITABLE
VBFlexGrid1.ComboCue = FlexComboCueDropDown
Case COL_COMBOBUTTON
VBFlexGrid1.ComboCue = FlexComboCueButton
Case Else
VBFlexGrid1.ComboCue = FlexComboCueNone
End Select
Else
VBFlexGrid1.ComboCue = FlexComboCueNone
End If
End Sub
The new hit result enum FlexHitResultComboCue helps to identify the graphical cue.
However, it is not only a cue. It makes it also easier to start editing.
When a cue is displayed and you click on it then the editing is started and the drop-down list will be shown.
The new edit reason enums FlexEditReasonComboCueClick, FlexEditReasonComboCueDblClick and FlexEditReasonComboCueF4 helps for this.
What's missing (for now):
Like for ComboButtonValueDisabled maybe a disabled graphical cue might be helpful.
For ComboCueDropDown the alt-down arrow key may also start editing. (enum FlexEditReasonComboCueAltKey ?)
Hot-tracking for the graphical cue.
Dear krool,
Infinite Thanks to God. Infinite Thanks to you. The cue and the provision for easier editing are excellent! Absolutely Excellent!
God is Great. Just yesterday only I was thinking of writing to you today, requesting for the ComboCalendar to pop down immediately on a single click, if at all possible. And, to my pleasant surprise, you have paved the way for the same already! Great, krool. Great. Through hot-tracking (which you have kept in your pipeline), I was able to just single click (much similar to combo boxes) and make the ComboCalendar to pop down. i.e. Hover -> See the Cue -> Click the Cue -> Pop Down. That's all.
I just tried a similar code as the one you have given above, in the 'Mouse_Move event' (after MouseTrack = true) of the gird, just for a single Combo Cell, and I could make the ComboCue appear on mouse hover and thereafter the ComboCalendar to pop down with a single click on the ComboCue. Thanks in TONs again. Of course I would still await your ideal and professional approach to achieve the hot-tracking of ComboCue. As of now, I am just informing you that I experimented, found it working for a single Combo cell and my joy and gratitude knew no bounds. :). For the time being, I will try to extend my logic to cover any Combo cell and use the same. Once you release your own perfect hot-tracking code, I would adopt the same, of course, obviously.
And, until I extend my abovementioned logic, I will continue using my current code (as given below) for achieving the ComboCalendar to pop down (with a single click on the Cue area). I am having the following code in the 'CellClick' event of a grid (say flx1, whose .ColComboMode(1) = FlexComboModeCalendar). There must be a better way of course (than the following code) but the following code itself suits my requirements. You must be able to suggest a better way though.
Code:
If col = 1 Then
flx1.StartEdit
Call MouseClick 'simulates a single left click on the cell's ComboCue.
End If
Apart from 'mouse hover' ComboCue, personally, for my own requirements, I thought that perhaps having the ComboCue permanently on the topmost cell of a ComboColumn (i.e. in the top row alone) also would be helpful, from users' point of view. That is also possible for me to achieve now with your ComboCue property. :). Thanks a TON again.
May be a boolean property (say 'ComboCueInTopRow') to do the above automatically would be helpful too but this is just a very small and random thought.
Well, once again thanking you, in TONS - not only for ComboCue, but for every bit of matchless goodness you have given to this world society through your free controls. God Bless you! God Bless all!
Kind regards.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
softv,
With hot-tracking I mean to hotlight the button.
What you mean is to display the ComboCue on the MouseRow/Col instead of the current focused Row/Col, right?
How did you make it? Change code?
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
softv
Code:
If col = 1 Then
flx1.StartEdit
Call MouseClick 'simulates a single left click on the cell's ComboCue.
End If
Make instead of Call MouseClick the following.
Code:
flx1.ComboButtonValue = FlexComboButtonValuePressed
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
softv,
With hot-tracking I mean to hotlight the button.
What you mean is to display the ComboCue on the Mouse Row/Col instead of the current focused Row/Col, right?
How did you make it? Change code?
Dear Krool,
How divinely fortunate that I thought that by 'Hot-Tracking' you meant 'Mouse Hover' ComboCue! Because, because of that only, I started writing code to show the ComboCue on MouseHover.
Well, first of all, sorry for the delay in posting this reply. The reason was when you posted your above reply I had tried writing code locally only. i.e. for showing ComboCue (on mouse hover) for any particular grid's Combo cells in my own forms only (via the MouseMove event). I had not written a global code which would show the ComboCue for any ComboCell in any grid in any form in any project. Since you asked me 'Change code?', I just presumed it to mean that you are asking me whether I changed the code in the VBFlexGrid.ctl itself. And, since you asked me 'How did you make it?', I thought I will do the global code also and provide both the codes to you (i.e. local and global). Hence, the delay.
The local code (in the 'MouseMove' event of any particular grid in a form).
Code:
With VBFlexGrid1
'Debug.Print .MouseCol, .ColComboMode(.MouseCol)
Select Case .ColComboMode(.MouseCol)
Case FlexComboModeCalendar, FlexComboModeDropDown, FlexComboModeEditable
.Row = .MouseRow
.Col = .MouseCol
.ComboCue = FlexComboCueDropDown
Case Else
.ComboCue = FlexComboCueNone
End Select
End With
The global code in the WM_MouseMove of WindowProcControl function in VBFlexGrid.ctl
Code:
Dim flx As Control
Set flx = GetControlFromhWnd(hWnd)
'Debug.Print "here outside", flx.Name, flx.Row, flx.Col, UserControl.Ambient.DisplayName
With flx
Select Case .ColComboMode(.MouseCol)
Case FlexComboModeCalendar, FlexComboModeDropDown, FlexComboModeEditable
'Debug.Print "here inside", Now, .MouseRow, .MouseCol, .ColComboMode(.MouseCol), flx.Name
.Row = .MouseRow
.Col = .MouseCol
.ComboCue = FlexComboCueDropDown
'Debug.Print "yes"
Case Else
.ComboCue = FlexComboCueNone
End Select
End With
I wrote the global code only because you asked me and thus inspired me. Otherwise, as written already, you are the best one to effect the global code in the right way (in the most ideal, perfect, concise and optimal manner).
Actually, I have just like that placed the above code before the following line
Code:
Call ProcessMouseMove(GetMouseStateFromParam(wParam), Get_X_lParam(lParam), Get_Y_lParam(lParam))
I don't know whether placing my global code in the above manner would affect the call to 'ProcessMouseMove' or not. I see that my global code is working for me as of now. But, as written earlier, I await your ideal code (placed ideally). Thanks in advance.
Thanks a TON once again for all your free controls. God Bless you! God Bless all!
Kind regards.
EDIT-1:
The following "seems" to be enough (instead of "Set flx = GetControlFromhWnd(hWnd)", where GetControlFromhWnd is my own function). So, I am quite happy that I could get a much faster/straightforward way to get the control's reference. There still might be a more straightforward way to get the control's reference, which I am missing somehow. So, I await your most ideal and optimal code eagerly. :)
Code:
Set flx = Parent().Controls(UserControl.Ambient.DisplayName)
EDIT-2:
On further exploring, I understood and learnt that the following simple and straightforward code itself will do (as the global code), instead of my above-given global code. Thanks Krool, for inspiring persons like me to explore and learn more.
Code:
Select Case ColComboMode(MouseCol)
Case FlexComboModeCalendar, FlexComboModeDropDown, FlexComboModeEditable
Row = MouseRow
Col = MouseCol
ComboCue = FlexComboCueDropDown
Case Else
ComboCue = FlexComboCueNone
End Select
Kind regards.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
Make instead of Call MouseClick the following.
Code:
flx1.ComboButtonValue = FlexComboButtonValuePressed
Worked like a charm! Thanks a TON, as always. :)
Kind regards.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Update released. Included the ComboCueRow/ComboCueCol property which lets you determine where to display the combo cue.
It's possible to reset the ComboCueRow/ComboCueCol to -1 so that it is always the current focused cell. (equal .Row/.Col)
To have this "hot-tracking" behavior. Ensure VBFlexGrid.MouseTrack is True and have following code.
Code:
Private Sub VBFlexGrid1_MouseLeave()
VBFlexGrid1.ComboCue = FlexComboCueNone
VBFlexGrid1.ComboCueRow = -1
VBFlexGrid1.ComboCueCol = -1
End Sub
Private Sub VBFlexGrid1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
VBFlexGrid1.HitTest X, Y
If VBFlexGrid1.HitResult = FlexHitResultNoWhere Then
VBFlexGrid1.ComboCue = FlexComboCueNone
VBFlexGrid1.ComboCueRow = -1
VBFlexGrid1.ComboCueCol = -1
Exit Sub
End If
If VBFlexGrid1.HitRow >= VBFlexGrid1.FixedRows Then
Select Case VBFlexGrid1.HitCol
Case COL_CALENDARVALIDATION, COL_COMBODROPDOWN, COL_COMBOEDITABLE
VBFlexGrid1.ComboCue = FlexComboCueDropDown
VBFlexGrid1.ComboCueRow = VBFlexGrid1.HitRow
VBFlexGrid1.ComboCueCol = VBFlexGrid1.HitCol
Case COL_COMBOBUTTON
VBFlexGrid1.ComboCue = FlexComboCueButton
VBFlexGrid1.ComboCueRow = VBFlexGrid1.HitRow
VBFlexGrid1.ComboCueCol = VBFlexGrid1.HitCol
Case Else
VBFlexGrid1.ComboCue = FlexComboCueNone
VBFlexGrid1.ComboCueRow = -1
VBFlexGrid1.ComboCueCol = -1
End Select
Else
VBFlexGrid1.ComboCue = FlexComboCueNone
VBFlexGrid1.ComboCueRow = -1
VBFlexGrid1.ComboCueCol = -1
End If
End Sub
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
Update released. Included the ComboCueRow/ComboCueCol property which lets you determine where to display the combo cue.
It's possible to reset the ComboCueRow/ComboCueCol to -1 so that it is always the current focused cell. (equal .Row/.Col) ... .. .
Thanks a TON, krool.
Earlier, while I was exploring, I tried HitTest (in my global code) also but when I set the row and col, it started highlighting the rows and columns until the cell where the ComboCue got displayed. So, though the ComboCue got displayed, it was highlighting many other cells upto it. Now, I understand why. Thanks for the ComboCueRow and ComboCueCol properties. I will try with them now. I think the highlighting issue won't arise now (in my global code). Thanks again.
Kind regards.
EDIT-1:
yes, highlighting issue does not arise while using ComboCueRow and ComboCueCol after HitTest. Thanks.
And, I just now see that you have added one more enhancement (if I am right, this was not present when I first posted my above message), which is "Included the CellComboCue property. (plus corresponding enum FlexCellComboCue). This let's you define a fixed combo cue for an individual cell or a range of cells.". This is fantastic. If my understanding of what you have written is correct, I think with this I can now show a ComboCue always for the cells at the top row. Thank you soooooooooooooooo much. Let me try it out and write back.
Kind regards.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
softv
EDIT-1:
yes, highlighting issue does not arise while using ComboCueRow and ComboCueCol after HitTest. Thanks.
And, I just now see that you have added one more enhancement (if I am right, this was not present when I first posted my above message), which is "Included the CellComboCue property. (plus corresponding enum FlexCellComboCue). This let's you define a fixed combo cue for an individual cell or a range of cells.". This is fantastic. If my understanding of what you have written is correct, I think with this I can now show a ComboCue always for the cells at the top row. Thank you soooooooooooooooo much. Let me try it out and write back.
Kind regards.
Yes, the ComboCue is dynamic. Like for focused/hot-track.
The new CellComboCue can be used to place fixed spots or even an entire column (set FillStyle to repeat for effectiveness) to a combo cue.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
... .. . place fixed spots or even an entire column (set FillStyle to repeat for effectiveness) to a combo cue.
just a while ago, tried it. Its all SUPERB. So, all the requirements I requested for have been provided by you, as of now. Infinite thanks.
Thanks for the tip on FillStyle. Otherwise, I would have forgotten. You have magnanimously provided (and keep providing) so many properties and functions for each free control that sometimes I forget about one or more of them. :)
Kind regards.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Update again for combo cue.
Added enum FlexComboCueDisabledDropDown and FlexComboCueDisabledButton.
This is just to reflect the counterpart for FlexComboButtonValueDisabled. (Edit portion possible but dropdown button deactivated)
The new hit result FlexHitResultComboCueDisabled helps to differentiate it. The normal one triggers an edit operation and this here just eat's the button down.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Experimental feature 'AllowUserFreezing'.
Please test and report any behavior mismatch or suggestions.
After feedback it will be integrated into the current version.
Thanks
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
Update released. Included the ComboCueRow/ComboCueCol property which lets you determine where to display the combo cue.
It's possible to reset the ComboCueRow/ComboCueCol to -1 so that it is always the current focused cell. (equal .Row/.Col)
To have this "hot-tracking" behavior. Ensure VBFlexGrid.MouseTrack is True and have following code.
Code:
Private Sub VBFlexGrid1_MouseLeave()
VBFlexGrid1.ComboCue = FlexComboCueNone
VBFlexGrid1.ComboCueRow = -1
VBFlexGrid1.ComboCueCol = -1
End Sub
Private Sub VBFlexGrid1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
VBFlexGrid1.HitTest X, Y
If VBFlexGrid1.HitResult = FlexHitResultNoWhere Then
VBFlexGrid1.ComboCue = FlexComboCueNone
VBFlexGrid1.ComboCueRow = -1
VBFlexGrid1.ComboCueCol = -1
Exit Sub
End If
If VBFlexGrid1.HitRow >= VBFlexGrid1.FixedRows Then
Select Case VBFlexGrid1.HitCol
Case COL_CALENDARVALIDATION, COL_COMBODROPDOWN, COL_COMBOEDITABLE
VBFlexGrid1.ComboCue = FlexComboCueDropDown
VBFlexGrid1.ComboCueRow = VBFlexGrid1.HitRow
VBFlexGrid1.ComboCueCol = VBFlexGrid1.HitCol
Case COL_COMBOBUTTON
VBFlexGrid1.ComboCue = FlexComboCueButton
VBFlexGrid1.ComboCueRow = VBFlexGrid1.HitRow
VBFlexGrid1.ComboCueCol = VBFlexGrid1.HitCol
Case Else
VBFlexGrid1.ComboCue = FlexComboCueNone
VBFlexGrid1.ComboCueRow = -1
VBFlexGrid1.ComboCueCol = -1
End Select
Else
VBFlexGrid1.ComboCue = FlexComboCueNone
VBFlexGrid1.ComboCueRow = -1
VBFlexGrid1.ComboCueCol = -1
End If
End Sub
After picking a dropdown ComboBox item, focus goes to mouse Cell, should stay at last dropdown cell, logically.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
DaveDavis
After picking a dropdown ComboBox item, focus goes to mouse Cell, should stay at last dropdown cell, logically.
Easy to make. Use .ComboCue and .CellComboCue at the same time. See code below.
Code:
Private Sub VBFlexGrid1_RowColChange()
Static LastRow As Long, LastCol As Long
VBFlexGrid1.Cell(FlexCellComboCue, LastRow, LastCol) = FlexComboCueNone
If VBFlexGrid1.Row >= VBFlexGrid1.FixedRows Then
Select Case VBFlexGrid1.Col
Case COL_CALENDARVALIDATION, COL_COMBODROPDOWN, COL_COMBOEDITABLE
VBFlexGrid1.Cell(FlexCellComboCue, VBFlexGrid1.Row, VBFlexGrid1.Col) = FlexComboCueDropDown
Case COL_COMBOBUTTON
VBFlexGrid1.Cell(FlexCellComboCue, VBFlexGrid1.Row, VBFlexGrid1.Col) = FlexComboCueButton
Case Else
VBFlexGrid1.Cell(FlexCellComboCue, VBFlexGrid1.Row, VBFlexGrid1.Col) = FlexComboCueNone
End Select
Else
VBFlexGrid1.Cell(FlexCellComboCue, VBFlexGrid1.Row, VBFlexGrid1.Col) = FlexComboCueNone
End If
LastRow = VBFlexGrid1.Row
LastCol = VBFlexGrid1.Col
End Sub
Private Sub VBFlexGrid1_MouseLeave()
VBFlexGrid1.ComboCue = FlexComboCueNone
VBFlexGrid1.ComboCueRow = -1
VBFlexGrid1.ComboCueCol = -1
End Sub
Private Sub VBFlexGrid1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
VBFlexGrid1.HitTest X, Y
If VBFlexGrid1.HitResult = FlexHitResultNoWhere Then
VBFlexGrid1.ComboCue = FlexComboCueNone
VBFlexGrid1.ComboCueRow = -1
VBFlexGrid1.ComboCueCol = -1
Exit Sub
End If
If VBFlexGrid1.HitRow >= VBFlexGrid1.FixedRows Then
Select Case VBFlexGrid1.HitCol
Case COL_CALENDARVALIDATION, COL_COMBODROPDOWN, COL_COMBOEDITABLE
VBFlexGrid1.ComboCue = FlexComboCueDropDown
VBFlexGrid1.ComboCueRow = VBFlexGrid1.HitRow
VBFlexGrid1.ComboCueCol = VBFlexGrid1.HitCol
Case COL_COMBOBUTTON
VBFlexGrid1.ComboCue = FlexComboCueButton
VBFlexGrid1.ComboCueRow = VBFlexGrid1.HitRow
VBFlexGrid1.ComboCueCol = VBFlexGrid1.HitCol
Case Else
VBFlexGrid1.ComboCue = FlexComboCueNone
VBFlexGrid1.ComboCueRow = -1
VBFlexGrid1.ComboCueCol = -1
End Select
Else
VBFlexGrid1.ComboCue = FlexComboCueNone
VBFlexGrid1.ComboCueRow = -1
VBFlexGrid1.ComboCueCol = -1
End If
End Sub
-
1 Attachment(s)
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
Easy to make. Use .ComboCue and .CellComboCue at the same time. See code below.
Code:
Private Sub VBFlexGrid1_RowColChange()
Static LastRow As Long, LastCol As Long
VBFlexGrid1.Cell(FlexCellComboCue, LastRow, LastCol) = FlexComboCueNone
If VBFlexGrid1.Row >= VBFlexGrid1.FixedRows Then
Select Case VBFlexGrid1.Col
Case COL_CALENDARVALIDATION, COL_COMBODROPDOWN, COL_COMBOEDITABLE
VBFlexGrid1.Cell(FlexCellComboCue, VBFlexGrid1.Row, VBFlexGrid1.Col) = FlexComboCueDropDown
Case COL_COMBOBUTTON
VBFlexGrid1.Cell(FlexCellComboCue, VBFlexGrid1.Row, VBFlexGrid1.Col) = FlexComboCueButton
Case Else
VBFlexGrid1.Cell(FlexCellComboCue, VBFlexGrid1.Row, VBFlexGrid1.Col) = FlexComboCueNone
End Select
Else
VBFlexGrid1.Cell(FlexCellComboCue, VBFlexGrid1.Row, VBFlexGrid1.Col) = FlexComboCueNone
End If
LastRow = VBFlexGrid1.Row
LastCol = VBFlexGrid1.Col
End Sub
Private Sub VBFlexGrid1_MouseLeave()
VBFlexGrid1.ComboCue = FlexComboCueNone
VBFlexGrid1.ComboCueRow = -1
VBFlexGrid1.ComboCueCol = -1
End Sub
Private Sub VBFlexGrid1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
VBFlexGrid1.HitTest X, Y
If VBFlexGrid1.HitResult = FlexHitResultNoWhere Then
VBFlexGrid1.ComboCue = FlexComboCueNone
VBFlexGrid1.ComboCueRow = -1
VBFlexGrid1.ComboCueCol = -1
Exit Sub
End If
If VBFlexGrid1.HitRow >= VBFlexGrid1.FixedRows Then
Select Case VBFlexGrid1.HitCol
Case COL_CALENDARVALIDATION, COL_COMBODROPDOWN, COL_COMBOEDITABLE
VBFlexGrid1.ComboCue = FlexComboCueDropDown
VBFlexGrid1.ComboCueRow = VBFlexGrid1.HitRow
VBFlexGrid1.ComboCueCol = VBFlexGrid1.HitCol
Case COL_COMBOBUTTON
VBFlexGrid1.ComboCue = FlexComboCueButton
VBFlexGrid1.ComboCueRow = VBFlexGrid1.HitRow
VBFlexGrid1.ComboCueCol = VBFlexGrid1.HitCol
Case Else
VBFlexGrid1.ComboCue = FlexComboCueNone
VBFlexGrid1.ComboCueRow = -1
VBFlexGrid1.ComboCueCol = -1
End Select
Else
VBFlexGrid1.ComboCue = FlexComboCueNone
VBFlexGrid1.ComboCueRow = -1
VBFlexGrid1.ComboCueCol = -1
End If
End Sub
Yes. work as EXPECT. The hot tracking cue will shift to new mouse-on cell after selection, not the current editing cell because mouse is no more on last editing cell...It could confuse user on which is last editing cell.
IMO, keep cue indication is an another option, I prefer.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
Experimental feature 'AllowUserFreezing'.
Please test and report any behavior mismatch or suggestions.
After feedback it will be integrated into the current version.
Thanks
Thanks for this easy mode of freezing rows and/or columns. I tried each of the 'AllowUserFreezing' values (0 to 3) and all of them performed as expected.
Kind regards.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Dear Krool,
The fixed ComboCue (and DynamicCue on MouseMove too) is visible only if 'AllowUserEditing' is true. Is it possible to have fixed ComboCue visible even if 'AllowUserEditing' is false? Or, is it possible to have AllowUserEditing for a particular column alone?
Actually, in my grid, I want to allow only one column's cells (say 1st column's) to be editable by user. All other columns are non-editable. So, I want to keep 'AllowUserEditing' false and when 1st column cell is clicked, write my own processing code starting with ".StartEdit". But, I want the fixed ComboCue to be visible even before the 1st column cell is clicked. Also, in MouseMove event of 1st column, I want the ComboCues to be shown in the cells of the 1st column (i.e. even when 'AllowUserEditing' is false). Possible?
If not possible, as of now, then what is the best way to allow editing only in 1st column cells and disallow editing in all other columns' cells?
As of now, what I am doing is keeping 'AllowUserEditing' true (so that the ComboCues - both fixed and dynamic - show up normally) and when double-click happens on other columns' cells, I issue a .CancelEdit as follows.
Code:
Private Sub flx2_EnterEdit()
If flx2.Col <> 1 Then
flx2.CancelEdit
End If
End Sub
One problem with the above way to disallow editing is that the blue highlight shows up for a micro second, when I double-click on a cell.
1) Is there a "better" way to achieve what I require (than what I am doing)? I feel that there must be surely a better way out.
2) In case if my method is the way out, then how to avoid the blue highlighting for a microsecond? Not a major issue for me but just wish to know if it can be avoided.
Kind regards.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Is there also a BeforeEdit event in which you can cancel the input for given cells?
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Yes, use the BeforeEdit event. Check Row/Col and set Cancel to True to avoid that the edit will be initiated at all.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Update released.
AllowUserFreezing property now included.
Also the new AfterUserFreeze event fires after a user changed the number of frozen rows or columns.
A BeforeUserFreeze event is not included as it makes no sense. There is only 1 solid line for either frozen rows or columns.
So a cancelling is not meaningful as just setting AllowUserFreezing to Row only, Column only or Both is enough.
Included the new AfterUserResizeEnd event.
The AfterUserResize event has a ByRef NewSize As Long parameter where the app can influence the width/height that will be committed. (like in the ListView control)
However, it may be necessary to synchronize something after the new width/height got applied. This is now where the AfterUserResizeEnd fires.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Update released.
The escape key now cancels any ongoing divider drag operation.
This change will also be applied to the (yet already outdated) VBFLXGRD14.OCX.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
Update released.
The escape key now cancels any ongoing divider drag operation.
This change will also be applied to the (yet already outdated) VBFLXGRD14.OCX.
Thanks Krool, what I was wondering is how to do a Drag and Drop per column, also implement the same (per row and column) to another vbflexgrid (from vbFlexgrid1 to VbFlexgrid2)
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Dumb bug fixed.
SB_PAGE* scrolling now working propertly! (regression since 08-Sep-2021)
This affects mouse scrolling on the scrollbar only. (not page up/down keys)
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Included the AllowScrollLock property.
When the scroll lock key is toggled on it allows the user to use the arrow keys to scroll.
The new property defaults to False to not break compatibility or causing surprises by an accidently activate scroll lock.
Also the "overhead" of checking the toggled state for vbKeyScrollLock on all arrows keys input is only when AllowScrollLock is set to True.
The behavior is like in Excel, means arrows keys with..
.. shift state 0 and ctrl state 0 will scroll like a SB_LINE*
.. shift state <> 0 and ctrl state 0 will do nothing.
.. shift state 0 and ctrl state <> 0 will scroll like a SB_PAGE*
.. shift state <> 0 and ctrl state <> 0 will behave normal
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Hi! Krool,
your Grid control seems to be better then the ComponentOne grid control, however ComponentOne has the facility to print and save as pdf their control with the vsPrinter and vsPDF8 control.
Also SelectionMode has an option SelectionListBox (so when allowselection = false, the control will work a bit like a listbox, where you can select one row at a time. etc..)
do you have any plans of producing something like that.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
Included the AllowScrollLock property.
When the scroll lock key is toggled on it allows the user to use the arrow keys to scroll.
The new property defaults to False to not break compatibility or causing surprises by an accidently activate scroll lock.
Also the "overhead" of checking the toggled state for vbKeyScrollLock on all arrows keys input is only when AllowScrollLock is set to True.
The behavior is like in Excel, means arrows keys with..
.. shift state 0 and ctrl state 0 will scroll like a SB_LINE*
.. shift state <> 0 and ctrl state 0 will do nothing.
.. shift state 0 and ctrl state <> 0 will scroll like a SB_PAGE*
.. shift state <> 0 and ctrl state <> 0 will behave normal
Thanks krool for this nice add-on feature.
Kind regards.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Semke
Also SelectionMode has an option SelectionListBox (so when allowselection = false, the control will work a bit like a listbox, where you can select one row at a time. etc..)
Yes, that's planned. (Multi-selection on rows)
The idea is to have a selected state bit for a row. (RWIS_SELECTED)
This comes along then with a RowSelected r/w property and read only SelectedRow/SelectedRows property. (For enum like in vsFlexGrid)
What I'm not sure if I should add a selection mode ListBox/FreeListBox or have another boolean property "MultiSelect" which is only allowed for selection modes ByRow/FreeByRow.
This would keep a possibility open for CLIS_SELECTED maybe. (Multi select columns)
..
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Update released.
Included the AllowMultiSelection property. This property can only be set to True for SelectionMode 1 - ByRow or 3 - FreeByRow.
Included the RowSelected/SelectedRow/SelectedRows run-time property. These are automatically set when AllowMultiSelection is set to True.
However, they can be set by code even when AllowMultiSelection is set to False.
Improved AllowSelection property (when set to False) to not restrict..
- ColSel for SelectionMode 1 - ByRow
- RowSel for SelectionMode 2 - ByColumn
To note is that AllowMultiSelection and AllowSelection property are working together and do not restrict each other.
So, in fact it is a legal behavior to have AllowSelection = False and AllowMultiSelection = True.
EDIT:
Below an example to enumerate the selected rows. There are two possible ways.
#1
Code:
For i = 0 To VBFlexGrid1.Rows - 1
If VBFlexGrid1.RowSelected(i) = True Then
Debug.Print "Row: " & i
End If
Next i
#2
Code:
Dim i As Long
For i = 0 To VBFlexGrid1.SelectedRows - 1
Debug.Print "Row: " & VBFlexGrid1.SelectedRow(i)
Next i
-
1 Attachment(s)
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Included enum FlexFocusRectFlat for the FocusRect property.
It draws a solid rectangle (BackColorSel) instead of using the DrawFocusRect API.
Attachment 183055
The border width is determined by the GridLineWidth property and not by influenced by SPI_GETFOCUSBORDERWIDTH/SPI_GETFOCUSBORDERHEIGHT.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Update released.
When there are no frozen rows/cols (yet) and there are also no fixed rows/cols the user was not able to "UserFreeze" (AllowUserFreezing = True)
This has been fixed now.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Open question:
When GridLines are None or Raised the focus rect is in either case 1 pixel off. That's the same behavior as in MS(H)FlexGrid.
Shall this be fixed? (Not only focus rect, also in-place editing affected)
If yes, silent fix or by another property?
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
Open question:
When GridLines are None or Raised the focus rect is in either case 1 pixel off. That's the same behavior as in MS(H)FlexGrid.
Shall this be fixed? (Not only focus rect, also in-place editing affected)
If yes, silent fix or by another property?
Personally, I'd like to see you leave it exactly the same as the Microsoft version. Or, if you do fix it, fix it with an option, possibly with a True/False property that's named something like FixGridLinesOffset, and have it default to False.
And here's one rationale for that. I personally have custom controls that use the MSFlexGrid that have overlay textboxes and comboboxes for data entry. If/When I completely switch to your controls, I'd like to be able to do it with a straightforward "drop in", with no tweaking whatsoever.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Update released.
Included the SheetBorder property.
The default value is True which draws a border around the sheet. (Like MSFlexGrid)
When set to False it draws no such border. (Like MSHFlexGrid)
In vsFlexGrid this 'SheetBorder' specifies just a color, here a boolean.
I found it important to keep full compatibility with MSFlexGrid. Therefore it can't be a color, as the MSFlexGrid uses the fixed pen. (GridColorFixed)
And in vsFlexGrid to have "no border" the dev should set SheetBorder and BackColorBkg to the same color.
Here with the boolean it's truly no border and to behave like a MSHFlexGrid control.
Side question:
Is there a need to customize the appearance of the freeze pane borderlines? (E.g. GridLinesFrozen, GridColorFrozen)
Here I could enhance as no compatibility issue..
Currently it just uses the fixed pen.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
Is there a need to customize the appearance of the freeze pane borderlines? (E.g. GridLinesFrozen, GridColorFrozen)
Here I could enhance as no compatibility issue..
Currently it just uses the fixed pen.
Personally, I'll take all the options I can get. I already subclass the MS ListView to make it do several things it doesn't natively do ... specifically related to the color of things. I don't use MSFlexGrid nearly as much as I use ListView, but I do use it. The more options (especially in terms of style and colors), always the better.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Update released.
Quote:
Originally Posted by
Elroy
Personally, I'll take all the options I can get. I already subclass the MS ListView to make it do several things it doesn't natively do ... specifically related to the color of things. I don't use MSFlexGrid nearly as much as I use ListView, but I do use it. The more options (especially in terms of style and colors), always the better.
Thank you. Done. (GridColorFrozen/GridLinesFrozen/GridLineWidthFrozen)
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
EDIT:
The FocusRectWidth property has now a default value of -1, which exposes SPI_GETFOCUSBORDERWIDTH in that case. (affects only FlexFocusRectFlat)
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
Another question:
FocusRectWidth property is recently added for FlexFocusRectFlat.
That FocusRectWidth has a default value of 1 currently.
What about changing the default value to -1 and exposing either SPI_GETFOCUSBORDERHEIGHT or SPI_GETFOCUSBORDERWIDTH in that case ? (Either the higher or lesser of these two)
That's getting pretty esoteric for me ... and I'm not sure I've got an opinion at this time. I certainly don't currently use the FocusRectWidth property, so I've got no opinion on changing how that behaves. I've certainly got no objection to exposing some read-only properties.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Elroy
I certainly don't currently use the FocusRectWidth property, so I've got no opinion on changing how that behaves.
Nevermind.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Update released.
Bugfix in the internal DrawGrid routine. Merged rows/cols were just discarded partially in the freezing pane.
This is now fixed.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Elroy
Personally, I'd like to see you leave it exactly the same as the Microsoft version. Or, if you do fix it, fix it with an option, possibly with a True/False property that's named something like FixGridLinesOffset, and have it default to False.
And here's one rationale for that. I personally have custom controls that use the MSFlexGrid that have overlay textboxes and comboboxes for data entry. If/When I completely switch to your controls, I'd like to be able to do it with a straightforward "drop in", with no tweaking whatsoever.
I don't see a compatibility break, just a visual difference.
I just released an update so that all places take the offsets now from a central routine to make this more transparent.
Code:
Private Sub GetGridLineOffsets(ByVal iRow As Long, ByVal iCol As Long, ByRef GridLineOffsets As TGRIDLINEOFFSETS)
' The grid line offsets in MS(H)FlexGrid are hard-coded for all scenarios as per below values.
' However, in future these could be fixed by an opt-in property to get the correct values.
GridLineOffsets.LeftTop.CX = 0
GridLineOffsets.LeftTop.CY = 0
GridLineOffsets.RightBottom.CX = 1
GridLineOffsets.RightBottom.CY = 1
End Sub
Currently these are the values to be "visual compatible" with the MS(H)FlexGrid.
However, fixing this in future with an "FixGridLineOffsets" is perhaps the best idea.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Arnoutdv
Is there also a BeforeEdit event in which you can cancel the input for given cells?
I know you've been using the vsflexgrid for a long time and you have a good knowledge of its functionality in terms of events, methods and properties. I wonder to what extent this new control manages to reproduce the vsflexgrid features. Does this control allow you to merge cells, autosize rows and columns or other stuff such as Sort, BindToArray, GetMergedRange, LoadArray, SaveGrid etc. ? I am curious which is your opinion.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
I've not replaced the vsFlexGrid by the vbFlexGrid. There is also no need for me, because the vsFlexGrid does what it needs to do.
My experience with the vbFlexGrid is thus very limited.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Update released.
FixGridLineOffsets property included. It defaults to False to match behavior of the MS(H)FlexGrid control.
My own "todo" list is almost finished now so I may release OCX version 1.5 soon..
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
Update released.
FixGridLineOffsets property included. It defaults to False to match behavior of the MS(H)FlexGrid control.
My own "todo" list is almost finished now so I may release OCX version 1.5 soon..
Looking forward to 1.5, krool. Thanks a TON.
Kind regards.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
One open question. (concerning right-to-left)
The Alignment enum FlexAlignmentGeneral says that numbers and dates are left-aligned and otherwise right-aligned.
When RightToLeftLayout is True this is of course flipped.
However, when only RightToLeft is True (and RightToLeftLayout is False, means only RTL-Reading) then it is up to the coder to either right or left align accordingly.
But for FlexAlignmentGeneral there is no way to flip the alignment in that case.
Should I include an 'FlexAlignmentGeneralMirror' enum to have a solution in that case ?
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
One open question. (concerning right-to-left)
The Alignment enum FlexAlignmentGeneral says that numbers and dates are left-aligned and otherwise right-aligned.
When RightToLeftLayout is True this is of course flipped.
However, when only RightToLeft is True (and RightToLeftLayout is False, means only RTL-Reading) then it is up to the coder to either right or left align accordingly.
But for FlexAlignmentGeneral there is no way to flip the alignment in that case.
Should I include an 'FlexAlignmentGeneralMirror' enum to have a solution in that case ?
I answer this to myself now.
Having 2 General enums causes other issues.
So I decided to include a new property 'MirrorAlignGeneral'.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Included now ComboButtonAlignment/ColComboButtonAlignment property.
This may be helpful for right-to-left properties. For RightToLeftLayout = True it should stay as 1 - Right as the mirror placement flips it anyway. So this is just a need for rtl reading only.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
OCX 1.5 released.
Thanks a lot, Krool.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
I just updated the documentation and compile/update utility which now handles VBFLXGRDxx.OCX files up through the just-released v1.5 and VBCCRxx.OCX up through the current v1.7. It is located at the bottom of the post #1 in this thread.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Dear all,
Is it possible to bind (in some way or other) the VBFlexGrid to a database table so that as I scroll the grid, only the data pertaining to the visible rows get displayed in the VBFlexGrid? The other rows should not hold any data internally. Otherwise, I see (via task manager) that the memory used jumps up greatly. For my purposes, the non-visible rows not containing data is not an issue.
In fact, if the rows of the grid can be always set and maintained to a fixed value, equal to the number of visible rows (say 30), but corresponding data can still be shown (from the database table) just for visible rows alone [with col(0) showing the varying row(record) number, say 31 to 60 or 1100 to 1029 or 329001 to 329030 or ... or ..., as user scrolls the grid] that is even more ideal since I see that even empty rows (without any data) occupy a chunk of memory.
Of course, I can write code to achieve the above (I have some ideas on how to go about it) but just wanted to know whether any direct or a 'short and easy' method is already available so that I need not invest time to write my aforesaid code (which I think I might take some considerable time to develop, to get it running to perfection, since I am not anywhere near the experts like many of you here, to churn out the fastest and shortest codes, that too in so quick a time!, whenever the need arises).
Thanks in advance.
And, I take this opportunity to once again thank you Krool and all other great souls like you here in this Forum - Olaf and many more... God bless you all!
Kind regards.