Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Partial Horizontal Scrolling of MSFlexGrid

Posted on 1998-09-23
3
Medium Priority
?
951 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 2

Accepted Solution

by:
schild earned 150 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…
Suggested Courses

722 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