Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: David Mustakim
  Where is David Mustakim?
 Jakarta
 Indonesia
 David Mustakim
 To: Samir H.
  Where is Samir H.?
 Yogyakarta
 Indonesia
 Samir H.
 Tags
Subject: RE: "SetAll" for Click on a Grid's component
Thread ID: 365611 Message ID: 365661 # Views: 38 # Ratings: 0
Version: Visual FoxPro 9 SP2 Category: Grids
Date: Saturday, December 29, 2012 11:27:36 AM         
   


bRAvo!

You learned well from... ehmhmm ..., Sam!

David
..
.


> > Colleagues,
> >
> > I need to have a Grid.Column(m.I).Header1.Click event programmed. Therefore, SetAll method won't do coz it sets property value, not event. That Header1.Click() event code shall set the order to the corresponding field's index tag.
> >
> > The problem is - I dunno how many columns this grid will have on run time, neither the Columns' fields' names: I set the Grid.RecordSource dynamically, after the User selects the table in the File/Open dialog.
> >
> > All I know is that the table will have an index tag named the same as the field's name.
> >
> > I could've solved this problem by creating this grid at design time with assuredly excessive number of columns with Column.Header1.Click() pre-programmed.
> >
> > Then, after the User have the table selected, bind the latter, field-by-field, to the columns sequentially, and delete the un-used columns.
> >
> > I did it in the past, but that was quite a tedious and (frankly!) messy job, let alone time-consuming. (Making a custom Column object by sub-classing the basic Column ain't appealing either: it still requires a lot of coding for the run-time dynamic table-to-grid column-by-column binding. :-( )
> >
> > Is there any other solution, more elegant and less time-consuming?
> >
> > TIA!
> >
> > Regards,
> >
> > Ilya
>
> Can this code help somehow?
>
PUBLIC oFrm
> oFrm=CREATEOBJECT('test444')
> oFrm.show()
> DEFINE CLASS test444 AS form
> 	ADD OBJECT grid1 AS grid WITH ;
> 		Height = 200, ;
> 		Left = 24, ;
> 		Top = 24, ;
> 		Width = 320, ;
> 		Name = "Grid1"
> 
> 
> 	PROCEDURE hclick
> 		AEVENTS(aObj,0)
> 		oHdr = aObj[1]
> 		cField = oHdr.parent.controlsource
> 		MESSAGEBOX('Fieldname: '+cField+CHR(13)+;
> 			' Field value: '+TRANSFORM(&cField.))
> 	ENDPROC
> 
> 
> 	PROCEDURE Load
> 		CREATE CURSOR a1 (ddate d,cchar c(10),iint i)
> 		INSERT INTO a1 VALUES (DATE(),'Me',1)
> 		INSERT INTO a1 VALUES (DATE()+1,'you',2)
> 		INSERT INTO a1 VALUES (DATE()+2,'him',3)
> 		LOCATE 
> 	ENDPROC
> 
> 
> 	PROCEDURE Init
> 		this.grid1.RecordSource='a1'
> 		FOR EACH oCol IN this.grid1.Columns
> 			BINDEVENT(oCol.header1,'click',this,'hclick')
> 		NEXT 
> 	ENDPROC
> 
> 
> ENDDEFINE

>
> Regards
> Samir

ENTIRE THREAD

"SetAll" for Click on a Grid's component Posted by Ilya Rabyy @ 12/28/2012 4:52:02 PM
RE: "SetAll" for Click on a Grid's component Posted by Koen Piller @ 12/28/2012 6:24:59 PM
RE: "SetAll" for Click on a Grid's component Posted by Ilya Rabyy @ 12/28/2012 6:34:36 PM
RE: "SetAll" for Click on a Grid's component Posted by David Mustakim @ 12/28/2012 7:29:23 PM
RE: "SetAll" for Click on a Grid's component Posted by Ilya Rabyy @ 12/28/2012 7:37:06 PM
RE: "SetAll" for Click on a Grid's component Posted by David Mustakim @ 12/28/2012 7:51:06 PM
RE: "SetAll" for Click on a Grid's component Posted by Ilya Rabyy @ 12/28/2012 8:18:54 PM
RE: "SetAll" for Click on a Grid's component Posted by David Mustakim @ 12/28/2012 8:27:51 PM
RE: "SetAll" for Click on a Grid's component Posted by Ilya Rabyy @ 12/28/2012 8:46:01 PM
RE: "SetAll" for Click on a Grid's component Posted by David Mustakim @ 12/30/2012 2:15:11 AM
RE: "SetAll" for Click on a Grid's component Posted by David Mustakim @ 12/28/2012 8:00:31 PM
RE: "SetAll" for Click on a Grid's component Posted by Rick Hodgin @ 12/28/2012 10:08:56 PM
RE: "SetAll" for Click on a Grid's component Posted by Ilya Rabyy @ 12/28/2012 10:39:58 PM
RE: "SetAll" for Click on a Grid's component Posted by David Mustakim @ 12/28/2012 11:21:00 PM
RE: "SetAll" for Click on a Grid's component Posted by Rick Hodgin @ 12/29/2012 12:15:55 AM
RE: "SetAll" for Click on a Grid's component Posted by David Mustakim @ 12/29/2012 4:30:20 AM
RE: "SetAll" for Click on a Grid's component Posted by David Mustakim @ 12/29/2012 4:41:23 AM
RE: "SetAll" for Click on a Grid's component Posted by Rick Hodgin @ 12/29/2012 5:18:36 AM
RE: "SetAll" for Click on a Grid's component Posted by David Mustakim @ 12/30/2012 2:21:33 AM
RE: "SetAll" for Click on a Grid's component Posted by Rick Hodgin @ 12/30/2012 2:40:52 AM
RE: "SetAll" for Click on a Grid's component Posted by David Mustakim @ 12/30/2012 3:00:46 AM
RE: "SetAll" for Click on a Grid's component Posted by Rick Hodgin @ 12/30/2012 3:09:49 AM
RE: "SetAll" for Click on a Grid's component Posted by David Mustakim @ 12/30/2012 3:19:19 AM
RE: "SetAll" for Click on a Grid's component Posted by Rick Hodgin @ 12/30/2012 4:52:53 AM
RE: "SetAll" for Click on a Grid's component Posted by Samir H. @ 12/30/2012 7:09:16 AM
RE: "SetAll" for Click on a Grid's component Posted by Rick Hodgin @ 12/30/2012 2:33:42 PM
RE: "SetAll" for Click on a Grid's component Posted by Rick Hodgin @ 12/28/2012 6:53:02 PM
RE: "SetAll" for Click on a Grid's component Posted by Samir H. @ 12/29/2012 7:51:58 AM
RE: "SetAll" for Click on a Grid's component Posted by David Mustakim @ 12/29/2012 11:27:36 AM
RE: "SetAll" for Click on a Grid's component Posted by Anders Altberg @ 12/30/2012 3:08:19 PM