Results 1 to 10 of 10

Thread: Highlight whole row

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2001
    Posts
    164

    Arrow Highlight whole row

    I have a Flexgrid in my form I am trying to highlight the whole row when I click the right mouse button, but it is not working with me..

    This is the code I am using:

    VB Code:
    1. Private Sub msflexgrid1_MouseDown(Button As Integer,
    2. Shift As Integer, X As Single, Y As Single)
    3.  
    4.     If Button = vbRightButton Then
    5.         msflexgrid1.Col = 1
    6.          msflexgrid1.ColSel = msflexgrid1.Cols - 1
    7.    
    8.      End if
    9. End sub

    Any suggestion??

    Thanks in advance

  2. #2
    Frenzied Member TheBionicOrange's Avatar
    Join Date
    Apr 2001
    Location
    Cardiff, UK
    Posts
    1,818
    There is an option called "FullRowSelect" (for the flexgrid)

    Set that to TRUE.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Aug 2001
    Posts
    164
    There is an option called "FullRowSelect" (for the flexgrid)

    Set that to TRUE.
    Where is that exactly I didn't find it in the properties of the MSFLEXGRID!!!

  4. #4
    Frenzied Member TheBionicOrange's Avatar
    Join Date
    Apr 2001
    Location
    Cardiff, UK
    Posts
    1,818
    Apologies thats for a ListView.

    You should have n option called "Selection Mode", if you right click the flexgrid. Setting that to "By Row" should solve your problem.

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Aug 2001
    Posts
    164
    It is already set for by row..

    It is very strange it is working with left mouse click but not with right mouse click code

    I am populating data from access database to the flex grid and using in my form_load function:

    VB Code:
    1. With mfgList
    2.     .Col = 1
    3.     .ColSel = .Cols - 1
    4.    End With

    Does that effects???

  6. #6
    Frenzied Member TheBionicOrange's Avatar
    Join Date
    Apr 2001
    Location
    Cardiff, UK
    Posts
    1,818
    Ah I see now ... sorry I wasn't reading it properly.

    Assuming you have a header row, the following should work for you :


    VB Code:
    1. If Button = vbRightButton Then
    2.         msflexgrid1.Row = msflexgrid1.Row - 1
    3.         msflexgrid1.Col = 1
    4.         msflexgrid1.ColSel = msflexgrid1.Cols - 1
    5.     End If

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Aug 2001
    Posts
    164
    It is not working exactly!!!

    What happen that when I highlight the 2nd row by clicking left mouse button and go to row number 9 and click the right mouse button on row 9 the highlight jumps from row 2 to row 1???

    Very weired??

  8. #8
    Frenzied Member John McKernan's Avatar
    Join Date
    Jan 2002
    Location
    SE PA
    Posts
    1,295
    VB Code:
    1. If Button = vbRightButton Then
    2.         msflexgrid1.Row = msflexgrid1.MouseRow
    3.         msflexgrid1.Col = 1
    4.         msflexgrid1.ColSel = msflexgrid1.Cols - 1
    5.     End If

  9. #9

    Thread Starter
    Addicted Member
    Join Date
    Aug 2001
    Posts
    164

    Exclamation

    But if my MSFlexgrid doesn't contain any records, can i disable the mouse_click event on the Flexgrid because when there is no records in the flexgrid and I click on it it produce an error??

    Thanks

  10. #10
    Frenzied Member John McKernan's Avatar
    Join Date
    Jan 2002
    Location
    SE PA
    Posts
    1,295
    You could set the flexgrids Enabled property = False, or in the mouse event, first test for records, if none simply exit the sub, if there are records then execute the highlight code.

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