Results 1 to 5 of 5

Thread: [RESOLVED] VSFlexigrid Highlight on Hover

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2011
    Posts
    439

    Resolved [RESOLVED] VSFlexigrid Highlight on Hover

    I use the Component one VSFlexigrid and it does have a highlight row only when clicking the grid etc.
    It does not have a row hover highlight.

    Is there some way i can add this progmatically.

    I tried to use the grid.Mouserow and mousemove event to get which row the mouse is over but the grid flickered badly

    I did get it partially working.
    I tried to save the last mouse row and unhighlight it but if you move the mouse too fast it does not
    unhighlight the previous rows.

    any one can help.

    tks

  2. #2
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    5,521

    Re: VSFlexigrid Highlight on Hover

    No flickering for me with this:
    Code:
    Option Explicit
    
    Private Sub Form_Load()
      Dim lRow As Long, lCol As Long
      With VSFlexGrid1
        .Rows = 10
        .Cols = 4
        For lRow = 0 To .Rows - 1
          For lCol = 0 To .Cols - 1
            .TextMatrix(lRow, lCol) = "R" & CStr(lRow) & "C" & CStr(lCol)
          Next
        Next
        .SelectionMode = flexSelectionByRow
      End With
    End Sub
    
    Private Sub VSFlexGrid1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
      With VSFlexGrid1
        If .MouseRow <> -1 And .MouseCol <> -1 Then .Select .MouseRow, 0
      End With
    End Sub

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2011
    Posts
    439

    Re: VSFlexigrid Highlight on Hover

    Quote Originally Posted by Arnoutdv View Post
    No flickering for me with this:
    Code:
    Option Explicit
    
    Private Sub Form_Load()
      Dim lRow As Long, lCol As Long
      With VSFlexGrid1
        .Rows = 10
        .Cols = 4
        For lRow = 0 To .Rows - 1
          For lCol = 0 To .Cols - 1
            .TextMatrix(lRow, lCol) = "R" & CStr(lRow) & "C" & CStr(lCol)
          Next
        Next
        .SelectionMode = flexSelectionByRow
      End With
    End Sub
    
    Private Sub VSFlexGrid1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
      With VSFlexGrid1
        If .MouseRow <> -1 And .MouseCol <> -1 Then .Select .MouseRow, 0
      End With
    End Sub
    TKS.

    i did work out something. I also needed to stay highlighted when selecting multiple rows and this works fine.


    Code:
    Private Sub VSFlexGrid1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    
    If MouseDown = False Then
    If isMultiSelect = False Then
    VSFlexGrid1.Row = VSFlexGrid1.MouseRow
    End If
    End If
    
    
    
    End Sub

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2011
    Posts
    439

    Re: VSFlexigrid Highlight on Hover

    another question re highlighting.

    is there a way to set different cells to have a different forecolour when highlighting or keep the same colour
    when highlighted or not

    tks

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2011
    Posts
    439

    Re: VSFlexigrid Highlight on Hover

    Quote Originally Posted by Arnoutdv View Post
    No flickering for me with this:
    Code:
    Option Explicit
    
    Private Sub Form_Load()
      Dim lRow As Long, lCol As Long
      With VSFlexGrid1
        .Rows = 10
        .Cols = 4
        For lRow = 0 To .Rows - 1
          For lCol = 0 To .Cols - 1
            .TextMatrix(lRow, lCol) = "R" & CStr(lRow) & "C" & CStr(lCol)
          Next
        Next
        .SelectionMode = flexSelectionByRow
      End With
    End Sub
    
    Private Sub VSFlexGrid1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
      With VSFlexGrid1
        If .MouseRow <> -1 And .MouseCol <> -1 Then .Select .MouseRow, 0
      End With
    End Sub
    sorry , but another question.

    I have the selection of a range of cells , but what if i then want to also select a row a few down from the initial selection.

    I know how to check if Ctrl is down so am trying to keep the initial selection and add a row.

    Is this possible.?

    Dont worry. I solved it.

    the grid has a Listboxselection feature. and then i can multi select so got it all working.
    Last edited by k_zeon; Feb 7th, 2023 at 03:04 PM.

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