Page 31 of 42 FirstFirst ... 212829303132333441 ... LastLast
Results 1,201 to 1,240 of 1650

Thread: VBFlexGrid Control (Replacement of the MSFlexGrid control)

  1. #1201

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,728

    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.

    Name:  FlexLabelTipFont.png
Views: 1206
Size:  2.8 KB

    Info and scroll tips remain on the standard default font of the tool tip.
    Last edited by Krool; Jan 25th, 2024 at 12:32 PM.

  2. #1202
    Hyperactive Member
    Join Date
    May 2018
    Location
    Russia
    Posts
    343

    Question Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by Krool View Post
    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 View Post
    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.

  3. #1203

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,728

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by Nouyana View Post
    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?
    Last edited by Krool; Jan 27th, 2024 at 03:44 PM.

  4. #1204
    Hyperactive Member
    Join Date
    May 2018
    Location
    Russia
    Posts
    343

    Question Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by Krool View Post
    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 View Post
    So, I would propose then a "RaiseEvent EndIncrementalSearch(-1, -1)" kind of thing.
    exactly
    Last edited by Nouyana; Jan 27th, 2024 at 04:06 PM.

  5. #1205

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,728

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by Nouyana View Post
    exactly
    Done.

  6. #1206

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,728

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by Nouyana View Post
    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?

  7. #1207
    Hyperactive Member
    Join Date
    May 2018
    Location
    Russia
    Posts
    343

    Question Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by Krool View Post
    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?
    Last edited by Nouyana; Jan 28th, 2024 at 04:48 AM. Reason: spelling errors

  8. #1208

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,728

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by Nouyana View Post
    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.

  9. #1209
    Hyperactive Member
    Join Date
    May 2018
    Location
    Russia
    Posts
    343

    Arrow Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by Krool View Post
    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 View Post
    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

  10. #1210

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,728

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by Nouyana View Post
    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 ?

  11. #1211
    Hyperactive Member
    Join Date
    May 2018
    Location
    Russia
    Posts
    343

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by Krool View Post
    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

  12. #1212
    Hyperactive Member
    Join Date
    May 2018
    Location
    Russia
    Posts
    343

    Arrow Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by Krool View Post
    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

  13. #1213
    Hyperactive Member
    Join Date
    May 2018
    Location
    Russia
    Posts
    343

    Exclamation Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by Krool View Post
    [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
    Last edited by Nouyana; Jan 28th, 2024 at 03:09 PM.

  14. #1214

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,728

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by Nouyana View Post
    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.

  15. #1215

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,728

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by Nouyana View Post
    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..

  16. #1216
    Addicted Member
    Join Date
    May 2022
    Posts
    144

    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 ?

  17. #1217
    Hyperactive Member
    Join Date
    May 2018
    Location
    Russia
    Posts
    343

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by Krool View Post
    ... 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 View Post
    So you could start a low interval timer in BeginIncrementalSearch and terminate it in EndIncrementalSearch.
    Are you serious?
    Last edited by Nouyana; Jan 29th, 2024 at 02:11 AM.

  18. #1218
    Hyperactive Member
    Join Date
    May 2018
    Location
    Russia
    Posts
    343

    Lightbulb Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    At least you may clean up the IncrementalSearchString right after the RaiseEvent EndIncrementalSearch

  19. #1219

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,728

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by Nouyana View Post
    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.

  20. #1220

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,728

    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

  21. #1221

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,728

    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 View Post
    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
    Last edited by Krool; Jan 30th, 2024 at 03:07 AM.

  22. #1222
    Hyperactive Member
    Join Date
    May 2018
    Location
    Russia
    Posts
    343

    Thumbs up Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by Krool View Post
    IncrementalSearch event now included.
    Man, you are the best! I knew it!

    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.
    Last edited by Nouyana; Jan 30th, 2024 at 10:55 AM.

  23. #1223

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,728

    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

  24. #1224
    Hyperactive Member
    Join Date
    May 2018
    Location
    Russia
    Posts
    343

    Post Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by Krool View Post
    Is the VB_HelpID attribute the Help Context ID ?
    Yes.

    Quote Originally Posted by Krool View Post
    Hmm.. what should I fill in ? Never used it. I need some advise here
    The same way you've added descriptions:

    Name:  HelpContextID.gif
Views: 1044
Size:  60.7 KB


    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?

  25. #1225
    Hyperactive Member
    Join Date
    May 2018
    Location
    Russia
    Posts
    343

    Exclamation Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by Krool View Post
    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

  26. #1226

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,728

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by Nouyana View Post
    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.
    Last edited by Krool; Jan 31st, 2024 at 09:24 AM.

  27. #1227
    Hyperactive Member
    Join Date
    May 2018
    Location
    Russia
    Posts
    343

    Arrow Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by Krool View Post
    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 View Post
    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
    Last edited by Nouyana; Jan 31st, 2024 at 09:02 AM.

  28. #1228

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,728

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by Nouyana View Post
    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.

  29. #1229

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,728

    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?
    Last edited by Krool; Jan 31st, 2024 at 11:52 AM.

  30. #1230
    Hyperactive Member
    Join Date
    May 2018
    Location
    Russia
    Posts
    343

    Question Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by Krool View Post
    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 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
    Name:  VBF_ColImageList.png
Views: 1074
Size:  4.1 KBName:  VSF_ColImageList.png
Views: 1019
Size:  4.1 KB

  31. #1231
    Hyperactive Member
    Join Date
    May 2018
    Location
    Russia
    Posts
    343

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by Krool View Post
    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.

  32. #1232

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,728

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by Nouyana View Post
    This code works differently for VBFlexGrid+CCR ImageList and vsFlexGrid+MS ImageList.

    It seems that vsFlexGrid has a bug 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
    Name:  VBF_ColImageList.png
Views: 1074
Size:  4.1 KBName:  VSF_ColImageList.png
Views: 1019
Size:  4.1 KB
    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 View Post
    Sounds good if it's possible. I mean a flag within the VBFlexGrid code, but not a event's parameter.
    done
    Last edited by Krool; Jan 31st, 2024 at 03:52 PM.

  33. #1233
    Addicted Member
    Join Date
    Oct 2014
    Posts
    128

    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!


    VSFGTest.zip
    Name:  VSFG.jpg
Views: 927
Size:  23.2 KB

  34. #1234
    Banned
    Join Date
    May 2021
    Posts
    40

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Hi,anybody knows how to limt a cell only to receive "+-.1234567890" and backspace ? Thanks.

    John

  35. #1235

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,728

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by smileyoufu View Post
    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 View Post
    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.

  36. #1236
    Banned
    Join Date
    May 2021
    Posts
    40

    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.

  37. #1237

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,728

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by TheLeePiper View Post
    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.

  38. #1238
    Junior Member
    Join Date
    Dec 2020
    Posts
    29

    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.

  39. #1239
    Hyperactive Member
    Join Date
    May 2018
    Location
    Russia
    Posts
    343

    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

  40. #1240
    Hyperactive Member
    Join Date
    May 2018
    Location
    Russia
    Posts
    343

    Question Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by Krool View Post
    02-Oct-2023
    - Included the ClientLeft/ClientTop and ClientWidth/ClientHeight read-only/run-time property.
    Maybe we need a read/write BorderWidth property?

Page 31 of 42 FirstFirst ... 212829303132333441 ... LastLast

Posting Permissions

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



Click Here to Expand Forum to Full Width