Solved

Partial Horizontal Scrolling of MSFlexGrid

Posted on 1998-09-23
3
927 Views
Last Modified: 2012-08-13
Is it possible to do horizontal scrolling on only a portion of the columns of a MSFlexgrid?

Suppose I create a MSFlexgrid which is 30 columns wide.  I make it so that only 10 columns can be displayed on the screen and the remainder can be scrolled right and left with a horizontal scroll bar.  So far so good.

Is there any way that I can control the scroll so that columns 0 to 4 stay in a fixed horizontal position and columns 5 to 29 are the only ones affected by the scroll bar - sort of like a Lotus spreadsheet with the first 5 columns fixed?

PLEASE NOTE: that I do not want to declare columns 0 to 4 as "fixed" columns in the usual sense.  I want to reserve this for column 0 only (with the usual light grey backgound color for the purpose of highlighting Row Titles etc.).

I still want to have columns 1 to 4 behave as normal FlexGrid columns where cells can be selected and highlighted by dragging focus rectangle with the mouse in the conventional manner.  Its just that I want to "FREEZE" them from scrolling horizontally.

The only solution I can think of is to have TWO FlexGrids side by side.  The first one will be 5 columns wide with NO scroll bar.  And the second one will be 25 columns wide WITH a scroll bar.  Then I must figure out how to link them together so that they are both controlled by the same VERTICAL scroll bar and they appear to the user to be just one FlexGrid.

dougr
0
Comment
Question by:dougr
  • 2
3 Comments
 
LVL 2

Accepted Solution

by:
schild earned 50 total points
ID: 1436383
Hello Dougr

First the bad news. No you can't simply scroll part of the cells.
Your idea for putting a control by control is the only idea I know.
As for the scrolling synchronize, here is the needed code:
(I assumed that you put the scrollbar in the second control)

Private Sub MSFlexGrid2_Scroll()

    MSFlexGrid1.TopRow = MSFlexGrid2.TopRow
   
End Sub

Good luck
Schild


0
 

Author Comment

by:dougr
ID: 1436384
To: schild  

Thanks for the bad news and the code.

Actually either of the two FlexGrids can be scrolled (by vertical Scroll Bars, PgUp/Dn, ArrowUp/Dn keys etc.) so I put similar code in the Scroll event of both FlexGrids.

It seems to work ok, but it makes revisions, inserts, deletes and updates quite a bit more complex as I must write code for both grids.  Oh well, C'est la vie!

dougr
0
 

Author Comment

by:dougr
ID: 1436385
To: schild  

Thanks for the bad news and the code.

Actually either of the two FlexGrids can be scrolled (by vertical Scroll Bars, PgUp/Dn, ArrowUp/Dn keys etc.) so I put similar code in the Scroll event of both FlexGrids.

It seems to work ok, but it makes revisions, inserts, deletes and updates quite a bit more complex as I must write code for both grids.  Oh well, C'est la vie!

dougr
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now