Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Locking columns in a grid control
Message
From
21/10/1998 19:26:07
 
 
To
21/10/1998 17:34:33
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00148979
Message ID:
00149173
Views:
18
You missed to look at the second (afterrowcolumnchange) event.

>Wait a second here, guys. I tested the Scrolled event and only found it works with direct hits to the scroll bar. Didn't seem to work when a user was tabbing through fields and the grid scrolled automatically. That made any solution using Scrolled less than complete. Am I missing something?
>
>>>>Does anybody know how to lock a column in a grid control ? I have a grid with about 20 columns, and I always want the first 2 to be visible, regardless of the relativecolumn property.
>>>>
>>>>Any help would be much appreciated.
>>>>
>>>>Derek Chapman
>>>
>>>
>>>>****UT Search *****
>>>>>Is it possible to lock the first column of a grid so that it always stays visible while scrolling the remaining columns
>>>> left and right? I know this can be done in Excel, but I can't seem to find how to do it with a VFP grid.
>>>>
>>>> If you have time and patience, you can play with this two snippets:
>>>>
>>>> **** Grid.Scrolled event
>>>> LPARAMETERS nDirection
>>>> if thisform.blockscroll=.t.
>>>> return
>>>> endif
>>>> thisform.blockscroll=.t.
>>>> do case
>>>> case this.column1.columnorder=this.leftcolumn
>>>> case this.column1.columnorder<=this.leftcolumn-1
>>>> *for n=this.column1.columnorder+1 to this.leftcolumn-1
>>>for n=this.column1.columnorder to this.leftcolumn
>>>> this.column1.columnorder=n
>>>> endfor
>>>> *this.doscroll(4)
>>>> this.refresh
>>>> case this.column1.columnorder>this.leftcolumn
>>>> for n=this.column1.columnorder-1 to this.leftcolumn step -1
>>>> this.column1.columnorder=n
>>>> endfor
>>>> this.column1.setfocus
>>>> endcase
>>>> thisform.blockscroll=.f.
>>>> *** Grid.afterrowcolchange event
>>>> this.scrolled
>>>
>>>I believe this is originally Edward Pikman's code.
>>
>>Thanks Erik! I tried to retrieve this thread right now and was unsuccessful.
Edward Pikman
Independent Consultant
Previous
Reply
Map
View

Click here to load this message in the networking platform