Pb: Classe héritant de TForm
Voilà j'ai créé une classe TFormInfoSolo qui hérite de TForm.
Elle compile bien mais génere une erreur à l'execution:
:arrow: 'Le projet à provoqué un classe d'exception EResNotFound avec le message "Ressource TFormInfoSolo non trouvée".'
Cette exception est lancée par:
Code:
1 2 3
| try
if not InitInheritedComponent(Self, TForm) then
raise EResNotFound.CreateFmt(SResNotFound, [ClassName]); |
dans le fichier 'Forms'.
A quoi est-ce du :?:
Merci d'avance
Le code de ma classe sur http://www.rafb.net/paste/results/zaU4Oc52.html ou ci dessous:
Code:
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 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187
| //===========================================================================
//Fichier .h
//---------------------------------------------------------------------------
#ifndef FormInfoSoloH
#define FormInfoSoloH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <string.h>
#include <stdio.h>
#include <iostream>
//---------------------------------------------------------------------------
using namespace std;
class TFormInfoSolo : public TForm
{
__published: // Composants gérés par l'EDI
private: // Déclarations utilisateur
TLabel * lblTypeJeuSolo;
TComboBox * typeJeuSolo;
TLabel * lblNomJ1;
TEdit * edNomJ1;
TLabel * lblNomJ2;
TEdit * edNomJ2;
TLabel * lblNivMach;
TComboBox * cbNivMach;
TButton * btValideJeuSolo;
TButton * btAnnuleJeuSolo;
public: // Déclarations utilisateur
__fastcall TFormInfoSolo(TComponent* Owner);
// void __fastcall quitterClick(TObject *Sender);
// void __fastcall partieSoloClick(TObject *Sender);
void __fastcall typeJeuSoloChange(TObject *Sender);
};
//---------------------------------------------------------------------------
extern PACKAGE TFormInfoSolo * FormInfoSolo;
//---------------------------------------------------------------------------
#endif
//===========================================================================
//Fichier .cpp
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "FormInfoSolo.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
//#pragma resource "*.dfm"
TFormInfoSolo * FormInfoSolo;
//---------------------------------------------------------------------------
__fastcall TFormInfoSolo::TFormInfoSolo(TComponent* Owner)
: TForm(Owner)
{
// Owner->partieSolo->Enabled = false;
// fenetre
this->Left=65;
this->Top=80;
this->Height=250;
this->Width=200;
this->BorderStyle=bsSingle;
this->BorderIcons>>biMaximize;
this->Caption="Partie Solo en local";
// Type de jeu solo
this->lblTypeJeuSolo = new TLabel(this);
this->lblTypeJeuSolo->Parent = this;
this->lblTypeJeuSolo->Caption = "Type de jeu solo: ";
this->lblTypeJeuSolo->Visible = true;
this->lblTypeJeuSolo->Top = 12;
this->lblTypeJeuSolo->Left = 18;
AnsiString typeTxt;
this->typeJeuSolo = new TComboBox(this);
this->typeJeuSolo->Parent = this;
typeTxt = "Humain vs Machine";
this->typeJeuSolo->Items->Add(typeTxt);
typeTxt = "Humain vs Humain";
this->typeJeuSolo->Items->Add(typeTxt);
this->typeJeuSolo->OnChange = typeJeuSoloChange;
this->typeJeuSolo->Top = 30;
this->typeJeuSolo->Left = 40;
this->typeJeuSolo->Width = 120;
this->typeJeuSolo->Visible = true;
// Nom joueur 1
this->lblNomJ1 = new TLabel(this);
this->lblNomJ1->Parent = this;
this->lblNomJ1->Visible = false;
this->edNomJ1 = new TEdit(this);
this->edNomJ1->Parent = this;
this->edNomJ1->Visible = false;
// SELON type jeu 'Nom joueur 2' OU 'Niveau Machine'
this->lblNomJ2 = new TLabel(this);
this->lblNomJ2->Parent = this;
this->lblNomJ2->Visible = false;
this->edNomJ2 = new TEdit(this);
this->edNomJ2->Parent = this;
this->edNomJ2->Visible = false;
this->lblNivMach = new TLabel(this);
this->lblNivMach->Parent = this;
this->lblNivMach->Visible = false;
this->cbNivMach = new TComboBox(this);
this->cbNivMach->Parent = this;
this->cbNivMach->Visible = false;
// Boutton de controle (annuler/valider)
this->btValideJeuSolo = new TButton(this);
this->btValideJeuSolo->Parent = this;
this->btAnnuleJeuSolo = new TButton(this);
this->btAnnuleJeuSolo->Parent = this;
this->Show();
}
//---------------------------------------------------------------------------
void __fastcall TFormInfoSolo::typeJeuSoloChange(TObject *Sender)
{
// Nom joueur 1
if (this->lblNomJ1->Visible == false)
{
this->lblNomJ1->Caption = "Nom du joueur 1: ";
this->lblNomJ1->Visible = true;
this->lblNomJ1->Top = 72;
this->lblNomJ1->Left = 18;
this->edNomJ1 = new TEdit(this);
this->edNomJ1->Parent = this;
this->edNomJ1->Text = "Porto";
this->edNomJ1->Visible = true;
this->edNomJ1->Top = 90;
this->edNomJ1->Left = 40;
}
if (this->lblNomJ2->Visible == false)
{
// SELON type jeu 'Nom joueur 2' OU 'Niveau Machine'
if (this->typeJeuSolo->ItemIndex != 0)
{
this->lblNivMach->Visible = false;
this->cbNivMach->Visible = false;
this->lblNomJ2->Top = 114;
this->lblNomJ2->Left = 18;
this->lblNomJ2->Caption = "Nom du joueur 2: ";
this->lblNomJ2->Visible = true;
this->edNomJ2->Text = "Rico";
this->edNomJ2->Top = 132;
this->edNomJ2->Left = 40;
this->edNomJ2->Visible = true;
}
}
if (this->lblNivMach->Visible == false)
{
if (this->typeJeuSolo->ItemIndex == 0)
{
this->lblNomJ2->Visible = false;
this->edNomJ2->Visible = false;
this->lblNivMach->Caption = "Niveau de la machine";
this->lblNivMach->Top = 114;
this->lblNivMach->Left = 18;
this->lblNivMach->Visible = true;
for (unsigned cpt = 1 ; cpt < 5 ; cpt++)
{
cbNivMach->Items->Add(cpt);
}
this->cbNivMach->Text = "1";
this->cbNivMach->Width = 50;
this->cbNivMach->Top = 132;
this->cbNivMach->Left = 40;
this->cbNivMach->Visible = true;
}
}
this->Show();
}
//--------------------------------------------------------------------------- |