Page 28 of 42 FirstFirst ... 182526272829303138 ... LastLast
Results 1,081 to 1,120 of 1650

Thread: VBFlexGrid Control (Replacement of the MSFlexGrid control)

  1. #1081

    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
    Can anyone explain me how to draw a Button? I know almost nothing about WinAPI, but I've tried:
    When you have no knowledge about owner-drawing (WinAPI) then this is the wrong thread here to learn it. I have no time to explain you knowledge.
    Of course I can explain the control, but no basic stuff.

    Quote Originally Posted by Nouyana View Post
    @Krool

    A bug in ComboCalendarMinDate/ComboCalendarMaxDate properties.

    Code:
    With VBFlexGrid1
       .Cell(FlexCellComboCue, .FixedRows, 1, .Rows - 1, 1) = FlexComboCueDropDown
       .ComboMode = FlexComboModeCalendar
       .ComboCalendarMaxDate = Date + 31
       .ComboCalendarMinDate = Date - 31
    End With
    Attachment 188291

    PS.
    I've written more than 160 pages of documentation. I'm moving alphabetically and I'm now only on the letter "C". You've got dozens of bugs here. Maybe I'm not a $100 to everyone's liking, but I'm doing a big job for the community. If you keep ignoring my messages, I won't bother you anymore.
    The ComboCalendar* property are meant to be executed after the BeforeEdit event. You can't use them before.

    Putting pressure will not achieve anything. Feel free to act as you wish.

  2. #1082
    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
    When you have no knowledge about owner-drawing (WinAPI) then this is the wrong thread here to learn it. I have no time to explain you knowledge.
    Of course I can explain the control, but no basic stuff.
    I understand this. I just asked an example.
    What values may have CtlType, ItemAction and ItemState params in the ComboButtonOwnerDraw event?

    Quote Originally Posted by Krool View Post
    The ComboCalendar* property are meant to be executed after the BeforeEdit event. You can't use them before.
    Ok. It works in the EditSetupWindow event. From my point of view, this limitation can be eliminated.

    Quote Originally Posted by Krool View Post
    Putting pressure will not achieve anything. Feel free to act as you wish.
    I have never perceived the words on the monitor screen as a pressure. I just feel very awkward when I communicate with myself only.

  3. #1083
    Hyperactive Member
    Join Date
    May 2018
    Location
    Russia
    Posts
    343

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

    There is a different behavour using FlexComboCueConstants in ComboCue and CellComboCue properties.

    I don't know, maybe it's "by design":

    1. This code will show buttons only when the cell is active:
    Code:
    VBFlexGrid1.ComboCue = FlexComboCueDropDown
    2. And this one will always show buttons:
    Code:
    VBFlexGrid1.Cell(FlexCellComboCue, .FixedRows, .FixedCols, _
              .Rows - .FixedRows, .Cols - .FixedCols) = FlexComboCueDropDown
    Last edited by Nouyana; Jul 22nd, 2023 at 03:25 PM.

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

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

    We have the ComboCue, CellComboCue and the Cell(FlexCellComboCue).
    We have even ColComboMode and ColComboItems.
    But we don't have a ColComboCue property. A drop-down button should be automatically added when we add a new row to the flex grid.

  5. #1085
    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
    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
    Readable edition. But MouseLeave event doesn't work.
    In all controls, not only VBFlexGrid. Has tested on Win7x64 / WinXp.

    Code:
    Private Sub VBFlexGrid1_MouseLeave()
       VBFlexGrid1.ComboCue = FlexComboCueNone
    End Sub
    
    Private Sub VBFlexGrid1_MouseMove(Button As Integer, Shift As Integer, _
                                      X As Single, Y As Single)
       With VBFlexGrid1
          .HitTest X, Y
          .ComboCue = FlexComboCueNone
          .ComboCueRow = .HitRow
          .ComboCueCol = .HitCol
    
          If .HitResult = FlexHitResultNoWhere Then Exit Sub
          If .HitRow < .FixedCols Then Exit Sub
    
          Select Case .HitCol
          Case COL_CALENDARVALIDATION, COL_COMBODROPDOWN, COL_COMBOEDITABLE
             .ComboCue = FlexComboCueDropDown
          Case COL_COMBOBUTTON
             .ComboCue = FlexComboCueButton
          End Select
       End With
    End Sub

  6. #1086

    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
    Readable edition. But MouseLeave event doesn't work.
    In all controls, not only VBFlexGrid. Has tested on Win7x64 / WinXp.

    Code:
    Private Sub VBFlexGrid1_MouseLeave()
       VBFlexGrid1.ComboCue = FlexComboCueNone
    End Sub
    
    Private Sub VBFlexGrid1_MouseMove(Button As Integer, Shift As Integer, _
                                      X As Single, Y As Single)
       With VBFlexGrid1
          .HitTest X, Y
          .ComboCue = FlexComboCueNone
          .ComboCueRow = .HitRow
          .ComboCueCol = .HitCol
    
          If .HitResult = FlexHitResultNoWhere Then Exit Sub
          If .HitRow < .FixedCols Then Exit Sub
    
          Select Case .HitCol
          Case COL_CALENDARVALIDATION, COL_COMBODROPDOWN, COL_COMBOEDITABLE
             .ComboCue = FlexComboCueDropDown
          Case COL_COMBOBUTTON
             .ComboCue = FlexComboCueButton
          End Select
       End With
    End Sub
    MouseEnter/MouseLeave only fire when MouseTrack property is True.

    Bonus for MouseTrack = True is that all combo cues are being hot-tracked.

  7. #1087
    Hyperactive Member
    Join Date
    Jan 2012
    Location
    Recently moved from Europe to Panama
    Posts
    292

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Hi Krool,

    By no means I want to be impatient, or give you the feelingthat I'm trying to pressure you for an answer, but I wonder if my question in post #1076 has fallen between the cracks given the intense communication between you and Nouyana.

    Thanks in advance for a follow up at your earliest convenience.

    Regards,
    Erwin

  8. #1088

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,728

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by Erwin69 View Post
    Hi,

    Using the WantReturn property in combination with the LeaveEdit event I can move the focus to the next cell that the user is allowed to edit when they press the Enter key.

    Is it also possible to catch the Tab-key to create the same behavior?

    I thought to do this via the EditKeyPress event, but can't get it to work.

    Thanks,
    Erwin
    You may also consider the "DirectionAfterReturn" property.

    You can catch the tab key (in the EditKeyDown event) if you handle the "PreviewKeyDown" event.
    Code:
    Private Sub VBFlexGrid1_PreviewKeyDown(ByVal KeyCode As Integer, IsInputKey As Boolean)
    If KeyCode = vbKeyTab Then
        If VBFlexGrid1.hWndEdit <> 0 Then IsInputKey = True
    End If
    End Sub

  9. #1089
    Hyperactive Member
    Join Date
    Jan 2012
    Location
    Recently moved from Europe to Panama
    Posts
    292

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Thanks for the follow up and the valuable info! Got it to work now.

    DirectionAfterReturn is interesting to know, but not applicable in this case for me. (At the end on one grid, I want the focus to jump to a specific cell in a second grid.)

  10. #1090
    Hyperactive Member
    Join Date
    May 2018
    Location
    Russia
    Posts
    343

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

    Why doesn't the ComboListIndex property automatically set the TextBox value like the standard ComboBox does?

    EDITED: Fixed in the new release.

    Code:
    Private Sub Command1_Click()
       With VBFlexGrid1
          .CellComboCue = FlexComboCueDropDown
          .ComboMode = FlexComboModeDropDown
          .ComboItems = "Arnold|Bob|Charlie|David|Elena|Felix|Greg"
          .StartEdit
             .ComboListIndex = 2 ' "Charlie" is not in the TextBox yet.
             .EditText = .ComboList(.ComboListIndex) ' I should use EditText.
          .CommitEdit
       End With
    End Sub
    
    Private Sub Command2_Click()
       With Combo1  ' Standard ComboBox
          ' .Style = vbComboDropdownList (was set at design time)
          .AddItem "Arnold": .AddItem "Bob": .AddItem "Charlie"
          .ListIndex = 2 ' That's it!
       End With
    End Sub
    Last edited by Nouyana; Jul 28th, 2023 at 09:21 AM. Reason: fixed

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

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

    @Krool.
    I don't know is it by design or not, but the ComboMode property affects the whole grid, unlike the ComboItems. In the Description of the ComboMode property, it is said that property "Returns/sets the combo functionality mode when editing a cell". Therefore, you have a bug or wrong description here.

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

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

    Yahoo!!! The ComboMode has a priority over the ColComboMode!

    Code:
    With VBFlexGrid1
       .ComboMode = FlexComboModeDropDown
       .ColComboMode(.Col) = FlexComboModeEditable
       .CellComboCue = FlexComboCueDropDown
       .ComboItems = "Arnold|Bob|Charlie|David|Elena|Felix|Greg"
    End With

  13. #1093

    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
    @Krool.
    I don't know is it by design or not, but the ComboMode property affects the whole grid, unlike the ComboItems. In the Description of the ComboMode property, it is said that property "Returns/sets the combo functionality mode when editing a cell". Therefore, you have a bug or wrong description here.
    Your are mixing it up. ComboMode has priority over ColComboMode, yes. But when ComboMode is applicable, then it takes ComboItems.
    So ComboItems/ColComboItems are depended on ComboMode and ColComboMode.

    The code is as following in VBFlexGrid, so it will get clear to you:
    Code:
    If VBFlexGridComboMode <> FlexComboModeNone Then
        VBFlexGridComboModeActive = VBFlexGridComboMode
        ComboItems = VBFlexGridComboItems
    ElseIf VBFlexGridColsInfo(VBFlexGridEditCol).ComboMode <> FlexComboModeNone Then
        VBFlexGridComboModeActive = VBFlexGridColsInfo(VBFlexGridEditCol).ComboMode
        ComboItems = VBFlexGridColsInfo(VBFlexGridEditCol).ComboItems
    End If

  14. #1094

    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
    Why doesn't the ComboListIndex property automatically set the TextBox value like the standard ComboBox does?

    Code:
    Private Sub Command1_Click()
       With VBFlexGrid1
          .CellComboCue = FlexComboCueDropDown
          .ComboMode = FlexComboModeDropDown
          .ComboItems = "Arnold|Bob|Charlie|David|Elena|Felix|Greg"
          .StartEdit
             .ComboListIndex = 2 ' "Charlie" is not in the TextBox yet.
             .EditText = .ComboList(.ComboListIndex) ' I should use EditText.
          .CommitEdit
       End With
    End Sub
    
    Private Sub Command2_Click()
       With Combo1  ' Standard ComboBox
          ' .Style = vbComboDropdownList (was set at design time)
          .AddItem "Arnold": .AddItem "Bob": .AddItem "Charlie"
          .ListIndex = 2 ' That's it!
       End With
    End Sub
    Thanks for this find. Update released.

    There was indeed a bug in the ComboListIndex property that a call to the internal ComboListCommitSel was missing. This will copy the current selection text to the edit control and selects all text within the edit control.
    Just like a normal ComboBox does.

  15. #1095
    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
    Your are mixing it up. ComboMode has priority over ColComboMode, yes. But when ComboMode is applicable, then it takes ComboItems.
    So ComboItems/ColComboItems are depended on ComboMode and ColComboMode.

    The code is as following in VBFlexGrid, so it will get clear to you:
    Code:
    If VBFlexGridComboMode <> FlexComboModeNone Then
        VBFlexGridComboModeActive = VBFlexGridComboMode
        ComboItems = VBFlexGridComboItems
    ElseIf VBFlexGridColsInfo(VBFlexGridEditCol).ComboMode <> FlexComboModeNone Then
        VBFlexGridComboModeActive = VBFlexGridColsInfo(VBFlexGridEditCol).ComboMode
        ComboItems = VBFlexGridColsInfo(VBFlexGridEditCol).ComboItems
    End If
    Yes, I understood this last time we discussed it.

    What was new for me is that the ComboMode property affects the whole grid, unlike the ComboItems. How can I set the FlexComboModeDropDown for, say, FixedRows and FlexComboModeEditable for others? We need the Cell(FlexCellComboMode) property.

  16. #1096

    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
    Yes, I understood this last time we discussed it.

    What was new for me is that the ComboMode property affects the whole grid, unlike the ComboItems. How can I set the FlexComboModeDropDown for, say, FixedRows and FlexComboModeEditable for others? We need the Cell(FlexCellComboMode) property.
    The below code answers your question. And yes, there is no CellComboMode property. And it will certainly not be included as this implies another CellComboItems property and thus adds again too much memory overall.

    Code:
    Private Sub VBFlexGrid1_BeforeEdit(Row As Long, Col As Long, ByVal Reason As FlexEditReasonConstants, Cancel As Boolean)
    Select Case Col
        Case 3 ' This is the col with the special behavior
            If Row >= VBFlexGrid1.FixedRows Then
                VBFlexGrid1.ComboMode = FlexComboModeEditable
            Else
                VBFlexGrid1.ComboMode = FlexComboModeDropDown
            End If
            VBFlexGrid1.ComboItems = "Arnold|Bob|Charlie|David|Elena|Felix|Greg"
        Case Else
            ' Set to none to ensure that a potential ColComboMode/ColComboItems works..
            VBFlexGrid1.ComboMode = FlexComboModeNone
    End Select
    End Sub

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

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

    Quote Originally Posted by Krool View Post
    And yes, there is no CellComboMode property. And it will certainly not be included as this implies another CellComboItems property and thus adds again too much memory overall.
    We already have the ComboItems property, that applies to only one cell.

    In my opinion there is no need to add anything. Just the ComboMode property should applies to the current cell as it is described in its Description (or at least you should fix the description). The CellComboMode needs only if you want to keep the compatibility. But, to be honest, I can't imagine anyone using this property for an entire grid and not disabling it after editing the cell.

    About the memory I may not understand something, but...

    My point is that for all properties you should keep in memory only defaults and exceptions. I think that's what you did last time you reduced the amount of memory consumed by cell formatting properties. Col's and row's properties should be exceptions for grig's defaults, and cell's properties should be exceptions for cols, rows and grid. Cols and rows shouldn't have the same properties. And of course you shouldn't keep all the equal properties for the every cell. This (maybe) also applies to the text property, because the first (fixed) column often is almost empty.
    Last edited by Nouyana; Jul 28th, 2023 at 11:06 AM.

  18. #1098
    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
    The below code answers your question.

    Code:
    Private Sub VBFlexGrid1_BeforeEdit(Row As Long, Col As Long, ByVal Reason As FlexEditReasonConstants, Cancel As Boolean)
    Select Case Col
        Case 3 ' This is the col with the special behavior
            If Row >= VBFlexGrid1.FixedRows Then
                VBFlexGrid1.ComboMode = FlexComboModeEditable
            Else
                VBFlexGrid1.ComboMode = FlexComboModeDropDown
            End If
            VBFlexGrid1.ComboItems = "Arnold|Bob|Charlie|David|Elena|Felix|Greg"
        Case Else
            ' Set to none to ensure that a potential ColComboMode/ColComboItems works..
            VBFlexGrid1.ComboMode = FlexComboModeNone
    End Select
    End Sub
    You have created a lot of good events that allow to customize the work of grid very flexibly. But if, instead of the most common properties, we start using event handlers everywhere, this will make the code completely unreadable.

  19. #1099
    Hyperactive Member
    Join Date
    May 2018
    Location
    Russia
    Posts
    343

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

    Quote Originally Posted by DisableNoScroll property description
    Returns/sets a value that determines whether scroll bars are disabled instead of hided when they are not needed.
    Code:
    With VBFlexGrid1
       .DisableNoScroll = True
    End With
    The Scroll bar doesn't look like disabled.

    Name:  VBFlefGridDisableNoScroll.gif
Views: 1500
Size:  11.9 KB

  20. #1100

    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
    Code:
    With VBFlexGrid1
       .DisableNoScroll = True
    End With
    The Scroll bar doesn't look like disabled.

    Name:  VBFlefGridDisableNoScroll.gif
Views: 1500
Size:  11.9 KB
    I can't repro. Please provide demo

  21. #1101
    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
    I can't repro. Please provide demo
    Now I've noticed that it's ok in Form_Load. The problem is only in the Command1_Click. Refresh doesn't help.

    Code:
    Option Explicit
    
    Private Sub Command1_Click()
       With VBFlexGrid1
          .DisableNoScroll = True        ' DOESN'T WORK
          .Refresh
       End With
    End Sub
    
    Private Sub Form_Load()
       Dim I As Integer
       With VBFlexGrid1
    '      .DisableNoScroll = True        ' WORKS FINE!
    
          .Cols = 4
          .FixedRows = 1
          .Rows = 1
          For I = 1 To 50
             .AddItem I & vbTab & "Name " & I & vbTab & I * 100 & vbTab & "text"
          Next I
    
          .TextArray(0) = "ID"
          .TextArray(1) = "NAME"
          .TextArray(2) = "SUM"
          .TextArray(3) = "DESCR"
    
          .Row = 2
          .Col = 2
          Call .AutoSize(0, , FlexAutoSizeModeColWidth)
       End With
    End Sub

  22. #1102

    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
    Now I've noticed that it's ok in Form_Load. The problem is only in the Command1_Click. Refresh doesn't help.

    Code:
    Option Explicit
    
    Private Sub Command1_Click()
       With VBFlexGrid1
          .DisableNoScroll = True        ' DOESN'T WORK
          .Refresh
       End With
    End Sub
    
    Private Sub Form_Load()
       Dim I As Integer
       With VBFlexGrid1
    '      .DisableNoScroll = True        ' WORKS FINE!
    
          .Cols = 4
          .FixedRows = 1
          .Rows = 1
          For I = 1 To 50
             .AddItem I & vbTab & "Name " & I & vbTab & I * 100 & vbTab & "text"
          Next I
    
          .TextArray(0) = "ID"
          .TextArray(1) = "NAME"
          .TextArray(2) = "SUM"
          .TextArray(3) = "DESCR"
    
          .Row = 2
          .Col = 2
          Call .AutoSize(0, , FlexAutoSizeModeColWidth)
       End With
    End Sub
    Seems to be a Bug in SetScrollInfo.
    See https://stackoverflow.com/questions/...isablenoscroll
    There is a workaround though which I will check..

  23. #1103
    Hyperactive Member
    Join Date
    May 2018
    Location
    Russia
    Posts
    343

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

    Quote Originally Posted by Krool View Post
    Seems to be a Bug in SetScrollInfo.
    See https://stackoverflow.com/questions/...isablenoscroll
    There is a workaround though which I will check..
    Yes, this works for a while:

    Code:
    Option Explicit
    
    Private bDisableNoScroll As Boolean
    
    Private Property Get DisableNoScroll() As Boolean
       DisableNoScroll = bDisableNoScroll
    End Property
    
    Private Property Let DisableNoScroll(ByVal Disable As Boolean)
       Dim nWidth      As Long
       Dim nHeight     As Long
       Dim nScrollBars As ScrollBarConstants
    
       bDisableNoScroll = Disable
       With VBFlexGrid1
          If Disable Then
             nScrollBars = .ScrollBars
             nWidth = .ColWidth(0)
             nHeight = .RowHeight(0)
             'https://stackoverflow.com/questions/66325027/scroll-bar-doesnt-become-visible-despite-sif-disablenoscroll
             .ScrollBars = vbSBNone
             .ColWidth(0) = 30000
             .RowHeight(0) = 30000
             .ScrollBars = nScrollBars
             .DisableNoScroll = True
             .ColWidth(0) = nWidth
             .RowHeight(0) = nHeight
          Else
             .DisableNoScroll = False
          End If
       End With
    End Property
    
    Private Sub Command1_Click()
       DisableNoScroll = Not DisableNoScroll
    End Sub
    
    Private Sub Form_Load()
       Dim I As Integer
       With VBFlexGrid1
          .Cols = 4
          .FixedRows = 1
          .Rows = 1
          For I = 1 To 50
             .AddItem I & vbTab & "Name " & I & vbTab & I * 100 & vbTab & "text"
          Next I
    
          .TextArray(0) = "ID"
          .TextArray(1) = "NAME"
          .TextArray(2) = "SUM"
          .TextArray(3) = "DESCR"
    
          .Row = 2
          .Col = 2
          Call .AutoSize(0, , FlexAutoSizeModeColWidth)
       End With
    End Sub
    Last edited by Nouyana; Aug 5th, 2023 at 11:33 AM.

  24. #1104

    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
    Now I've noticed that it's ok in Form_Load. The problem is only in the Command1_Click. Refresh doesn't help.

    Code:
    Option Explicit
    
    Private Sub Command1_Click()
       With VBFlexGrid1
          .DisableNoScroll = True        ' DOESN'T WORK
          .Refresh
       End With
    End Sub
    
    Private Sub Form_Load()
       Dim I As Integer
       With VBFlexGrid1
    '      .DisableNoScroll = True        ' WORKS FINE!
    
          .Cols = 4
          .FixedRows = 1
          .Rows = 1
          For I = 1 To 50
             .AddItem I & vbTab & "Name " & I & vbTab & I * 100 & vbTab & "text"
          Next I
    
          .TextArray(0) = "ID"
          .TextArray(1) = "NAME"
          .TextArray(2) = "SUM"
          .TextArray(3) = "DESCR"
    
          .Row = 2
          .Col = 2
          Call .AutoSize(0, , FlexAutoSizeModeColWidth)
       End With
    End Sub
    Btw, for me the Command1_Click works. So I can't repro.
    Which OS are you using ? I have the suspicion that maybe MS fixed this bug meanwhile..

  25. #1105
    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
    Btw, for me the Command1_Click works. So I can't repro.
    Which OS are you using ? I have the suspicion that maybe MS fixed this bug meanwhile..
    Yes, it seems to be WinXP-only problem.
    Will you fix it somehow?

  26. #1106

    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
    Yes, it seems to be WinXP-only problem.
    Will you fix it somehow?
    Normally one would set this property at design-time..
    So it's not critical and since it's only win xp and older.. also I dislike the workaround.
    You have found already your workaround. Then use it.

  27. #1107

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,728

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Update released.

    Bugfix that the edit control back color did not consider the BackColorAlt property.

    Quote Originally Posted by Krool View Post
    It has no effect unless edit mode is active.

    Maybe I should start throwing errors on those props when mis-used ;-D.
    Like this or .ComboButtonValue
    Certain run-time properties now throw error 5 to avoid mis-use instead of silently doing nothing.

  28. #1108

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,728

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Update released.

    Quote Originally Posted by Nouyana View Post
    Can you change it? Let it be ColComboItems as a default list and ComboItems as a list for the specific cell.
    I thought over this again and found a "small" bug.
    ColComboMode shall precede over ComboMode, which is now fixed.

    This was already the case for other properties, e.g. ColComboButtonAlignment over ComboButtonAlignment, or ColComboButtonPicture over ComboButtonPicture.

    Also this is then in sync with the vsFlexGrid.

    For most apps this "behavior change" is not noticable.

  29. #1109

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,728

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Update selected.

    Bugfix that LBN_SELCHANGE handler got misplaced in WM_COMMAND. (regression since 03-Nov-2021)
    This resulted that arrow keys in the combo box did not update the edit text!

  30. #1110
    Addicted Member
    Join Date
    May 2022
    Posts
    144

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    thanks!

  31. #1111

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,728

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Included the ColLookup property used to map keys to associated values.
    This is useful for translating database values to user-friendly descriptions.

    The demo project was updated to demonstrate usage in the column 10 (UserEditingForm) with this property.

    Example: (it can be used also without a combo list)
    ColLookup(i) = ";NULL|0;|1;Full time|2;Part time|3;Contractor|4;Other"
    ColComboItems(i) = "|Full time|Part time|Contractor|Other"
    If a cell text is "3" then .Cell(FlexCellTextDisplay) will return "Contractor".
    Choosing "Contractor" in the combo drop-down will put a cell text of "3".

    The VBFLXGRD16.OCX was not updated with this feature. However, future bugfixes will still be done for the ocx.

  32. #1112
    Addicted Member
    Join Date
    May 2022
    Posts
    144

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    @Krool

    I think i found a bug (or i'm not working the way i should)

    A column created this way:

    Code:
                
    .Col = 6
    .Text = "Tiene ADR"
    .ColAlignment(.Col) = FlexAlignmentCenterCenter
    .ColKey(.Col) = "adr_c"

    And filled this way (I fill column 6 in blank and later I add the checkbox) :

    Code:
    Do While Not RsCamion.EOF
         Vg.AddItem "" & vbTab & RsCamion!ID & vbTab & RsCamion!nomc & vbTab & RsCamion!numc & vbTab & RsCamion!telfc & vbTab & RsCamion!cifc & vbTab & "" & vbTab & UCase(RsCamion!adr_c2) & vbTab & RsCamion!adr_vto
         Vg.Col = 6
         Vg.Row = Vg.Rows - 1
         Vg.CellChecked = RsCamion!adr_c
         Vg.CellPictureAlignment = FlexPictureAlignmentCenterCenter
         RsCamion.MoveNext
    Loop

    I tried too creating the col this way:

    Code:
    xCol = xCol + 1
    .Col = xCol
    .Text = "Tiene ADR"
    .ColAlignment(.Col) = FlexAlignmentCenterCenter
    .ColKey(.Col) = "adr_c"
    .ColCheckBoxes(xCol) = True
    .ColCheckBoxAlignment(xCol) = FlexCheckBoxAlignmentCenterCenter
    and filling it this way:

    Code:
    Do While Not RsCamion.EOF
         Vg.AddItem "" & vbTab & RsCamion!ID & vbTab & RsCamion!nomc & vbTab & RsCamion!numc & vbTab & RsCamion!telfc & vbTab & RsCamion!cifc & vbTab & "" & vbTab & UCase(RsCamion!adr_c2) & vbTab & RsCamion!adr_vto
    
         Vg.Col = Vg.ColIndex("adr_c")
         Vg.CellChecked = RsCamion!adr_c
         Vg.Row = Vg.Rows - 1
         RsCamion.MoveNext
    Loop

    But I can't sort it.
    The rest of the columns are sorted fine, but if i want to have all the checkboxes sorted (checked / not checked) it's not working.

    I think it's because the value of the cell is "", and it's not sorting for .cellchecked or It's me that i'm doing wrong?
    Last edited by Calcu; Sep 5th, 2023 at 04:58 AM.

  33. #1113

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,728

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by Calcu View Post
    @Krool

    I think i found a bug (or i'm not working the way i should)

    A column created this way:

    Code:
                
    .Col = 6
    .Text = "Tiene ADR"
    .ColAlignment(.Col) = FlexAlignmentCenterCenter
    .ColKey(.Col) = "adr_c"

    And filled this way (I fill column 6 in blank and later I add the checkbox) :

    Code:
            Do While Not RsCamion.EOF
                Vg.AddItem "" & vbTab & RsCamion!ID & vbTab & RsCamion!nomc & vbTab & RsCamion!numc & vbTab & RsCamion!telfc & vbTab & RsCamion!cifc & vbTab & "" & vbTab & UCase(RsCamion!adr_c2) & vbTab & RsCamion!adr_vto
                Vg.Col = 6
                Vg.Row = Vg.Rows - 1
                Vg.CellChecked = RsCamion!adr_c
                Vg.CellPictureAlignment = FlexPictureAlignmentCenterCenter
                RsCamion.MoveNext
            Loop
    I can't sort it.
    The rest of the columns are sorted fine, but if i want to have all the checkboxes sorted (checked / not checked) it's not working.

    It's me ?
    It's not a bug. The sorting routines sort by the cell text and not by the checked state.

    You can use 'FlexSortCustom' and do the sorting manually in the 'Compare' event. (Row1/Row2 and eveluating the Checked state)

    Or you can use 'CellChecked = FlexTextAsCheckBox' and apply RsCamion!adr_c in the cell text property. Then sorting should be easy.

  34. #1114
    Addicted Member
    Join Date
    May 2022
    Posts
    144

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Perfect, solved like you said:

    Formatting Col:

    Code:
    .Col = 2
    .Text = "Farma"
    .ColAlignment(.Col) = FlexAlignmentCenterCenter
    .ColKey(.Col) = "M_farma"
    .ColCheckBoxes(.Col) = True
    .ColCheckBoxAlignment(.Col) = FlexCheckBoxAlignmentCenterCenter
    Adding data:

    Code:
    Vg.AddItem "" & vbTab & RsCamion!ID & vbTab &  RsCamion!M_farma
               
    Vg.Row = Vg.Rows - 1
    Vg.Col = Vg.ColIndex("M_farma")
    Vg.CellChecked = FlexTextAsCheckBox

    Thanks!

  35. #1115
    Addicted Member
    Join Date
    May 2022
    Posts
    144

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Hi, again me, sorry, :-)

    I have one combobox for select what table i will show at the grid, everything works fine, but i found something (let's see if i'm not wrong again xD)

    I select the first table at the combo, then in combo_click is where i format and fill the grid.

    I define that col6 has checkbox, i do:

    Code:
    IF combo.text="xxx" then
    
    .Clear FlexClearEverywhere, FlexClearEverything
    
    ..... more cols ....
    
    .Col = 6
    .Text = "Tiene ADR"
    .ColAlignment(.Col) = FlexAlignmentCenterCenter
    .ColKey(.Col) = "adr_c"
    .ColCheckBoxes(.Col) = True
    .ColCheckBoxAlignment(.Col) = FlexCheckBoxAlignmentCenterCenter

    Then, i Select another table to show at the grid, with col 4 as a checkbox and i do:

    Code:
    IF combo.text="yyy" then
    .Clear FlexClearEverywhere, FlexClearEverything
    
    ..... more cols ....
    
    .Col = 4
    .Text = "Paga Central"
    .ColAlignment(.Col) = FlexAlignmentCenterCenter
    .ColKey(.Col) = "pago_central"
    .ColCheckBoxes(.Col) = True
    .ColCheckBoxAlignment(.Col) = FlexCheckBoxAlignmentCenterCenter

    But this time, it's showing the Checkbox in both cols! number 6 and number 4

    the .clear maybe is not clearing the .ColCheckBoxes(.Col) = True property?

    i must put .ColCheckBoxes(.Col) = false in all the other columns in order to work as expected

    It's a bug?

  36. #1116

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,728

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by Calcu View Post
    Hi, again me, sorry, :-)

    I have one combobox for select what table i will show at the grid, everything works fine, but i found something (let's see if i'm not wrong again xD)

    I select the first table at the combo, then in combo_click is where i format and fill the grid.

    I define that col6 has checkbox, i do:

    Code:
    IF combo.text="xxx" then
    
    .Clear FlexClearEverywhere, FlexClearEverything
    
    ..... more cols ....
    
    .Col = 6
    .Text = "Tiene ADR"
    .ColAlignment(.Col) = FlexAlignmentCenterCenter
    .ColKey(.Col) = "adr_c"
    .ColCheckBoxes(.Col) = True
    .ColCheckBoxAlignment(.Col) = FlexCheckBoxAlignmentCenterCenter

    Then, i Select another table to show at the grid, with col 4 as a checkbox and i do:

    Code:
    IF combo.text="yyy" then
    .Clear FlexClearEverywhere, FlexClearEverything
    
    ..... more cols ....
    
    .Col = 4
    .Text = "Paga Central"
    .ColAlignment(.Col) = FlexAlignmentCenterCenter
    .ColKey(.Col) = "pago_central"
    .ColCheckBoxes(.Col) = True
    .ColCheckBoxAlignment(.Col) = FlexCheckBoxAlignmentCenterCenter

    But this time, it's showing the Checkbox in both cols! number 6 and number 4

    the .clear maybe is not clearing the .ColCheckBoxes(.Col) = True property?

    i must put .ColCheckBoxes(.Col) = false in all the other columns in order to work as expected

    It's a bug?
    Don't use ColCheckBoxes(.Col). It will predefine empty checkboxes (-1 = 0). And it will fetch data from .FlexDataSource.
    So in your scenario just skip that property.

  37. #1117

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,728

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Update released.

    Included ColComboCue property. This avoids the need of looping all rows in a big column and allocating formatting memory. (CellComboCue)

    ColComboCue excludes for fixed rows, by default. Use the CellComboCue to fill the gap, if necessary, or to change certain cells from the ColComboCue.
    Order is CellComboCue > ColComboCue > ComboCue

    Added enum FlexComboCueHidden to have a possibility to exclude certain cells in a ColComboCue via CellComboCue. (e.g. frozen row)

  38. #1118
    Addicted Member
    Join Date
    May 2022
    Posts
    144

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Hi again!

    i will update later the grid, thanks!, i found that the property : .ColComboMode(.Col) = xxx

    is saved too.

    I mean, if i assign this property to a column of a grid, for example col 2, then i clear the grid using "grid.Clear FlexClearEverywhere, FlexClearEverything" and i create another layout at the same grid, but this time, col 2 is not a combo, if i don't use .ColComboMode(2) = FlexComboModeNone, the col stills using the info from the last assignment.

    There is a way to clear all the properties ?

  39. #1119

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,728

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Update released.

    Quote Originally Posted by xiaoyao View Post
    A background picture wallpaper, add a lot of icons and names for applications.
    Just like the resource manager folder, you first have a background image, and the thumbnail plus text is displayed in each file.
    Included the WallPaper/WallPaperAlignment property. (like in vsFlexGrid)


    Quote Originally Posted by Calcu View Post
    i will update later the grid, thanks!, i found that the property : .ColComboMode(.Col) = xxx

    is saved too.

    I mean, if i assign this property to a column of a grid, for example col 2, then i clear the grid using "grid.Clear FlexClearEverywhere, FlexClearEverything" and i create another layout at the same grid, but this time, col 2 is not a combo, if i don't use .ColComboMode(2) = FlexComboModeNone, the col stills using the info from the last assignment.

    There is a way to clear all the properties ?
    The .Clear method removes only cell settings. If you want in addition all row and column settings to be removed it would be the easiest to "un-initialize" the grid.
    This is done by setting .Rows/.Cols to 0 and afterwards back to your wanted number of rows and columns.

  40. #1120

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,728

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Update released.

    Usage of hashes for the keys in the ColLookup property. (using string CalcHash from clsTrickHashTable.cls)

    This ensure no more exponential performance decrease when there are more than 10 lookup entries.

Page 28 of 42 FirstFirst ... 182526272829303138 ... 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