Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Stefan Wuebbe
  Where is Stefan Wuebbe?
 Hamburg
 Germany
 Stefan Wuebbe
 To: Sithu Kyaw
  Where is Sithu Kyaw?
 Yangon
 Myanmar
 Sithu Kyaw
 Tags
Subject: RE: Replace textbox with label in grid
Thread ID: 364968 Message ID: 365334 # Views: 28 # Ratings: 0
Version: Visual FoxPro 9 Category: Grids
Date: Monday, December 24, 2012 10:17:05 AM         
   


> Hi Stefan,
>
> If Column.Enabled = .F. or Column.Text1.Style = 1, the method "HandleClick" is not triggered.
>


Hi Sithu,

That's right, a disabled control does not Click(), that's by design and same in other languages I think.

Trying to put together what you said about your requirements, I believe you may perhaps want to go the Grid.AllowCellSelection=.F. way together with using Grid.GridHitTest() in order to simulate a Click() on the multi-select check-box column, see also the sample pasted below



hth
-Stefan



CLEAR
LOCAL oForm as Form
oForm = CREATEOBJECT('TestForm')
oForm.Show(1)
RETURN

DEFINE CLASS TestForm as Form
	AutoCenter = .T.
	DataSession = 2
	Width = 400
	Height = 300
	
	PROCEDURE Load
		LOCAL i
		CREATE CURSOR temp (col1 L, col2 I, col3 I)
		FOR i = 1 TO 5
			INSERT INTO temp VALUES (.F., i, i * 2)
		ENDFOR
		GO TOP IN temp
	ENDPROC

	ADD OBJECT Grid1 as Grid WITH ;
		Left = 5, Top = 5, Width = 390, Height = 290, Anchor = 15, ;
		RecordSource = 'temp', ColumnCount = 3, ;
		AllowCellSelection = .F., IsCheckBoxClicked = .F.
	
	PROCEDURE Grid1.Init
		WITH This.Column1 as Column
			.AddObject("Check1", "CheckBox")
			.Check1.Caption = ""
			.Check1.BackStyle = 0
			.Check1.Visible = .T.
			.CurrentControl = "Check1"
			.Sparse = .F.
			.Header1.Caption = ""
			.Alignment = 2
			.Width = 20
			.Movable = .F.
		ENDWITH
	ENDPROC
	PROCEDURE Grid1.MouseDown(nButton, nShift, nXCoord, nYCoord)
		LOCAL lnWhere, lnRelRow, lnRelCol
		This.GridHitTest(m.nXCoord, m.nYCoord, @lnWhere, @lnRelRow, @lnRelCol)
		This.IsCheckBoxClicked = m.lnWhere == 3 And m.lnRelCol == 1
	ENDPROC
	PROCEDURE Grid1.Click
		IF This.IsCheckBoxClicked
			REPLACE col1 WITH !col1 IN This.RecordSource
		ENDIF
	ENDPROC
ENDDEFINE


ENTIRE THREAD

Replace textbox with label in grid Posted by Sithu Kyaw @ 12/20/2012 12:15:36 PM
RE: Replace textbox with label in grid Posted by Borislav Borissov @ 12/20/2012 12:24:31 PM
RE: Replace textbox with label in grid Posted by Sithu Kyaw @ 12/20/2012 12:37:10 PM
RE: Replace textbox with label in grid Posted by Stefan Wuebbe @ 12/20/2012 12:49:02 PM
RE: Replace textbox with label in grid Posted by Borislav Borissov @ 12/20/2012 1:17:27 PM
RE: Replace textbox with label in grid Posted by Jun Tangunan @ 12/20/2012 11:52:07 PM
RE: Replace textbox with label in grid Posted by Sithu Kyaw @ 12/21/2012 5:47:32 AM
RE: Replace textbox with label in grid Posted by Jun Tangunan @ 12/21/2012 6:28:27 AM
RE: Replace textbox with label in grid Posted by Rahul Moudgill @ 12/21/2012 6:02:07 AM
RE: Replace textbox with label in grid Posted by Sithu Kyaw @ 12/21/2012 6:19:44 AM
RE: Replace textbox with label in grid Posted by Rahul Moudgill @ 12/21/2012 5:06:34 PM
RE: Replace textbox with label in grid Posted by David Mustakim @ 12/21/2012 6:05:10 PM
RE: Replace textbox with label in grid Posted by Rahul Moudgill @ 12/21/2012 6:06:45 PM
RE: Replace textbox with label in grid Posted by Stefan Wuebbe @ 12/20/2012 12:41:52 PM
RE: Replace textbox with label in grid Posted by Sithu Kyaw @ 12/21/2012 5:45:08 AM
RE: Replace textbox with label in grid Posted by Stefan Wuebbe @ 12/21/2012 7:43:20 AM
RE: Replace textbox with label in grid Posted by Sithu Kyaw @ 12/21/2012 8:18:28 AM
RE: Replace textbox with label in grid Posted by Stefan Wuebbe @ 12/21/2012 9:26:16 AM
RE: Replace textbox with label in grid Posted by Sithu Kyaw @ 12/21/2012 9:42:20 AM
RE: Replace textbox with label in grid Posted by Sithu Kyaw @ 12/23/2012 1:57:35 PM
RE: Replace textbox with label in grid Posted by Stefan Wuebbe @ 12/24/2012 10:17:05 AM
RE: Replace textbox with label in grid Posted by Sithu Kyaw @ 12/24/2012 10:28:38 AM
RE: Replace textbox with label in grid Posted by David Mustakim @ 12/21/2012 6:09:02 PM
RE: Replace textbox with label in grid Posted by Rahul Moudgill @ 12/21/2012 5:38:08 PM
RE: Replace textbox with label in grid Posted by Sithu Kyaw @ 12/23/2012 2:26:42 PM
RE: Replace textbox with label in grid Posted by Rahul Moudgill @ 12/24/2012 6:39:46 AM
RE: Replace textbox with label in grid Posted by Sithu Kyaw @ 12/24/2012 6:47:36 AM
RE: Replace textbox with label in grid Posted by Rahul Moudgill @ 12/24/2012 6:52:57 AM
RE: Replace textbox with label in grid Posted by Sithu Kyaw @ 12/24/2012 5:50:11 AM
RE: Replace textbox with label in grid Posted by Rahul Moudgill @ 12/24/2012 6:49:12 AM
RE: Replace textbox with label in grid Posted by Sithu Kyaw @ 12/24/2012 6:53:17 AM
RE: Replace textbox with label in grid Posted by Rahul Moudgill @ 12/24/2012 6:58:19 AM
RE: Replace textbox with label in grid Posted by Sithu Kyaw @ 12/24/2012 9:32:18 AM
RE: Replace textbox with label in grid Posted by Rahul Moudgill @ 12/24/2012 11:49:15 AM
RE: Replace textbox with label in grid Posted by Rahul Moudgill @ 12/24/2012 7:00:04 AM
RE: Replace textbox with label in grid Posted by Sithu Kyaw @ 12/24/2012 7:07:41 AM
RE: Replace textbox with label in grid Posted by Rahul Moudgill @ 12/24/2012 7:33:26 AM
RE: Replace textbox with label in grid Posted by Sithu Kyaw @ 12/24/2012 7:43:54 AM
RE: Replace textbox with label in grid Posted by Cetin Basoz @ 12/24/2012 3:39:20 AM
RE: Replace textbox with label in grid Posted by Sithu Kyaw @ 12/24/2012 6:01:35 AM
RE: Replace textbox with label in grid Posted by Cetin Basoz @ 12/24/2012 8:46:35 AM