Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Bindevent and Grid Columns
Message
From
27/05/2010 18:58:38
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
Miscellaneous
Thread ID:
01466311
Message ID:
01466318
Views:
45
Thanks Naomi. I've taken a quick look at your code and can see how BindEvent is being used. I'll see about adapting it tommorrow. A couple of preliminary questions first.

I drop this class on a form
In the form's Init I run a query that has seven fields in the resultset
I set the columnCount of the grid to 7.
If I later run another query that sets columnCount to 10, will columns 8, 9, and 10 be bound?

Thanks.....

>Rich,
>
>Bindevent is the way to go. Take a look at the complete implementation at this blog
>Grid class that allows sorting by clicking on headers
>
>
>>I inherited a custom grid class. The definition of the grid shows a ColumnCount of 30. Three methods of EACH column in the grid have code in them.
>>
>>
>>The MouseDown code for the Header of each column is
>>
>>LPARAMETERS nButton, nShift, nXCoord, nYCoord
>>This.Parent.Parent.origcolnum = this.Parent.ColumnOrder
>>
>>The Click code for the Header of each column is
>>
>>IF this.Parent.Parent.origcolnum = this.Parent.ColumnOrder
>>	this.Parent.parent.SortGrid(this.Parent)  
>>ENDIF
>>
>>The DblClick code for the TextBox inside each column is
>>
>>this.Parent.Parent.filtercolumn=this
>>this.parent.parent.DblClick()
>>
>>We've run into a situation where the ColumnCount for the grid needs to expand beyond 30 columns. Our "solution" is to expand the numbe of columns (to 50) and put this code into each new column's header/text box. This solution works and is therefore, by our definition, acceptable and has been implemented.
>>
>>OTOH, it seems to me that there should be a better solution by taking all this code out of the column header and text box and somehow using BINDEVENT() to get everything working. I don't have enough familiarity with BINDEVENT to do this and my (admittedly meager) efforts have been fruitless.
>>
>>Could somebody please provide some guidance on
>>
>>1. Is BINDEVENT a reasonable way of attaching code to the header/textbox of each column in the grid
>>
>>2. Coding technique for actually getting it done
>>
>>3. If the form reduces ColumnCount and later expands it, will all the columns still be "bound"
>>
>>4. If not is there an _ASSIGN method (or something else that doesn't have to be coded in the application) for ColumnCount where I can rebind all the columns?
>>
>>I hope this is comprehensible.........
>>
>>Thanks to all.............Rich
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform