Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Subclassed grid members
Message
From
02/10/1997 12:55:53
 
 
To
02/10/1997 11:33:38
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00052763
Message ID:
00052881
Views:
31
>>>Dragan-
>>>the way I have dealt with getting custom controls into a default grid. I have a grid class called smartgrid which pulls my classes in depending on the datatype of the controlsource of the column.
>>
>>Woops... left out the code
>>FOR lnCount = 1 to this.ColumnCount
>> ccolumn = this.Columns[lnCount]
>> ccolumn.RemoveObject("header1")
>> ccolumn.AddObject("myheader1","myheader")
>> do case
>> case type(ccolumn.controlsource) = "N"
>> ccolumn.RemoveObject("text1")
>> ccolumn.AddObject("myspinner1","myspinner")
>> ccolumn.myspinner1.visible = .T.
>> case type(ccolumn.controlsource) = "L"
>> ccolumn.RemoveObject("text1")
>> ccolumn.AddObject("mycheck1","mycheck")
>> ccolumn.mycheck1.visible = .T.
>> otherwise
>> cColumn.RemoveObject("text1")
>> ccolumn.AddObject("mytext1","Mytext")
>> ccolumn.mytext1.visible = .T.
>> endcase
>>ENDFOR
>>
>>Of course you must have already created a header class with something like the following:
>>
>>DEFINE CLASS MyHeader AS Header
>> PROCEDURE click
>> blah, blah, blah
>> ENDPROC
>>ENDDEFINE
>>
>>You probably have something like this already laid out, but I thought I'd offer my solution to see if it gave any ideas. It might seem like jumping through hoops to get a simple outcome, but this class can be dropped on a form and VFP takes care of column sizing and controlsources for you. HTH
>
>Where do you have the header class defined?

It doesn't really matter, as long as it is defined before the grid is initialized. Just remember that headers cannot be subclassed visually, this is why it must be done in code every time. I would put it in a procedure file or the startup program of the app.

To make it more widely usable, my grid class actually has properties where you can specify what class to use for the different data types, and for the header:

ccolumn.AddObject("myheader1", thisform.headerclass),
ccolumn.AddObject("myheader1",thisform.logicalclass)

This is in case you have defined more than one class for the header and you want to use different headers on different forms.
Erik Moore
Clientelligence
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform