0

I am new learner and I copy the exact code from book and run the following code . this code for MDI sample program
my PC is XP system

//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "ViewMain.h"
#include "MDIChild.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TMainForm *MainForm;
//---------------------------------------------------------------------------
__fastcall TMainForm::TMainForm(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TMainForm::Open1Click(TObject *Sender)
{
 if (OpenDialog->Execute())
{
TChild* child = new TChild(this);
child->SetParent(this);//   <----LINE WITH ERROR HIGH LIGHTED
child->Image->Picture->LoadFromFile(OpenDialog->FileName);
child->ClientWidth = child->Image->Picture->Width;
child->ClientHeight = child->Image->Picture->Height;
child->Caption = OpenDialog->FileName;
child->Show();
}
}
//---------------------------------------------------------------------------
void __fastcall TMainForm::Save1Click(TObject *Sender)
{
 TChild* child = dynamic_cast<TChild*>(ActiveMDIChild);
if (!child) return;
if (SaveDialog->Execute())
{
child->Image->Picture->SaveToFile(SaveDialog->FileName);
}
}
//---------------------------------------------------------------------------
void __fastcall TMainForm::Tile1Click(TObject *Sender)
{
  Tile();
}
//---------------------------------------------------------------------------
void __fastcall TMainForm::Cascade1Click(TObject *Sender)
{
 Cascade();
}
//---------------------------------------------------------------------------
void __fastcall TMainForm::ArrangeAll1Click(TObject *Sender)
{
  ArrangeIcons();
}
//---------------------------------------------------------------------------

error of compiling is :-

[C++ Error] ViewMain.cpp(23): E2247 '_fastcall TCustomForm::SetParent(TWinControl *)' is not accessible

the line with error is :-
child->SetParent(this);// <----LINE WITH ERROR HIGH LIGHTED

Can any expertist point out what's wrong . Is it because I use XP
( and not win98 or 2000)?

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by __avd
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.