Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to freeze a grid column ?
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00452047
Message ID:
00458393
Views:
15
>Can any one tell me how to freeze one or more columns
>on the left side in a grid table ?



Here is a Freeze Grid Coding which can be d/l at File section.

You need to Add a New Form Property: BLOCKSCROLL from menu bar.
**** Grid.AfterRowColChange event
LPARAMETERS nColIndex
THIS.SCROLLED


**** 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
			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.



Well, I'd like to tell what BUG may happen:

If you got a Column which Column width > 1/3 of the whole grid,
you may LOCK the right side column
when you Click the bottom rightmost [>] button to see the Next Column...
but you will work fine by type TAB inside grid cell.

If user Drag the non-1st column into column1 place...
All gone Crazy, (as For loop make the screen TOO many Refresh!) Flash~ Flash~ Flash~





What a suggest here as the first reply of this thread...
- split grid into 2 parts
- use code to Freeze "partition" of grid (Most likely at AfterRowColChange Event)
- Disable column1, So if user type tab within cell, it will loop to Column2 automatically.
The weak wait for chance, The strong bid for chance,
The clever notch up chance, but The merciful give you chance.
Previous
Reply
Map
View

Click here to load this message in the networking platform