>>Now the hard part, getting the grid to use this header class. In the grid's Init;
>>
>>
>>SET PROCEDURE TO <ThePrgThatHasTheDefineClassInIt> ADDITIVE
>>WITH THIS
>> FOR Col IN .Columns
>> .RemoveObject("Header1")
>> .AddObject("Header1","MyHeader")
>> ENDFOR
>>ENDWITH
>>
>
>Jim- I have toyed around with this kind of thing before, but never really gone too far with it, because I can't get properties copied from the form designer header to the 'myheader' automatically. Have you ever seen a way devised to 'loop' through an object properties, for the purpose of mimicking them in another object?
I've done it for the OptionGroup - here's the code:
with this
.visible=.t.
local i, maxwidth, _cap, _top, _width, oldname, newname
maxwidth=0
if .buttoncount=0
.buttoncount=1
endif
for i=1 to .buttoncount
oldname="option"+allt(str(i))
with eval("."+oldname)
_cap=.caption
_top=.top
_width=.width
endwith
.removeobject(oldname)
newname="rdugme"+allt(str(i))
.addobject(newname, "gradio_b")
with eval("."+newname)
.visible=.t.
.caption=_cap
.top=_top
.width=_width
endwith
maxwidth=max(maxwidth, _width)
endfor
.height=.buttons(.buttoncount).top+.buttons(.buttoncount).height
.width=maxwidth
endwith
It's in the group's Init. Analogous code can be used for any other container objects of the kind (commandbutton groups, pageframes, grids).