-
1 Attachment(s)
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Updated released.
Label tips are displayed exactly over the cell label text. However, due to the fact that the font for the tool tip was not modified the overlay looked not perfect when the font differences were significant.
Now the label tip font is updated to the current cell font over which it is displayed to have an perfect overlay.
Attachment 190138
Info and scroll tips remain on the standard default font of the tool tip.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
27-Sep-2023
EndIncrementalSearch event is fired when the search has elapsed or ended.
Only when something was found. Why?
Quote:
Originally Posted by
Krool
27-Sep-2023
- Included IncrementalSearchString/IncrementalSearchRow/IncrementalSearchCol run-time property.
What for? How can I use it? Inside event handlers, these properties have default values.
Code:
Private Sub VBFlexGrid1_BeginIncrementalSearch( _
Row As Long, _
Col As Long, _
CaseSensitive As Boolean, _
NoWrap As Boolean, _
Direction As VBFLXGRD17.FlexFindDirectionConstants, _
Cancel As Boolean)
Debug.Print "======BeginIncrementalSearch========"
Debug.Print "IncrementalSearchRow:", VBFlexGrid1.IncrementalSearchRow
Debug.Print "IncrementalSearchCol:", VBFlexGrid1.IncrementalSearchCol
Debug.Print "IncrementalSearchString:", VBFlexGrid1.IncrementalSearchString
End Sub
Private Sub VBFlexGrid1_EndIncrementalSearch(ByVal Row As Long, _
ByVal Col As Long)
Debug.Print "-----------"
Debug.Print "IncrementalSearchRow:", VBFlexGrid1.IncrementalSearchRow
Debug.Print "IncrementalSearchCol:", VBFlexGrid1.IncrementalSearchCol
Debug.Print "IncrementalSearchString:", VBFlexGrid1.IncrementalSearchString
Debug.Print "EndIncrementalSearch"
End Sub
Immediate window:
Code:
======BeginIncrementalSearch========
IncrementalSearchRow: -1
IncrementalSearchCol: -1
IncrementalSearchString:
-----------
IncrementalSearchRow: -1
IncrementalSearchCol: -1
IncrementalSearchString:
EndIncrementalSearch
P.S. Maybe I need the IncrementalSearchInterval property too. I mean the 1000ms interval between key pressing. My grandma needs it.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Nouyana
Only when something was found. Why?
The incremental search string is only appended upon "success". When you begin an incremental search and there is not initial hit then it will "BeginIncrementalSearch" again and the IncrementalSearchString keeps null string, which means "not in incremental search" mode. So, it "never begun", why fire an "end" ?
I know that this "adding only upon success" is a different style of incremental search, but that allows to "re-try" with another key and to succeed. I like that kind of style.
EDIT:
But I understand your point. You have an "begin" event and even when you did not "cancel" it and you succeed. How do you know if it proceed or failed from the beginning ?
So, I would propose then a "RaiseEvent EndIncrementalSearch(-1, -1)" kind of thing. What do you mean?
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
The incremental search string is only appended upon "success". When you begin an incremental search and there is not initial hit then it will "BeginIncrementalSearch" again and the IncrementalSearchString keeps null string, which means "not in incremental search" mode. So, it "never begun", why fire an "end" ?
I know that this "adding only upon success" is a different style of incremental search, but that allows to "re-try" with another key and to succeed. I like that kind of style.
1. Ok, let the IncrementalSearchString be as it is. But we should somehow know what we are searching for in the BeginIncrementalSearch, should we?
2. I don't understand your style. Can you explain us how we should use the EndIncrementalSearch (an example)? Say, can we send any message to user if he doesn't find anything? Something like the "Turn off your CapsLock".
Quote:
Originally Posted by
Krool
So, I would propose then a "RaiseEvent EndIncrementalSearch(-1, -1)" kind of thing.
exactly
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Nouyana
exactly
Done.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Nouyana
1. Ok, let the IncrementalSearchString be as it is. But we should somehow know what we are searching for in the BeginIncrementalSearch, should we?
2. I don't understand your style. Can you explain us how we should use the EndIncrementalSearch (an example)? Say, can we send any message to user if he doesn't find anything? Something like the "Turn off your CapsLock".
What do you mean? The BeginIncrementalSearch is only fired once at the beginning.
Why do you wanna know what to search for? You want to know the CharCode at BeginIncrememtalSearch?
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
What do you mean? The BeginIncrementalSearch is only fired once at the beginning.
Why do you wanna know what to search for? You want to know the CharCode at BeginIncrememtalSearch?
I'm just trying to understand how to use it. And I have no any idea.
In my logic the BeginIncrementalSearch should fire every time we press a key. And yes, I wanna know the CharCode and the full string to search. Why? For a user input errors analyse. Or, may be for storing the search history. Or, maybe even for correct some letters (say, umlauts). Or...
Just in my logic the first question is "what you are searching for", and only the second one is "how do you wanna do it".
But ok, you have another logic of using it. Just tell us more about it, please. What was the idea? Where are IncrementalSearchString, IncrementalSearchRow and IncrementalSearchCol available?
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Nouyana
I'm just trying to understand how to use it. And I have no any idea.
In my logic the BeginIncrementalSearch should fire every time we press a key. And yes, I wanna know the CharCode and the full string to search. Why? For a user input errors analyse. Or, may be for storing the search history. Or, maybe even for correct some letters (say, umlauts). Or...
Just in my logic the first question is "what you are searching for", and only the second one is "how do you wanna do it".
But ok, you have another logic of using it. Just tell us more about it, please. What was the idea? Where are IncrementalSearchString, IncrementalSearchRow and IncrementalSearchCol available?
The IncrementalSearchString, IncrementalSearchRow and IncrementalSearchCol are usable after the "BeginIncrementalSearch" and before the "EndIncrementalSearch".
So, yes we may add an extra "IncrementalSearch" event which is fired after "BeginIncrementalSearch" (which is used to store settings for the lifetime of the current search) and fired on every char code, including the first char code. In this event the IncrementalSearchString, IncrementalSearchRow and IncrementalSearchCol would be usable.
Another question. You want a IncrementalSearchInterval As Long property. The default value would be -1 which then reports the "GetDoubleClickTime() * 2" interval. Anything other would override this interval.
But how to treat an interval set of 0 ? Allow or disallow ? Currently it would mean "infinite" time.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
So, yes we may add an extra "IncrementalSearch" event which is fired after "BeginIncrementalSearch" (which is used to store settings for the lifetime of the current search) and fired on every char code, including the first char code. In this event the IncrementalSearchString, IncrementalSearchRow and IncrementalSearchCol would be usable.
So, let it be.
Quote:
Originally Posted by
Krool
Another question. You want a IncrementalSearchInterval As Long property. The default value would be -1 which then reports the "GetDoubleClickTime() * 2" interval. Anything other would override this interval.
But how to treat an interval set of 0 ? Allow or disallow ? Currently it would mean "infinite" time.
Not only 0 is a problem. I would do it like that:
Code:
If IncrementalSearchInterval < 100 Then
IncrementalSearchInterval = GetDoubleClickTime() * 2
ElseIf IncrementalSearchInterval > 20000 Then
IncrementalSearchInterval = 20000
End If
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Nouyana
So, let it be.
Not only 0 is a problem. I would do it like that:
Code:
If IncrementalSearchInterval < 100 Then
IncrementalSearchInterval = GetDoubleClickTime() * 2
ElseIf IncrementalSearchInterval > 20000 Then
IncrementalSearchInterval = 20000
End If
No, -1 would be no problem. If it's internally -1 it reports at Get property GetDoubleClickTime() * 2.
So your app code could be:
Code:
If IncrementalSearchInterval < 100 Then
IncrementalSearchInterval = 100
ElseIf IncrementalSearchInterval > 20000 Then
IncrementalSearchInterval = 20000
End I
To restore default just set:
Code:
IncrementalSearchInterval = -1
Can you provide pseudo code of how you would use such "new" IncrementalSearch event ?
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
No, -1 would be no problem. If it's internally -1 it reports at Get property GetDoubleClickTime() * 2.
So your app code could be:
Code:
If IncrementalSearchInterval < 100 Then
IncrementalSearchInterval = 100
ElseIf IncrementalSearchInterval > 20000 Then
IncrementalSearchInterval = 20000
End I
I wasn't talking about my app, but about VBFlexGrid code as you asked. Let it be -1:
Code:
If IncrementalSearchInterval < 100 Then
IncrementalSearchInterval = -1
ElseIf IncrementalSearchInterval > 20000 Then
IncrementalSearchInterval = 20000
End If
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
Can you provide pseudo code of how you would use such "new" IncrementalSearch event ?
Maybe like that:
Code:
Private History As New Collection
Private TempStr As String
Private Sub VBFlexGrid1_IncrementalSearch( _
ByVal Row As Long, _
ByVal Col As Long, _
ByVal CaseSensitive As Boolean, _
ByVal NoWrap As Boolean, _
ByVal Direction As VBFLXGRD17.FlexFindDirectionConstants, _
ByVal Success As Boolean, _
ByVal CharCode As Long)
Const RECORD_ID = 0
Const COUNTRY = 1
If Not Success Then ' If nothing was found, then...
If Direction < 2 Then ' Up or Down.
Select Case Col
Case RECORD_ID ' Only digits here.
If (CharCode < 48) Or (CharCode > 57) Then
MsgBox "This column may contain digits only."
End If
Case COUNTRY ' First letter should be capital.
If Len(VBFlexGrid1.IncrementalSearchString) = 1 _
And Not IsCapital(CharCode) Then
MsgBox "The first letter should be capital here."
End If
End Select
Else ' Left or Right.
Select Case Row
Case 1
' ...
End Select
End If
Else ' If something was found.
TempStr = VBFlexGrid1.IncrementalSearchString
End If
End Sub
Private Sub VBFlexGrid1_EndIncrementalSearch(ByVal Row As Long, _
ByVal Col As Long)
If LenB(TempStr) Then History.Add TempStr
TempStr = ""
End Sub
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
[B]
- CellHasCustomFormatting/CellHasTag property which returns True if memory is allocated. Set to False to release the memory or True to force allocation.
Both properties have a bug.
Code:
Private Sub Command1_Click()
With VBFlexGrid1
.FillStyle = FlexFillStyleRepeat ' Should work with ranges
.SelectRange 1, 1, 3, 1
.CellTag = "tag"
Debug.Print .CellHasTag ' Returns True
.SelectRange 5, 1, 1, 1 ' Selection in reverse order.
Debug.Print .CellHasTag ' Returns False (THE BUG)
.CellHasTag = False ' Works fine.
End With
End Sub
Private Sub Command2_Click()
With VBFlexGrid1
.FillStyle = FlexFillStyleRepeat ' Should work with ranges
.SelectRange 1, 1, 3, 1
.CellBackColor = vbGreen
Debug.Print .CellHasCustomFormatting ' Returns True
.SelectRange 5, 1, 1, 1 ' Selection in reverse order.
Debug.Print .CellHasCustomFormatting ' Returns False (THE BUG)
.CellHasCustomFormatting = False ' Works fine.
End With
End Sub
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Nouyana
Both properties have a bug.
Code:
Private Sub Command1_Click()
With VBFlexGrid1
.FillStyle = FlexFillStyleRepeat ' Should work with ranges
.SelectRange 1, 1, 3, 1
.CellTag = "tag"
Debug.Print .CellHasTag ' Returns True
.SelectRange 5, 1, 1, 1 ' Selection in reverse order.
Debug.Print .CellHasTag ' Returns False (THE BUG)
.CellHasTag = False ' Works fine.
End With
End Sub
Private Sub Command2_Click()
With VBFlexGrid1
.FillStyle = FlexFillStyleRepeat ' Should work with ranges
.SelectRange 1, 1, 3, 1
.CellBackColor = vbGreen
Debug.Print .CellHasCustomFormatting ' Returns True
.SelectRange 5, 1, 1, 1 ' Selection in reverse order.
Debug.Print .CellHasCustomFormatting ' Returns False (THE BUG)
.CellHasCustomFormatting = False ' Works fine.
End With
End Sub
That's not a bug. The FillStyle is only applicable for Let Cell*.
The Get Cell* always returns the current row/col cell information.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Nouyana
Maybe like that:
Code:
Private History As New Collection
Private TempStr As String
Private Sub VBFlexGrid1_IncrementalSearch( _
ByVal Row As Long, _
ByVal Col As Long, _
ByVal CaseSensitive As Boolean, _
ByVal NoWrap As Boolean, _
ByVal Direction As VBFLXGRD17.FlexFindDirectionConstants, _
ByVal Success As Boolean, _
ByVal CharCode As Long)
Const RECORD_ID = 0
Const COUNTRY = 1
If Not Success Then ' If nothing was found, then...
If Direction < 2 Then ' Up or Down.
Select Case Col
Case RECORD_ID ' Only digits here.
If (CharCode < 48) Or (CharCode > 57) Then
MsgBox "This column may contain digits only."
End If
Case COUNTRY ' First letter should be capital.
If Len(VBFlexGrid1.IncrementalSearchString) = 1 _
And Not IsCapital(CharCode) Then
MsgBox "The first letter should be capital here."
End If
End Select
Else ' Left or Right.
Select Case Row
Case 1
' ...
End Select
End If
Else ' If something was found.
TempStr = VBFlexGrid1.IncrementalSearchString
End If
End Sub
Private Sub VBFlexGrid1_EndIncrementalSearch(ByVal Row As Long, _
ByVal Col As Long)
If LenB(TempStr) Then History.Add TempStr
TempStr = ""
End Sub
I guess for that you better make a "find dialog".
The IncrementalSearch is intended for quick search and without MsgBox intervention... it just highlights the facts you typed.
As in ListView or TreeView the .IncrementalSearchString is only to know from outside, async or by a timer, if the control is in incremental search mode.
So you could start a low interval timer in BeginIncrementalSearch and terminate it in EndIncrementalSearch.
Thanks again for the good point to raise EndIncrementalSearch in all cases, even when failed.
It won't fire of course when cancelled in BeginIncrementalSearch.
Just like a cancel in BeforeEdit will not raise an AfterEdit..
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Hi,
Sure it's my fault, but maybe i found something wrong?
In: Private Sub VBFlexGrid1_MouseUp
I have a loop:
Code:
For JJ = 1 To .Rows - 1
.... more code here
If .TextMatrix(JJ, .ColIndex("hojaruta")) = "NO" Then
.Cell(FlexCellBackColor, JJ, .ColIndex("hojaruta")) = vbYellow
Else
.Cell(FlexCellBackColor, JJ, .ColIndex("hojaruta")) = .Cell(FlexCellBackColor, JJ, 1)
End If
next jj
It's always painting white (it's the color for backcolor i use), but when the row is blue (backcolorAlt), it's painting white too.
I want to paint all the line with the same color, example:
Attachment 190195
Two of the "SI" cells must be blue, or i'm wrong ?
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
... it just highlights the facts you typed.
Only when you have found something. User may don't know about CaseSensitive = True or wrong Direction. You are good programmer, Krool. Really. But I'm a user. The economist. Maybe my example was not so good, but with so many parameters, errors are inevitable. It needs feedback.
Quote:
Originally Posted by
Krool
So you could start a low interval timer in BeginIncrementalSearch and terminate it in EndIncrementalSearch.
Are you serious?
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
At least you may clean up the IncrementalSearchString right after the RaiseEvent EndIncrementalSearch
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Nouyana
Only when you have found something. User may don't know about CaseSensitive = True or wrong Direction. You are good programmer, Krool. Really. But I'm a user. The economist. Maybe my example was not so good, but with so many parameters, errors are inevitable. It needs feedback.
Are you serious?
Yes, incremental search is just a niche feature for certain power users.
You should promote a proper find dialog with all kinds of interaction to properly search.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Update released.
Included the CanPaste function. The Paste method pastes only when there is a text format available in the clipboard. (like in the RichTextBox)
Included the IncrementalSearchTime run-time property. It can be set to 0 to have infinite time. Apply -1 to restore default time.
Included the AllowDropFiles property and DropFiles event.
The OCX VBFLXGRD17 was also updated. The internal type lib version is now 1.3.
Code:
Object={2DA70529-3366-414A-B408-46083BCD481B}#1.3#0; VBFLXGRD17.OCX
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Nouyana,
I can offer following event which would allow GUI intervention. Of course showing a MsgBox causes a loose of focus and thus ends the incremental search. An EndIncrementalSearch event would follow then.
Code:
Private Sub VBFlexGrid1_IncrementalSearch( _
ByVal Row As Long, ByVal Col As Long, _
ByVal CharCode As Long, _
ByVal CaseSensitive As Boolean, _
ByVal NoWrap As Boolean, _
ByVal Direction As FlexFindDirectionConstants, _
ByVal FoundIndex As Long)
' FoundIndex is -1 on failure. IncrementalSearchString is unchanged in this case.
' CharCode can be 8 (non-printable) for backspace key.
' IncrementalSearchRow/Col indicates the highlight painted cell, if any.
End Sub
Quote:
Originally Posted by
Nouyana
At least you may clean up the IncrementalSearchString right after the RaiseEvent EndIncrementalSearch
That's intended to have everything cleaned up at EndIncrementalSearch event.
When you have a new IncrementalSearch event you can cache the IncrementalSearchString property in a local variable.
EDIT:
IncrementalSearch event now included.
OLEDragDropScrollOrientation property also included. This can be helpfull to restrict OLE drag/drop scroll only to vertical or only to horizontal. The default is both.
The OCX VBFLXGRD17 was also updated. The internal type lib version is now 1.4.
Code:
Object={2DA70529-3366-414A-B408-46083BCD481B}#1.4#0; VBFLXGRD17.OCX
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
IncrementalSearch event now included.
Man, you are the best! I knew it! https://www.vbforums.com/images/ieimages/2024/01/2.gif
Ok, the next question is about VB_HelpID attribute. Can you fill it for all the properties/events/methods?
EDITED:
Not now. Some of them should be grouped.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Is the VB_HelpID attribute the Help Context ID ? Hmm.. what should I fill in ? Never used it. I need some advise here :)
-
1 Attachment(s)
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
Is the VB_HelpID attribute the Help Context ID ?
Yes.
Quote:
Originally Posted by
Krool
Hmm.. what should I fill in ? Never used it. I need some advise here :)
The same way you've added descriptions:
Attachment 190231
In the text editor you will see:
Code:
Public Property Get AllowMultiSelection() As Boolean
Attribute AllowMultiSelection.VB_Description = "Returns/sets a value indicating if the flex grid enables selection of multiple (non-contiguous) ranges of cells."
Attribute AllowMultiSelection.VB_HelpID = 165897
AllowMultiSelection = PropAllowMultiSelection
End Property
But wait. Let me finish all the help files in the MS Word. Then I will group some articles (they will have the same Help Context ID). Ok?
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
Of course showing a MsgBox causes a loose of focus and thus ends the incremental search. An EndIncrementalSearch event would follow then.
No, it wouldn't.
Code:
Private Sub VBFlexGrid1_BeginIncrementalSearch(Row As Long, _
Col As Long, _
CaseSensitive As Boolean, _
NoWrap As Boolean, _
Direction As VBFLXGRD17.FlexFindDirectionConstants, _
Cancel As Boolean)
Debug.Print "BeginIncrementalSearch"
' VBFlexGrid1.IncrementalSearchTime = 0
End Sub
Private Sub VBFlexGrid1_IncrementalSearch(ByVal Row As Long, _
ByVal Col As Long, _
ByVal CharCode As Long, _
ByVal CaseSensitive As Boolean, _
ByVal NoWrap As Boolean, _
ByVal Direction As VBFLXGRD17.FlexFindDirectionConstants, _
ByVal FoundIndex As Long)
Debug.Print "IncrementalSearch"
MsgBox ""
End Sub
Private Sub VBFlexGrid1_EndIncrementalSearch(ByVal Row As Long, _
ByVal Col As Long)
Debug.Print "EndIncrementalSearch"
End Sub
Immediate window:
Code:
BeginIncrementalSearch
IncrementalSearch
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Nouyana
No, it wouldn't.
Code:
Private Sub VBFlexGrid1_BeginIncrementalSearch(Row As Long, _
Col As Long, _
CaseSensitive As Boolean, _
NoWrap As Boolean, _
Direction As VBFLXGRD17.FlexFindDirectionConstants, _
Cancel As Boolean)
Debug.Print "BeginIncrementalSearch"
' VBFlexGrid1.IncrementalSearchTime = 0
End Sub
Private Sub VBFlexGrid1_IncrementalSearch(ByVal Row As Long, _
ByVal Col As Long, _
ByVal CharCode As Long, _
ByVal CaseSensitive As Boolean, _
ByVal NoWrap As Boolean, _
ByVal Direction As VBFLXGRD17.FlexFindDirectionConstants, _
ByVal FoundIndex As Long)
Debug.Print "IncrementalSearch"
MsgBox ""
End Sub
Private Sub VBFlexGrid1_EndIncrementalSearch(ByVal Row As Long, _
ByVal Col As Long)
Debug.Print "EndIncrementalSearch"
End Sub
Immediate window:
Code:
BeginIncrementalSearch
IncrementalSearch
Well, the EndIncrementalSearch will fire after the MsgBox when FoundIndex is -1.
If it's <> -1 it may fire "while the MsgBox is shown" due to the timer that will raise the ending because when FoundIndex is -1 from the start on the timer isn't active which it can't be active because the IncrementalSearchString is still vbNullString.
EDIT: It's not due to the timer. Because the timer will be activated after IncrementalSearch event. It's because due to WM_KILLFOCUS.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
Well, the EndIncrementalSearch will fire after the MsgBox when FoundIndex is -1.
Only if it was the first key pressed (first char). But it's ok. Just we should know how it works. Personally, I no longer need the EndIncrementalSearch event handler at all. Everything I need is in the IncrementalSearch handler.
Quote:
Originally Posted by
Krool
That's not a bug. The FillStyle is only applicable for Let Cell*.
The Get Cell* always returns the current row/col cell information.
Then why do we need the CellHasTag property? Theese two commands will always return the same results:
Code:
With VBFlexGrid1
Debug.Print IsEmpty(.CellTag)
Debug.Print Not .CellHasTag
End With
This is a rhetorical question. But maybe you want to change something.
Edited:
We can clean up all the tags using the CellHasTag property. But the same result is:
Code:
With VBFlexGrid1
.Clear FlexClearSelection, FlexClearTag
.CellHasTag = False
End With
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Nouyana
Only if it was the first key pressed (first char). But it's ok. Just we should know how it works. Personally, I no longer need the
EndIncrementalSearch event handler at all. Everything I need is in the
IncrementalSearch handler.
Then why do we need the
CellHasTag property? Theese two commands will always return the same results:
Code:
With VBFlexGrid1
Debug.Print IsEmpty(.CellTag)
Debug.Print Not .CellHasTag
End With
This is a rhetorical question. But maybe you want to change something.
Edited:
We can clean up all the tags using the
CellHasTag property. But the same result is:
Code:
With VBFlexGrid1
.Clear FlexClearSelection, FlexClearTag
.CellHasTag = False
End With
A CellTag can be "Empty" but memory was allocated. The CellHasTag is more meant on the memory side, if a tag was allocated at all.
Of course a non-allocated tag in CellTag returns also Empty because that's the default state of a Variant.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
The way I would do is to have a ErrorString and show a MsgBox at EndIncrementalSearch event when it's not a NullString.
Because the incrementalsearch is disrupted (WM_KILLFOCUS will cancel the incremental search) when showing a MsgBox inside that event.
Showing a MsgBox at EndIncrementalSearch event is safe.
EDIT: And send WM_CANCELMODE upon IncrementalSearch event when an ErrorString is set which will be MsgBox'ed at EndIncrementalSearch event.
I could also make internally a flag called "NoLostFocus" during that event to not cancel the incremental search when showing a MsgBox during the IncrementalSearch event. What do you mean?
-
2 Attachment(s)
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
Included the ColImageList As Variant property. (like in vsFlexGrid)
This code works differently for VBFlexGrid+CCR ImageList and vsFlexGrid+MS ImageList.
It seems that vsFlexGrid has a bug :confused: Or am I doing something wrong?
Code:
Private Sub Command1_Click()
With ImageList1
.ListImages.Add , , LoadPicture(MY_ICON_01)
.ListImages.Add , , LoadPicture(MY_ICON_02)
.ListImages.Add , , LoadPicture(MY_ICON_03)
.ListImages.Add , , LoadPicture(MY_ICON_04)
.ListImages.Add , , LoadPicture(MY_ICON_05)
.ListImages.Add , , LoadPicture(MY_ICON_06)
End With
With FlexGrid1
.ColImageList(0) = ImageList1.hImageList
End With
End Sub
Attachment 190258Attachment 190261
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
I could also make internally a flag called "NoLostFocus" during that event to not cancel the incremental search when showing a MsgBox during the IncrementalSearch event. What do you mean?
Sounds good if it's possible. I mean a flag within the VBFlexGrid code, but not a event's parameter.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Nouyana
This code works differently for
VBFlexGrid+CCR ImageList and
vsFlexGrid+MS ImageList.
It seems that vsFlexGrid has a bug :confused: Or am I doing something wrong?
Code:
Private Sub Command1_Click()
With ImageList1
.ListImages.Add , , LoadPicture(MY_ICON_01)
.ListImages.Add , , LoadPicture(MY_ICON_02)
.ListImages.Add , , LoadPicture(MY_ICON_03)
.ListImages.Add , , LoadPicture(MY_ICON_04)
.ListImages.Add , , LoadPicture(MY_ICON_05)
.ListImages.Add , , LoadPicture(MY_ICON_06)
End With
With FlexGrid1
.ColImageList(0) = ImageList1.hImageList
End With
End Sub
Attachment 190258Attachment 190261
Yeah there is a difference.
VBFlexGrid allows to set a ImageList object or just an handle.
If the text is numeric it treats as one-based index.
If an object was set it retrieves by it's index or key via .ListImages(x).
An for object it must be one-based. To have different behavior would be odd.
VBFlexGrid has also the CellImageCallback event where you can "set" the image from custom source, or from cell tag whatever.
vsFlexGrid only allows zero-based indexes and handle.
So yes, that's a wanted difference.
EDIT:
Quote:
Originally Posted by
Nouyana
Sounds good if it's possible. I mean a flag within the VBFlexGrid code, but not a event's parameter.
done
-
2 Attachment(s)
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Hello, Krool!
Excuse me:
When reading data from the database to VBFlexGrid, when the field property is a Boolean value, how to automatically set the checkbox of VBFlexGrid to checked/unchecked according to the field value (just like the display in VSFlexGrid). I tried the method in the attachment but it didn't work as expected.
Thank you so much for helping me!
Attachment 190358
Attachment 190359
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Hi,anybody knows how to limt a cell only to receive "+-.1234567890" and backspace ? Thanks.
John
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
smileyoufu
When reading data from the database to VBFlexGrid, when the field property is a Boolean value, how to automatically set the checkbox of VBFlexGrid to checked/unchecked according to the field value (just like the display in VSFlexGrid). I tried the method in the attachment but it didn't work as expected.
Set CellChecked to FlexTextAsCheckBox.
Quote:
Originally Posted by
JT870
Hi,anybody knows how to limt a cell only to receive "+-.1234567890" and backspace ? Thanks.
Process the EditKeyPress event and set KeyChar to 0 fur unwanted chars.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Hi,Krool,
It can work to put the following code in EditKeyPress event.
'Process the EditKeyPress event and set KeyChar to 0 for unwanted chars.
Private Sub grdInput_EditKeyPress(KeyChar As Integer)
Dim S$
Select Case KeyChar
Case 48 To 57 '0-9
Case 46 'dot
S = grdInput.EditText
If Not VBA.IsNumeric(S) Then
KeyChar = 0: Exit Sub
End If
If InStr(1, S, ".") > 1 Then KeyChar = 0 'Limit the multi-dots input
Case 43 '+
KeyChar = 0 'Not allowed to input
Case 45 '-
KeyChar = 0 'Not allowed to input
Case 8 'BACKSPACE
Case 127 'DEL
Case 13 'ENTER
Case Else
KeyChar = 0
End Select
End Sub
During my test, I found that if clearing the cell and press the ENTER key, the input cursor line moves to the cell's left,the number input is changed before the cursor. how to avoid this case? in addition, I want to auto check the input not as the format: 01.12,0000.12, just as input 1.12, 0.12, how to do it? sorry for the stupied question.
Thanks again.
John.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
TheLeePiper
Loving the control. Great work. One request: can you add (or is it possible to code a workaround) to add a cell border? We are hoping to use the control as an update to a very old grid control (Protoview DataTable) that was very capable as a data entry device (but has a look-and-feel rushing headlong into 1999). This is what we have and would like to do with FG. Thanks!
Attachment 189706
Hmm.. I am open to include such a feature. It's just question of "how".
The vsFlexGrid has a CellBorder method , see https://helpcentral.componentone.com...rdermethod.htm
However, I am wondering how that's implemented. If it's something inside the cell properties... which costs memory if implemented likewise.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Thanks so much. I looked at the vsFlexGrid API calls. For reference, the DataTable API looks like:
Datatbl1.CellSet(0,0).BorderColor = RGB(255, 0, 0)
Datatbl1.CellSet(0,0).BorderWidth = 1
CellSet can point to any arbitrary cell, CurCell to the cell with focus. Any cell where the BorderWidth is zero (the default) does not show a border. Not quite sure how this might map to the VBFlexGrid.
Borders are inside the grid, which of course, would affect ComboButton sizing (which it does with the DataTable). Just ignorantly free-thinking here, could it be a variant of the FlexCellBackColor usage? Instead of coloring the whole cell BG, it could be just an inset width? Set the right-side inset from any ComboButton so you would not need to modify the buttons? (Not quite the same as the DataTable, but would be very suitable for our needs.) Thanks again.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
A bug?
Code:
Private Sub Command1_Click()
With VBFlexGrid1
.Align = vbAlignTop ' If Align = vbAlignTop
Set .Container = Picture1 ' and the Container is set to a PictureBox
.ScrollBars = vbVertical ' then I can't see any scrollbars.
End With
End Sub
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
02-Oct-2023
- Included the ClientLeft/ClientTop and ClientWidth/ClientHeight read-only/run-time property.
Maybe we need a read/write BorderWidth property?
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
Delete respects now the ClipMode (= ExcludeHidden)
Doesn't work for me.
Code:
Private Sub Command1_Click()
With VBFlexGrid1
.ClipPasteMode = FlexClipPasteModeNormal
.Col = 1: .Row = 1
.ColSel = 3: .RowSel = 2
.ColHidden(2) = True
.Delete ' The hidden col(2) was cleaned too
' .Clear FlexClearClip, FlexClearText
.ColHidden(2) = False
.SetFocus
End With
End Sub
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Nouyana
Doesn't work for me.
Code:
Private Sub Command1_Click()
With VBFlexGrid1
.ClipPasteMode = FlexClipPasteModeNormal
.Col = 1: .Row = 1
.ColSel = 3: .RowSel = 2
.ColHidden(2) = True
.Delete ' The hidden col(2) was cleaned too
' .Clear FlexClearClip, FlexClearText
.ColHidden(2) = False
.SetFocus
End With
End Sub
Delete "respects" the ClipMode property. By that you need to set it of course to ExcludeHidden.
Add below code and it suddenly works.
Code:
.ClipMode = FlexClipModeExcludeHidden
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
By that you need to set it of course to ExcludeHidden.
https://www.vbforums.com/images/ieimages/2024/02/2.gif
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Included enum FlexDirectionAfterReturnEdit/FlexEditReasonReturn.
By this the edit mode is initiated by the return key, but only when shift state is 0.
It is intentionality included in the DirectionAfterReturn property to not change default behavior and it's logical because you can either move the cursor or start edit mode, but not both.
The OCX VBFLXGRD17 was also updated. The internal type lib version is now 1.5.
Code:
Object={2DA70529-3366-414A-B408-46083BCD481B}#1.5#0; VBFLXGRD17.OCX
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Krool, did you notice my message?
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Nouyana
A bug?
Code:
Private Sub Command1_Click()
With VBFlexGrid1
.Align = vbAlignTop ' If Align = vbAlignTop
Set .Container = Picture1 ' and the Container is set to a PictureBox
.ScrollBars = vbVertical ' then I can't see any scrollbars.
End With
End Sub
Do you adjust the width/height of the VBFlexGrid so it fits into the PictureBox?
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
Do you adjust the width/height of the VBFlexGrid so it fits into the PictureBox?
I use the Align = vbAlignTop only. It adjusts the width. Nothing more.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Nouyana
I use the Align = vbAlignTop only. It adjusts the width. Nothing more.
Well, the code makes no sense. Because first of all the Align property works only when placed on a Form. Not in a PictureBox.
And you set the Align "prior" to changing the container. So the FlexGrid Width is then qual to the Form Width. Is that intended by you?
If your PictureBox width is now "smaller" then guess what, you don't "see" the scrollbars.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
Align property works only when placed on a Form.
I didn't know it. Can you fix it?
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Nouyana
I didn't know it. Can you fix it?
No I can't. Align is a vb6 property.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Hello Mr. Krool,
I need your help.
I get the following error: ERROR VBCCR17 Run-time error '50003'; Unexpected error.
I have a form where I am using imagelist as an image container for a menu bar,
the icons are 16x16 pixels, generated from .svg files (with old traditional .ico no problem),
In Windows 10 I do not have any problem,
the problem occurs in some versions of windows 7 service pack 1,
I have tried it on a vm with windows 7 sp1 and it has not given me any problems.
What library do you use to load the images that may be outdated in these Windows.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
vb6nostalgia
Hello Mr. Krool,
I need your help.
I get the following error: ERROR VBCCR17 Run-time error '50003'; Unexpected error.
I have a form where I am using imagelist as an image container for a menu bar...
You should repost it here.
https://www.vbforums.com/images/ieimages/2024/02/3.gif
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
TheLeePiper
Thanks so much. I looked at the vsFlexGrid API calls. For reference, the DataTable API looks like:
Datatbl1.CellSet(0,0).BorderColor = RGB(255, 0, 0)
Datatbl1.CellSet(0,0).BorderWidth = 1
CellSet can point to any arbitrary cell, CurCell to the cell with focus. Any cell where the BorderWidth is zero (the default) does not show a border. Not quite sure how this might map to the VBFlexGrid.
Borders are inside the grid, which of course, would affect ComboButton sizing (which it does with the DataTable). Just ignorantly free-thinking here, could it be a variant of the FlexCellBackColor usage? Instead of coloring the whole cell BG, it could be just an inset width? Set the right-side inset from any ComboButton so you would not need to modify the buttons? (Not quite the same as the DataTable, but would be very suitable for our needs.) Thanks again.
I am still struggling of "best way".
How about a CellGridLines property which overwrites the general grid lines?
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Nouyana
Thank you. I was in the wrong place.
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
I am still struggling of "best way".
How about a CellGridLines property which overwrites the general grid lines?
That absolutely could work. Would this cell border thickness need to be the same as the default GridLineWidth?
Just for reference, we use cell BG colors for navigation control (i.e, to determine a tab stop for editing). For a new theme, we want to have white grid BG and grid line with "tab stop" cells that are slightly-off-white and a dark cell border for the visual indicator of these cells. (In other themes, the grid BGs are non-white and cell BGs are sufficiently different, so no border is needed. But we may add the border to these anyway for additional distinction.)
Thanks!
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
TheLeePiper
That absolutely could work. Would this cell border thickness need to be the same as the default GridLineWidth?
Just for reference, we use cell BG colors for navigation control (i.e, to determine a tab stop for editing). For a new theme, we want to have white grid BG and grid line with "tab stop" cells that are slightly-off-white and a dark cell border for the visual indicator of these cells. (In other themes, the grid BGs are non-white and cell BGs are sufficiently different, so no border is needed. But we may add the border to these anyway for additional distinction.)
Thanks!
On second thought. The gridline is drawn "between" cells. So 1 physical cell does not draw the entire gridline for itself. Only half, the other half is drawn by the left and top neighbor cell.
So, I guess your request does not really "fit" for VBFlexGrid and I am afraid to reject your request until a good idea approaches.
I checked with the vsFlexGrid and the CellBorder function is not respected by anything. (focus rect, combo button etc.) so it's just a "rectangle drawn over".
-
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
-
1 Attachment(s)
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Quote:
Originally Posted by
Krool
Included the ColWordWrapOption/ColWordWrapOptionFixed run-time property.
This was an over-due feature missing from the MSHFlexGrid.
Now it is possible to overwrite per column from the default text formatting of the general WordWrap and SingleLine property.
Ok. Only two questions left. What is the difference between:
1. FlexWordBreakEndEllipsis and FlexWordBreakWordEllipsis.
2. FlexSingleLineEndEllipsis and FlexSingleLineWordEllipsis
Attachment 190455