Ik wilde een afgeleide maken van TStringGrid die een rooster op het scherm zet. Ik dacht dat doe ik hetzelfde als met andere dingen, maar op de een of andere manier kan hij de defaultconstructor niet vinden.
Dit is mijn code:
Ik wil eigenlijk ook dat er geen defaultdrawing wordt gedaan. Ik weet dat je dan die var. op false moet zetten(duhh), maar dan moet je een of andere vage functie weer meegeven aan onDrawCell, en daar gaat het ook mis. Ik heb al wel een functie gemaakt, voor als ik hem @ designtime er neer zet, maar ik wel juist een object krijgen dat ik @ runtime op het scherm kan zetten.
P.S. Ik include superveel en waarschijnlijk te veel, maar dat boeit me niet zo.
Dit is mijn code:
C++:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
| //--------------------------------------------------------------------------- #ifndef roosterStringGridH #define roosterStringGridH //--------------------------------------------------------------------------- #endif #include <Classes.hpp> #include <Controls.hpp> #include <StdCtrls.hpp> #include <Forms.hpp> #include <Menus.hpp> #include <ExtCtrls.hpp> #include <DBGrids.hpp> #include <Grids.hpp> #include <ComCtrls.hpp> #include <ActnCtrls.hpp> #include <ActnMan.hpp> #include <ActnMenus.hpp> #include <ToolWin.hpp> #include <ActnList.hpp> #include <Grids.hpp> class RoosterStringGrid : public TStringGrid { TStringGrid *Rooster; public: RoosterStringGrid(TWinControl *Sender); RoosterStringGrid(); }; RoosterStringGrid::RoosterStringGrid(TWinControl *Sender){ Rooster = new TStringGrid(Sender); Rooster->Parent=Sender; Rooster->ColCount=4; Rooster->RowCount=10; Rooster->Color=clWhite; Rooster->Left = 48; Rooster->Top = 96; Rooster->Color = clWhite; Rooster->DefaultRowHeight = 20; Rooster->DefaultColWidth=50; Rooster->Height = (Rooster->RowCount)*(Rooster->DefaultRowHeight+Rooster->GridLineWidth)+4; Rooster->ScrollBars=ssNone; Rooster->FixedColor = 16768477; Rooster->Font->Charset = DEFAULT_CHARSET; Rooster->Font->Color = clBlack; Rooster->Font->Height = -11; Rooster->Font->Name = "MS Sans Serif"; Rooster->Width=Rooster->ColCount*Rooster->DefaultColWidth+7; Rooster->ParentBiDiMode = False; Rooster->ParentFont = False; Rooster->TabOrder = 5; Rooster->Visible=true; for(int i=1;i<Rooster->RowCount;i++){ Rooster->Cells[0][i]="dag" + IntToStr(i); } Rooster->Cells[1][0]="Docent"; Rooster->Cells[2][0]="Lokaal"; Rooster->Cells[3][0]="Vak"; } |
Ik wil eigenlijk ook dat er geen defaultdrawing wordt gedaan. Ik weet dat je dan die var. op false moet zetten(duhh), maar dan moet je een of andere vage functie weer meegeven aan onDrawCell, en daar gaat het ook mis. Ik heb al wel een functie gemaakt, voor als ik hem @ designtime er neer zet, maar ik wel juist een object krijgen dat ik @ runtime op het scherm kan zetten.
P.S. Ik include superveel en waarschijnlijk te veel, maar dat boeit me niet zo.