Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Grids Partial AllowCellSelection?
Message
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP1
Network:
Windows 2000 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
00998458
Message ID:
00998509
Views:
52
This message has been marked as the solution to the initial question of the thread.
Hi Chad,

You can use GridHitTest method to determine where user clicked on the grid and update checkbox accordingly. See and run sample code below.
PUBLIC oform1

oform1=NEWOBJECT("form1")
oform1.Show
RETURN


DEFINE CLASS form1 AS form
	Top = 0
	Left = 0
	Height = 276
	Width = 504
	DoCreate = .T.
	Caption = "Form1"
	ngridx = 0
	ngridy = 0
	Name = "Form1"

	ADD OBJECT grid1 AS grid WITH ;
		ColumnCount = 3, ;
		HeaderHeight = 39, ;
		Height = 216, ;
		Left = 12, ;
		Panel = 1, ;
		Top = 24, ;
		Width = 456, ;
		AllowCellSelection = .F., ;
		Name = "Grid1", ;
		Column1.Width = 134, ;
		Column1.Name = "Column1", ;
		Column2.Width = 111, ;
		Column2.Name = "Column2", ;
		Column3.Width = 52, ;
		Column3.Sparse = .F., ;
		Column3.Name = "Column3"

	PROCEDURE grid1.Init
		WITH This.Column3
			.AddObject("Check1","CheckBox")
			.Sparse = .F.
			.CurrentControl = "Check1"
			WITH .Check1
				.Alignment = 2
				.Caption = ""
				.Name = "Check1"
				.Visible = .T.
			ENDWITH
			.RemoveObject("text1")
		ENDWITH
	ENDPROC
	

	PROCEDURE Load
		CREATE CURSOR Test ( t1 C(10), T2 C(10), l1 L)
		INSERT INTO Test VALUES ( "Test 1 ", "Str 1", .F.)
		INSERT INTO Test VALUES ( "Test 2 ", "Str 2", .T.)
		INSERT INTO Test VALUES ( "Test 3 ", "Str 3", .F.)
		INSERT INTO Test VALUES ( "Test 4 ", "Str 4", .T.)


		GO TOP
	ENDPROC


	PROCEDURE grid1.Click
		STORE 0 TO lnWhere, lnRelRow, lnRelCol

		This.GridHitTest(Thisform.nGridX,Thisform.nGridY, @lnWhere, @lnRelRow, @lnRelCol)

		DEBUGOUT PROGRAM(), lnWhere, lnRelRow, lnRelCol

		IF lnWhere = 3			&& Cell
			IF lnRelCol = 3		&& column 3
				This.Columns(lnRelCol).check1.Value = NOT This.Columns(lnRelCol).check1.Value
			ENDIF
		ENDIF
	ENDPROC


	PROCEDURE grid1.MouseDown
		LPARAMETERS nButton, nShift, nXCoord, nYCoord
		Thisform.nGridX = nXCoord
		Thisform.nGridY = nYCoord
	ENDPROC


ENDDEFINE
>I have a grid that I set AllowCellSelection to false so the entire row is highlighted. Now, I have a need to add a new column with a checkbox to allow the user to select multiple rows. Is there a way to simulate the AllowCellSelection = .f. for all columns except the one with the checkbox? I like the look and feel it creates.
>
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform