Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Giving code to a grid column at runtime.
Message
From
05/08/1999 11:35:34
 
 
To
05/08/1999 07:18:49
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00250099
Message ID:
00250202
Views:
16
Tim,

I have had to over come a similar problem and have created what I call 'dynamic column technology'. This technology adds columns to a grid depending on field types at run-time. This means that each column can have a set of functions (such as right-click menu options, header click functionalty, etc.) which are specifically designed for that field type and are instantiated at run-time.

To do this I created a number of column classes (in code) which are added at run time.

In my form I have some code that scans through the fields to be added to the grid and sets library to a specific column class based on the field's type.

The column classes look someting like:

DEFINE CLASS chgSpecialTemplate1 AS COLUMN


Name = "chgSpecialcolumn"
FontSize = 8
FontBold = .F.
ForeColor = RGB(0,0,0)
Width = 120
lDivisor = 7
lColNumber = 0
Sparse = .T.
lFiltered = .F.
cFilterExpression = ""
cAorDIndex = ""
lType = "CHAR"
lcTable = ""
DIMENSION aLatest[1]
lComboFilter = .F.
lNoEdit = .F.

ADD OBJECT header1 AS HEADER WITH ;
FONTBOLD = .F., ;
FONTSIZE = 8, ;
ALIGNMENT = 2, ;
FORECOLOR = RGB(0,0,0), ;
CAPTION = "" , ;
NAME = "Header1", ;
OriginalHeader = ""


ADD OBJECT text1 AS cbOricTextBox WITH ;
NAME = "Text1",;
BORDERSTYLE = 0 , ;
lLatest = .F.




PROCEDURE INIT

.
.

ENDPROC
ENDDEFINE

I hope this helps,

James.
Previous
Reply
Map
View

Click here to load this message in the networking platform