Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Add\Read method code Progrmatically.
Message
From
04/10/1997 13:29:21
Chong Hanwah
Apic Systems Pteltd
Singapore, Singapore
 
 
To
03/10/1997 15:38:35
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00052542
Message ID:
00053260
Views:
26
>>You can also create your own grid class that has the header code in place.
>>I created a grid with 25 columns (highly unlikely I'll ever exceed that)
>>and the header click method has what is needed to sort the column already
>>in place when I drop it on a form.
>>
>>Steve
>
>Just like I thought: you have to dimension it to some number in the
>class definition, because you can't have any default header class. If
>you could, you could define a grid class with just one column and at
>runtime just say thisform.grid1.columncount=7 and have all the headers
>behave as you defined in the class def.
>
>OK, it's just my old song...

Hi!

Pls refer to Microsoft knowledge base Qn Q140306;
That will solve your problem.
However, u need to add in something to make it perfect!
In fact I had done it!

In case u miss it, I just quote from there:

DEFINE CLASS myGrid AS GRID

ColumnCount = 0

PROCEDURE Init
This.Parent.myGrid.SetGrid()
ThisForm.Refresh
ENDPROC

PROCEDURE SetGrid
ThisForm.Lockscreen = .T.
lcFileName = GETFILE("DBF","Select the Table:")
USE (lcFileName)
lcAlias = ALIAS()
This.RecordSource = ""
This.RecordSource = lcAlias
SELECT (lcAlias )
FOR i = 1 TO FCOUNT()
IF This.ColumnCount < i
This.AddObject("column" + ALLTRIM(STR(i)),"MyColumn")
ENDIF
This.Columns(i).Visible = .t.
This.Columns(i).ControlSource = FIELD(i)
This.Columns(i).Header1.Caption = FIELD(i)
ENDFOR
FOR i = FCOUNT() + 1 TO This.ColumnCount
This.RemoveObject("Column"+ALLTRIM(STR(i)))
ENDFOR
ThisForm.Caption = lcAlias
ThisForm.Lockscreen = .F.
ENDPROC

ENDDEFINE

DEFINE CLASS myColumn as Column

ADD OBJECT Header1 as myHeader WITH Visible = .T.

ENDDEFINE

DEFINE CLASS myHeader AS HEADER

PROCEDURE Click
FOR nCount = 1 TO 254
IF !EMPTY(TAG(nCount))
IF This.Caption = TAG(nCount)
SET ORDER TO This.Caption
EXIT
ENDIF
ELSE
EXIT
ENDIF
ENDFOR
This.Parent.Parent.ReFresh
This.Parent.Parent.SetFocus
ENDPROC

ENDDEFINE
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform