|
^^
class TForm1
{
public:
TShape *sh[3];
};
라고만 하시면 전역변수이지요
TForm::TForm(TComponent *Owner)
{
sh[0] = Shape1;
sh[1] = Shape2;
sh[2] = Shape3;
}
해주시면 데이터 값은 입력되구요 ( 위 함수는 생성자입니다. )
주의하실건 Shape1을 동적생성하시는 경우라면
생성을 먼저 하시고 그다음 대입문을 넣으셔야됩니다.
현재로써는 신경 안쓰셔도 될부분인거 같군요
곽성주 님이 쓰신 글 :
: 감사합니다.
:
: 그럼 저런 콘트롤배열을 전역변수화 하려면 어찌해야 하나요?
:
: TShape *Sh[3]={Shape1, Shape2, Shape3}; // 여기서 에러
:
: 수야!╋ 님이 쓰신 글 :
: : ㅡ.ㅡ;
: :
: : 해더에서는 데이터의 값을 초기화 할 수 없습니다.
: :
: : 더 정확히 말하면 클래스 내부에서 초기화 할 수 없는거지요.
: :
: : TForm1의 생성자에서 해주세요 ㅡ_ㅡ;;
: :
: : 이건 빌더만의 특성이 아니라 C++의 기본문법입니다.. ㅡ_ㅡ;;
: :
: : 곽성주 님이 쓰신 글 :
: : : 아래와 같이 하니, 에러나는군요~
: : :
: : : class TForm1 : public TForm
: : : {
: : : __published: // IDE-managed Components
: : : TButton *Button1;
: : : TImage *Image1;
: : : TShape *Shape1;
: : : TShape *Shape2;
: : : TShape *Shape3;
: : : TBitBtn *BitBtn1;
: : : void __fastcall Button1Click(TObject *Sender);
: : : void __fastcall BitBtn1Click(TObject *Sender);
: : : private: // User declarations
: : : public: // User declarations
: : : __fastcall TForm1(TComponent* Owner);
: : : void __fastcall Bmp2Raw(WideString Bmp_name, int BW, int BH, WideString Raw_name);
: : : TShape *Sh[3]={Shape1, Shape2, Shape3}; // 여기서 에러
: : :
: : : };
|