Solved

msflexgrid, need to determine if column is visible within users viewing area

Posted on 2001-08-29
9
360 Views
Last Modified: 2012-06-27
I have a grid with 13 columns. The last 3 columns aren't visible to the user because of the size of the grid. I need to determine this some how. When I scroll over I want to know when they become visible (to the user).

I tried .ColIsVisible - seemed like a piece of cake. NOT, this returns wether the column is hidden or not. The columns aren't hidden, they just aren't in the viewable area.

I tried comparing the grids.width to the columns.CellLeft, this didn't work. It returned what looks like a bad value when the column is outside the viewable area.

So I need some way to tell if a column is within the users viewable area or it's outside.

Thanks.
0
Comment
Question by:RPWard
9 Comments
 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 6437158
am I missing something, or did you not provide the answer yourself:

"I tried comparing the grids.width to the columns.CellLeft, this didn't work. It returned what looks
like a bad value when the column is outside the viewable area."  

Can't you test for that "what looks
like a bad value", and use that to indicate that the column is outside the viewable area?
0
 
LVL 8

Expert Comment

by:DennisBorg
ID: 6437239
RPWard:

I'm curious ... *why* do you want to know when the column is scrolled into the viewable area ... what is your program going to do at that time?
0
 

Accepted Solution

by:
kuppachi earned 200 total points
ID: 6437461
colisvisible(colindex) returns true or false depending on whether the column is in the visible area or not. And not whether it is hidden or not.

try this code before the last column is visible and after u scroll to the last column.

Private Sub Command1_Click()
MsgBox MSFlexGrid1.ColIsVisible(12)
End Sub
0
 
LVL 1

Expert Comment

by:BlaZer
ID: 6437503
The CollsVisible do return if or not the column is in the viewable area...... maybe you are ont using the right index number?
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 27

Expert Comment

by:planocz
ID: 6437520
Yep, I think kuppachi is right.
I checked it with this code

Private Sub MSFlexGrid1_Scroll()
 If MSFlexGrid1.ColIsVisible(12) Then
    MsgBox "here is the first view of cell Scroll 12"
 End If
End Sub
0
 

Author Comment

by:RPWard
ID: 6437671
Bad Value - something less than the grid.width. Looks like columns that are outside the viewable area are just behind the last column as fas as .CellLeft is concerned.
0
 

Author Comment

by:RPWard
ID: 6437756
Thanks, you were right. I was looping through all the columns and part of the loop was changing the current col and row (which I reset at the end of the loop). Problem was - changing the current col and row also changed (I guess) the viewable area, so the ColIsVisible as true. But not when the current col and row were reset.

Your answer helped me find the problem, thanks again.
0
 
LVL 8

Expert Comment

by:DennisBorg
ID: 6437825
RPWard:

I'm still curious.  What special thing are you wanting to do when a certain column comes into view?

-Dennis Borg
0
 

Author Comment

by:RPWard
ID: 6440662
Dennis, I am about to put up another question. Trying to get the headers to merge cells, but still have select highlight on.

What I was playing around with was placing a label (actually a picture box with a label in it) on top of the column header cells I wish to merge. Wish they had a "center across cells" option when building the fixed headers.

Got it to work, but don't like it much. Have to put all kinds of code on labels when clicked on to act like clicking on column headers.

Thanks for being curious  :)
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

746 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

9 Experts available now in Live!

Get 1:1 Help Now