Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Column in Grid Visible but not displayed - How to tell ? 1

Status
Not open for further replies.

Goofus828

Programmer
Nov 9, 2005
127
US
Hi all,

I have a grid with 8 columns. The left most column is static with LockColumns = 1 and LockColumnsLeft = 1. Because of the size of the form not all columns can be displayed at once. Columns 2-6 are displayed but 7 & 8 are in the scrollable area on the right side of the grid.

My question is, when the grid is scrolled to the right all the way, columns 1 and 4-8 are displayed but columns 2 and 3 are 'behind' column 1. Is there any property that says Thisform.Grid1.Column2.Displayed = .f. ??

thanks!
 
Obviously, the property you mentioned doesn't exist. But I assume what you are really asking is if there is any way of determining if a particular column is currently visible (as opposed to be being scrolled out of the viewport).

There's no easy way of doing that, but you might be able to do it by means of the grid's GridHitTest method. If so, it would be quite complicated, but perhaps worth exploring further.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
In fact, Mike, there is an easy way. You can use the
Objtoclient() function, it will return 0 as left position for columns not scrolled to a visible position.

Bye, Olaf.
 
Good point, Olaf. Presumably, you would apply the function to the grid column to find its position relative to the containing grid. That would definitely be easier than my suggestion.

I often use OBTOCLIENT() to position a form next to the control that launches it, but it would never have occurred to me to use it with a grid column.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Thanks for the replies guys!

Olaf, I will try your suggestion today and let all know the the results.

Thanks, Josh
 
Hello Mike,

yes, that's the idea. I used it to autoscroll to certain columns.

Objtoclient(thisform.grid1.columns(1),2) is the left postion of the first column, >0 if visible =0 if scrolled out of the visible grid area.

Bye, Olaf.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top