Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How do I lock a column in a grid
Message
From
03/05/2000 19:57:35
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00365799
Message ID:
00365874
Views:
12
>Can anyone tell me how to lock a column in a grid so it doesn't scroll out of view when I SetFocus to another column? I'm familiar with the FPW BROSE LOCK.. syntax but don't know how to do it in VFP Grids.

AFAIK, Its not very easy, here's one way to go about it:
oForm = createobject('oMyForm')
oForm.show(1)

define class oMyForm as form
	width = 500

	add object oBottomGrid as oMyBottomGrid with ;
		top = 25, ;
		left = 25, ;
		width = 420

	add object oTopGrid as oMyTopGrid with ;
		top = 25, ;
		left = 25, ;
		width = 197, ;
		height = 180, ;
		scrollbars = 0

	add object oPaintForm as oMyTimer

	proc init
		lockscreen = .t.
		this.oBottomGrid.doscroll(5)
		this.oBottomGrid.doscroll(4)
		lockscreen = .f.
		this.refresh
		this.click
	endproc
enddefine

define class oMyBottomGrid as grid
	recordsource = 'labels.dbf'
	recordsourcetype = 0

	proc scrolled
		lparameters nDirection
		thisform.lockscreen = .f.
		thisform.oTopGrid.zorder(0)
		thisform.lockscreen = .t.
		thisform.paint
		thisform.refresh
	endproc

	proc init
		this.setall('Width', 50, 'Column')
	endproc
enddefine

define class oMyTopGrid as grid
	recordsource = 'labels.dbf'
	recordsourcetype = 0

	proc init
		this.setall('Width', 50, 'Column')
	endproc
enddefine

define class oMyTimer as timer
	interval = 100

	proc timer
		thisform.lockscreen = .f.
		this.enabled = .f.
	endproc
enddefine
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform