Solved

Partial Horizontal Scrolling of MSFlexGrid

Posted on 1998-09-23
3
930 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

911 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

16 Experts available now in Live!

Get 1:1 Help Now