OK, I got the help I needed for my previous questions, now the next one.
I am dynamically building the Grid in the Init Method of my Form. I am using the SELECT table and AFIELDS() to get its field count and field names.
I am using the field count and field names to dynamically set the Grid.Column.Count and then with a FOR ENDFOR loop I am setting up each Column.
SELECT MyTable
=AFIELDS(aryFlds)
mnFldCnt = ALEN(aryFlds,1)
ThisForm.Grid.ColumnCount = mnFldCnt
FOR i = 1 TO mnFldCnt
mcFldName = aryFlds(i,1)
* --- Set Column Control Source ---
mcControlSource = ALIAS() + "." + mcFldName
mcObject = "ThisForm.Grid.Column" + ALLTRIM(STR(i)) + ".ControlSource"
&mcObject = mcControlSource
* --- Set Column Header Properties ---
mcObjBase = "ThisForm.Grid.Column" + ALLTRIM(STR(i)) + ".Header1."
mcObject = mcObjBase + "FontBold"
&mcObject = .T.
mcObject = mcObjBase + "Alignment"
&mcObject = 2
mcObject = mcObjBase + "Caption"
&mcObject = mcFldName
ENDFOR
Now I want to put code (the same code) into the HEADER's Click Method.
Into each Header Click Method I want to put code to call the Form's SetOrder method:
ThisForm.SetOrder
How do I programatically get this code into each one?
Thanks,
JRB-Bldr
I am dynamically building the Grid in the Init Method of my Form. I am using the SELECT table and AFIELDS() to get its field count and field names.
I am using the field count and field names to dynamically set the Grid.Column.Count and then with a FOR ENDFOR loop I am setting up each Column.
SELECT MyTable
=AFIELDS(aryFlds)
mnFldCnt = ALEN(aryFlds,1)
ThisForm.Grid.ColumnCount = mnFldCnt
FOR i = 1 TO mnFldCnt
mcFldName = aryFlds(i,1)
* --- Set Column Control Source ---
mcControlSource = ALIAS() + "." + mcFldName
mcObject = "ThisForm.Grid.Column" + ALLTRIM(STR(i)) + ".ControlSource"
&mcObject = mcControlSource
* --- Set Column Header Properties ---
mcObjBase = "ThisForm.Grid.Column" + ALLTRIM(STR(i)) + ".Header1."
mcObject = mcObjBase + "FontBold"
&mcObject = .T.
mcObject = mcObjBase + "Alignment"
&mcObject = 2
mcObject = mcObjBase + "Caption"
&mcObject = mcFldName
ENDFOR
Now I want to put code (the same code) into the HEADER's Click Method.
Into each Header Click Method I want to put code to call the Form's SetOrder method:
ThisForm.SetOrder
How do I programatically get this code into each one?
Thanks,
JRB-Bldr