kkirtac
02/05/2006, 15:09
selam arkadaşlar, bir mdiparent form bir de mdichild form um var, ancak child dan parent ın public üyelerine erişemiyorum, daha doğrusu child da parent için bir işaretçi oluşturuyorum ve bu satırda hata veriyor, koddan bir bölüm sunayım belki daha açlıklayıcı olur:
//Parent form's header file -> Form1.h
#include "costForm.h" //this is the child form's header
namespace Segmentation
{
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System:: Data;
using namespace System:: Drawing;
using namespace System::IO;
public __gc class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
}
public: static Bitmap* source;
public: static double* img;
public: static Node* nodes;
public: costForm *cform; //declaring the pointer for child
//...
//...
//...
//...
//...
private: System::Void dynamicCostMenuItem_Click(System::Object * sender, System::EventArgs * e)
{
costselected = true;
cform = new costForm(this); //creating an object of thechild
cform->MdiParent = this;
this->ClientSize = System:: Drawing::Size(source->Width+ cform->Width, source->Height);
(cform->Location).X = (this->pictureBox1->Location).X + cform->Width ;
(cform->Location).Y = (this->Location).Y ;
cform->Show();
}
parent form da child ın bir işaretçisini tanımlayıp child ın public üyelerine erişmede sorun yok
bu da child ın header dosyası
#include "Form1.h" // burada parent ın header ı dahil edildi
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System:: Data;
using namespace System:: Drawing;
namespace Segmentation
{
public __gc class costForm : public System::Windows::Forms::Form
{
public:
costForm( Form* f)
{
InitializeComponent();
parent = f; //equalize the 'parent' member of the child form
//to the reference taken before
}
private: Form1 *parent; // declaring the pointer of the parent
//errors : error C2143: syntax error : missing ';' before '*'
//'Segmentation::costForm::Form1' : missing storage-class or type specifiers
these errors are in the line of "private: Form1 *parent;"
hata neden kaynaklanıyor? bu işlem aslında VB ve C# ta bu şekilde sorunsuz yapılıyor ama c++ ta problem çıkıyor..
//Parent form's header file -> Form1.h
#include "costForm.h" //this is the child form's header
namespace Segmentation
{
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System:: Data;
using namespace System:: Drawing;
using namespace System::IO;
public __gc class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
}
public: static Bitmap* source;
public: static double* img;
public: static Node* nodes;
public: costForm *cform; //declaring the pointer for child
//...
//...
//...
//...
//...
private: System::Void dynamicCostMenuItem_Click(System::Object * sender, System::EventArgs * e)
{
costselected = true;
cform = new costForm(this); //creating an object of thechild
cform->MdiParent = this;
this->ClientSize = System:: Drawing::Size(source->Width+ cform->Width, source->Height);
(cform->Location).X = (this->pictureBox1->Location).X + cform->Width ;
(cform->Location).Y = (this->Location).Y ;
cform->Show();
}
parent form da child ın bir işaretçisini tanımlayıp child ın public üyelerine erişmede sorun yok
bu da child ın header dosyası
#include "Form1.h" // burada parent ın header ı dahil edildi
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System:: Data;
using namespace System:: Drawing;
namespace Segmentation
{
public __gc class costForm : public System::Windows::Forms::Form
{
public:
costForm( Form* f)
{
InitializeComponent();
parent = f; //equalize the 'parent' member of the child form
//to the reference taken before
}
private: Form1 *parent; // declaring the pointer of the parent
//errors : error C2143: syntax error : missing ';' before '*'
//'Segmentation::costForm::Form1' : missing storage-class or type specifiers
these errors are in the line of "private: Form1 *parent;"
hata neden kaynaklanıyor? bu işlem aslında VB ve C# ta bu şekilde sorunsuz yapılıyor ama c++ ta problem çıkıyor..