Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Anders Altberg
  Where is Anders Altberg?
 Uppsala
 Sweden
 Anders Altberg
 To: Ilya Rabyy
  Where is Ilya Rabyy?
 Fountain Valley
 California - United States
 Ilya Rabyy
 Tags
Subject: RE: "SetAll" for Click on a Grid's component
Thread ID: 365611 Message ID: 365704 # Views: 34 # Ratings: 0
Version: Visual FoxPro 9 SP2 Category: Grids
Date: Sunday, December 30, 2012 3:08:19 PM         
   


> 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


Here's a piece of code from way back in Foxite 2009. Message ID: 231966

Grid.Init 
FOR EACH oCol IN This.Columns  
 Bindevent(oCol.Objects(1), "DblClick", Thisform, "ReOrderGrid")
Next 



Procedure ReorderGrid && new form method
LOCAL lcCol, loHeader, loCol, lcRecordSource
LOCAL ARRAY aArr(1)
AEVENTS(aArr,0) 
loHeader=aArr(1)
loCol= loHeader.Parent
lcCol= JustExt(loCol.ControlSource) 
lcRecordSource=loCol.Parent.RecordSource
* do what needs doing
EndProc


-Anders

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