MSFlex Grid Control - Fixed Rows

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Otie

    MSFlex Grid Control - Fixed Rows

    Hello,

    I am using the MSFlexGrd Control in VB5. I have 1 fixed row and one fixed
    column. I am trying to do a sort when the user clicks a column in the FIXED
    ROW. But when I capture the row number in the click event I get row = 1 if I
    click on the FIXED row OR the actual row 1. How can I get the grid control
    to tell me when the user has clicked on the FIXED row and not on row 1
    (since they both produce row = 1 and I cannot tell them apart when it does
    this)?

    Thank you.


    Otis


  • Randy Birch

    #2
    Re: MSFlex Grid Control - Fixed Rows

    ????

    You say you want to sort when the user clicks a column in the fixed row
    (which is the row across the top of the control), then go on to say you are
    capturing the row number in the click event which will always be (correctly)
    1 because clicking the header selects the entire column and moves the focus
    rectangle to the first work row (the row 1 you mention).

    If you want to determine the column clicked when a header in the top fixed
    row is clicked, all you need is:

    Private Sub MSFlexGrid1_Mou seDown(...
    If MSFlexGrid1.Row = 1 Then
    Debug.Print MSFlexGrid1.Col
    End If
    End Sub


    Similarly the reverse holds true for detecting the row clicks when the row
    fixed header is clicked:

    Private Sub MSFlexGrid1_Mou seDown(...
    If MSFlexGrid1.Col = 1 Then
    Debug.Print MSFlexGrid1.Row
    End If
    End Sub

    --

    Randy Birch
    MS MVP Visual Basic


    Please reply to the newsgroups so all can participate.




    "Otie" <otie_nospam@ad elphia.net> wrote in message
    news:SI6dnTgnkp TEo5LZRVn-sw@adelphia.com ...
    Hello,

    I am using the MSFlexGrd Control in VB5. I have 1 fixed row and one fixed
    column. I am trying to do a sort when the user clicks a column in the FIXED
    ROW. But when I capture the row number in the click event I get row = 1 if I
    click on the FIXED row OR the actual row 1. How can I get the grid control
    to tell me when the user has clicked on the FIXED row and not on row 1
    (since they both produce row = 1 and I cannot tell them apart when it does
    this)?

    Thank you.


    Otis


    Comment

    • Rick Rothstein [MVP - Visual Basic]

      #3
      Re: MSFlex Grid Control - Fixed Rows

      You can also use the MouseRow and MouseCol properties.

      Rick



      "Randy Birch" <rgb_removethis @mvps.org> wrote in message
      news:440f7c89$0 $11244$c3e8da3@ news.astraweb.c om...[color=blue]
      > ????
      >
      > You say you want to sort when the user clicks a column in the fixed row
      > (which is the row across the top of the control), then go on to say you[/color]
      are[color=blue]
      > capturing the row number in the click event which will always be[/color]
      (correctly)[color=blue]
      > 1 because clicking the header selects the entire column and moves the[/color]
      focus[color=blue]
      > rectangle to the first work row (the row 1 you mention).
      >
      > If you want to determine the column clicked when a header in the top fixed
      > row is clicked, all you need is:
      >
      > Private Sub MSFlexGrid1_Mou seDown(...
      > If MSFlexGrid1.Row = 1 Then
      > Debug.Print MSFlexGrid1.Col
      > End If
      > End Sub
      >
      >
      > Similarly the reverse holds true for detecting the row clicks when the row
      > fixed header is clicked:
      >
      > Private Sub MSFlexGrid1_Mou seDown(...
      > If MSFlexGrid1.Col = 1 Then
      > Debug.Print MSFlexGrid1.Row
      > End If
      > End Sub
      >
      > --
      >
      > Randy Birch
      > MS MVP Visual Basic
      > http://vbnet.mvps.org/
      >
      > Please reply to the newsgroups so all can participate.
      >
      >
      >
      >
      > "Otie" <otie_nospam@ad elphia.net> wrote in message
      > news:SI6dnTgnkp TEo5LZRVn-sw@adelphia.com ...
      > Hello,
      >
      > I am using the MSFlexGrd Control in VB5. I have 1 fixed row and one fixed
      > column. I am trying to do a sort when the user clicks a column in the[/color]
      FIXED[color=blue]
      > ROW. But when I capture the row number in the click event I get row = 1 if[/color]
      I[color=blue]
      > click on the FIXED row OR the actual row 1. How can I get the grid control
      > to tell me when the user has clicked on the FIXED row and not on row 1
      > (since they both produce row = 1 and I cannot tell them apart when it does
      > this)?
      >
      > Thank you.
      >
      >
      > Otis
      >
      >[/color]


      Comment

      • Otie

        #4
        Re: MSFlex Grid Control - Fixed Rows

        I think you misunderstand.

        When I click on column 9 in the fixed row, VB returns row = 1. I want this
        click to do a sort on the data in column 9.
        But when I click on the CELL in column 9, row 1, or any row, I want to take
        that cell value and store it somewhere.
        The problem with VB is that if you click on any column in a fixed row it
        returns the row number as if you had clicked on the actual row 1, not in the
        fixed row. These different clicks (one on the fixed row, column 9 and the
        other on the actual row 1 [non-fixed row], column 9) HAVE TO be detected
        differently or else I am screwed (I won't be able to detect when the user
        wants to sort versus when he wants to capture cell contents.

        I hope I am more clear here.

        I will try Rick's suggestion about MouseRow.

        Thank you.



        --

        Otis



        "Randy Birch" <rgb_removethis @mvps.org> wrote in message
        news:440f7c89$0 $11244$c3e8da3@ news.astraweb.c om...[color=blue]
        > ????
        >
        > You say you want to sort when the user clicks a column in the fixed row
        > (which is the row across the top of the control), then go on to say you
        > are
        > capturing the row number in the click event which will always be
        > (correctly)
        > 1 because clicking the header selects the entire column and moves the
        > focus
        > rectangle to the first work row (the row 1 you mention).
        >
        > If you want to determine the column clicked when a header in the top fixed
        > row is clicked, all you need is:
        >
        > Private Sub MSFlexGrid1_Mou seDown(...
        > If MSFlexGrid1.Row = 1 Then
        > Debug.Print MSFlexGrid1.Col
        > End If
        > End Sub
        >
        >
        > Similarly the reverse holds true for detecting the row clicks when the row
        > fixed header is clicked:
        >
        > Private Sub MSFlexGrid1_Mou seDown(...
        > If MSFlexGrid1.Col = 1 Then
        > Debug.Print MSFlexGrid1.Row
        > End If
        > End Sub
        >
        > --
        >
        > Randy Birch
        > MS MVP Visual Basic
        > http://vbnet.mvps.org/
        >
        > Please reply to the newsgroups so all can participate.
        >
        >
        >
        >
        > "Otie" <otie_nospam@ad elphia.net> wrote in message
        > news:SI6dnTgnkp TEo5LZRVn-sw@adelphia.com ...
        > Hello,
        >
        > I am using the MSFlexGrd Control in VB5. I have 1 fixed row and one fixed
        > column. I am trying to do a sort when the user clicks a column in the
        > FIXED
        > ROW. But when I capture the row number in the click event I get row = 1 if
        > I
        > click on the FIXED row OR the actual row 1. How can I get the grid control
        > to tell me when the user has clicked on the FIXED row and not on row 1
        > (since they both produce row = 1 and I cannot tell them apart when it does
        > this)?
        >
        > Thank you.
        >
        >
        > Otis
        >
        >[/color]


        Comment

        • Otie

          #5
          Re: MSFlex Grid Control - Fixed Rows

          From VB Help (don't know why I didn't see this - have used the grid control
          for years - yikes!):


          MouseCol, MouseRow Properties

          Remarks

          Use these properties programmaticall y to determine the mouse location. These
          properties are useful in displaying context-sensitive help for individual
          cells and testing whether the user has clicked on a fixed row or column.



          This looks like the way to do it.

          Thank you so much.




          --
          Otis



          "Rick Rothstein [MVP - Visual Basic]" <rickNOSPAMnews @NOSPAMcomcast. net>
          wrote in message news:Vp6dnd60MJ oi45LZRVn-pw@comcast.com. ..[color=blue]
          > You can also use the MouseRow and MouseCol properties.
          >
          > Rick
          >
          >
          >
          > "Randy Birch" <rgb_removethis @mvps.org> wrote in message
          > news:440f7c89$0 $11244$c3e8da3@ news.astraweb.c om...[color=green]
          >> ????
          >>
          >> You say you want to sort when the user clicks a column in the fixed row
          >> (which is the row across the top of the control), then go on to say you[/color]
          > are[color=green]
          >> capturing the row number in the click event which will always be[/color]
          > (correctly)[color=green]
          >> 1 because clicking the header selects the entire column and moves the[/color]
          > focus[color=green]
          >> rectangle to the first work row (the row 1 you mention).
          >>
          >> If you want to determine the column clicked when a header in the top
          >> fixed
          >> row is clicked, all you need is:
          >>
          >> Private Sub MSFlexGrid1_Mou seDown(...
          >> If MSFlexGrid1.Row = 1 Then
          >> Debug.Print MSFlexGrid1.Col
          >> End If
          >> End Sub
          >>
          >>
          >> Similarly the reverse holds true for detecting the row clicks when the
          >> row
          >> fixed header is clicked:
          >>
          >> Private Sub MSFlexGrid1_Mou seDown(...
          >> If MSFlexGrid1.Col = 1 Then
          >> Debug.Print MSFlexGrid1.Row
          >> End If
          >> End Sub
          >>
          >> --
          >>
          >> Randy Birch
          >> MS MVP Visual Basic
          >> http://vbnet.mvps.org/
          >>
          >> Please reply to the newsgroups so all can participate.
          >>
          >>
          >>
          >>
          >> "Otie" <otie_nospam@ad elphia.net> wrote in message
          >> news:SI6dnTgnkp TEo5LZRVn-sw@adelphia.com ...
          >> Hello,
          >>
          >> I am using the MSFlexGrd Control in VB5. I have 1 fixed row and one fixed
          >> column. I am trying to do a sort when the user clicks a column in the[/color]
          > FIXED[color=green]
          >> ROW. But when I capture the row number in the click event I get row = 1
          >> if[/color]
          > I[color=green]
          >> click on the FIXED row OR the actual row 1. How can I get the grid
          >> control
          >> to tell me when the user has clicked on the FIXED row and not on row 1
          >> (since they both produce row = 1 and I cannot tell them apart when it
          >> does
          >> this)?
          >>
          >> Thank you.
          >>
          >>
          >> Otis
          >>
          >>[/color]
          >
          >[/color]


          Comment

          Working...