Controlling two MSFlexGrids with one Scroll Bar? 
Author Message
 Controlling two MSFlexGrids with one Scroll Bar?

Has anyone ever written code to allow one scroll bar to control two
MSFlexGrids?

Essentially what I want to do is to have a couple of fixed rows at the
bottom of a grid with totals. These two rows should always be visible no
matter the users location in the grid. Anyone ever tackled a similar design?

I was wondering if I could simulate it with two grids but the problem the is
what do you do with the additional scroll bars!

TIA,
Paul



Tue, 11 Nov 2003 06:01:50 GMT  
 Controlling two MSFlexGrids with one Scroll Bar?
Using the MS Flexgrid control, I have done exactly that, only used two grids
scrolled together vertically to keep something akin to a split. I wanted to
have only one scroll bar on the right hand grid. What I did was to turn off
the vertical scroll bar on the left grid and use the vertical scroll event
in the right grid to change the toprow property of the left grid. The
problem with that being as easy as it sounds, is that the MS flexgrid
control will not scroll the toprow under program control if the scrollbars
property is set to not have a vertical scrollbar! The workaround, was to
temporarily set the scrollbar property of the left control to scroll
vertical only until the toprow was changed programatically, then the
scrollbars property was set back to None. It was doable, and worked
perfectly. I also wanted to have the a single horizontal bar extend across
both controls, so I turned off the horizontal bars for the grids and added a
separate HScrollbar.

I have since moved on to the vsFlexGrid (in which the MS grid is a subset)
and the latest version has a frozenrows and frozencolumns property to keep
the top rows or left rows frozen from scrolling. The property is different
than the fixed rows. In your case, that would not work exactly because you
are keeping the bottom rows frozen. But you could use my technique.

Here's some of my code that implemented the vertical tracking:

' This handled the vertical scroll of the grid on the right
Private Sub flxFlowSheet_Scroll()
  ' If the flowbase grid does not have a vertical scroll,
  ' then we can't scroll it programmatically; thus, enable
  ' the vertical scrollbar but turn off redraw so we don't
  ' blink it on.
  With flxFlowBase
    ' We do not need to do this if scrolling horizontally
    .Redraw = False
    .ScrollBars = flexScrollBarBoth
    .TopRow = flxFlowSheet.TopRow
    .ScrollBars = flexScrollBarHorizontal
    .Refresh
    .Redraw = True
  End With
End Sub

' This handled horizontal scrolling using a separate scrollbar control
' The left grid was never scrolled horizontally since its columns were
fixed.
Private Sub ScrollFlowSheet()
  With flxFlowSheet
    .Redraw = False
    .ScrollBars = flexScrollBarBoth
    .LeftCol = hscFlowSheet.Value
    .ScrollBars = flexScrollBarVertical
    .Redraw = True
    .SetFocus
  End With
End Sub

Private Sub hscFlowSheet_Change()
  ScrollFlowSheet
End Sub

Private Sub hscFlowSheet_Scroll()
  ScrollFlowSheet
End Sub


Quote:
> Has anyone ever written code to allow one scroll bar to control two
> MSFlexGrids?

> Essentially what I want to do is to have a couple of fixed rows at the
> bottom of a grid with totals. These two rows should always be visible no
> matter the users location in the grid. Anyone ever tackled a similar
design?

> I was wondering if I could simulate it with two grids but the problem the
is
> what do you do with the additional scroll bars!

> TIA,
> Paul



Wed, 12 Nov 2003 02:45:58 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Controlling two MSFlexGrids with one Scroll Bar?

2. One Scroll bar Two Listboxes

3. Userdrawn scroll bars like ones in Win95 Volume control

4. MSFlexGrid Scroll Bars

5. MSFlexgrid scroll bar, help needed

6. MSFlexGrid and vertical scroll bars

7. MSFlexgrid and automatic scroll bar problem

8. MSFlexGrid: scroll bar problem

9. MSFlexGrid Horizontal Scroll Bar

10. Scroll bar controll on MSFLEXGRID

11. Scroll bar controll on MSFLEXGRID

12. Linking scroll bars of two objects??

 

 
Powered by phpBB® Forum Software