Article View: borland.public.cppbuilder.nativeapi
Article #547Re: Create VCL Control from within an Object
From: JohnC
Date: Thu, 31 Jan 2008 15:14
Date: Thu, 31 Jan 2008 15:14
55 lines
2602 bytes
2602 bytes
OK, Here are the details of what I'm doing:
class TJMCColorTable
{
public:
TJMCColorTable(TWinControl * InParent);
...
and more stuff.
//---------------------------------------------------------------------------
TJMCColorTable::TJMCColorTable(TWinControl * InParent)
{
Parent = InParent;
NmbColorsShown = 6;
InitTable();
Table->Repaint();
}
//---------------------------------------------------------------------------
void TJMCColorTable::InitTable()
{
Table = new TStringGrid(Parent);
Table->Left = 0;
Table->Top = 0;
Table->Width = 443;
Table->Height = 181;
Table->ColCount = 6;
Table->RowCount = NmbColorsShown+1;
Table->DefaultColWidth = 64;
Table->DefaultRowHeight = 24;
Table->ScrollBars = ssBoth;
InitGridTitlesAndWidths();
InitGrid(6);
Table->Visible;
}
//---------------------------------------------------------------------------
void TJMCColorTable::InitGrid(int N)
{
NumberColors = N;
Table->RowCount = N + 1;
for(int i=1;i<=NumberColors;i++)
Table->Cells[0][i] = IntToStr(i);
}
//---------------------------------------------------------------------------
And here is the call from the main:
//---------------------------------------------------------------------------
void __fastcall TMainForm::FormCreate(TObject *Sender)
{
ColorTable = new TJMCColorTable(MainForm);
}
//---------------------------------------------------------------------------
It runs, but nothing shows up.
I'm probably doing something stupid.
In place of the "MainForm" as a parameter to the constructor, I've also
tried adding another control to the form and passing it's parent as the
parameter. That didn't work either.
John
Technical Details
Message-ID:
<47a1e5d8$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<47a1c92f$1@newsgroups.borland.com> <MPG.220bf5123600e831989a26@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,15058af8c1208ee6 X-Google-Attributes: gid10cc67,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: "JohnC" <jcibulskis@sbcglobal.net> Newsgroups: borland.public.cppbuilder.nativeapi References: <47a1c92f$1@newsgroups.borland.com> <MPG.220bf5123600e831989a26@newsgroups.borland.com> Subject: Re: Create VCL Control from within an Object Date: Thu, 31 Jan 2008 09:14:30 -0600 Lines: 59 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.3138 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198 X-RFC2646: Format=Flowed; Original NNTP-Posting-Host: 76.224.12.255 Message-ID: <47a1e5d8$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1201792472 76.224.12.255 (31 Jan 2008 07:14:32 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail