배열 초기화 처럼 하는 방법은 없으나
원하시는 방법이
일일이 16번 코딩 안하고
한번에 간단하게 매칭시키실려는거 같군요.
반복문을 써서 코딩하시면 조금 편하실 겁니다.
FindComponent함수를 이용해서 디자인된 콤포넌트 이름을 찾는 방법을 써보세요.
TSpeedButton *MOutputBtn[16];
// ---------------------------------------------------------------------------
__fastcall TManualFrame::TManualFrame(TComponent* Owner) : TFrame(Owner) {
for(int i=0; i<16; i++) {
MOutputBtn[i] = (TSpeedButton*)FindComponent(UnicodeString().sprintf(L"SpeedButton%d", i+1));
}
}
hss9205 님이 쓰신 글 :
: TSpeedButton *MOutputBtn[16];
: // ---------------------------------------------------------------------------
: __fastcall TManualFrame::TManualFrame(TComponent* Owner) : TFrame(Owner) {
: MOutputBtn[0] = SpeedButton1;
: MOutputBtn[1] = SpeedButton2;
: MOutputBtn[2] = SpeedButton3;
: MOutputBtn[3] = SpeedButton4;
: }
:
: 대충 이렇게 초기화를 했는대 이 방법 말고 배열을 한번 선언한 뒤에
: MOutputBtn[] = {speedButton9, SpeedButton10,
: SpeedButton11, SpeedButton12, SpeedButton13, SpeedButton14,
: SpeedButton15, SpeedButton16}
: 과 비슷한 방법으로 하고 싶은대 이개 안되내요
:
: 그래서 유사한 방법을 알고 싶습니다.
:
: 그리고 TSpeedButton은 벡터로 선언이 안되는 모양인것 같은대 맞나요?
|