안녕하세요 델파이로 만드는중인데요 계속아웃오브에러가 나네요..
Tpanel에다가 메시지를 잘라다가 뿌려주는것인데..
혹시 수정가능하시면 수정 해주시면 감사합니다.
<!--CodeS-->
//ListGrid에 자료 출력
procedure TfmMio.ProcDisplayStatus(GetMsg,GetMsg2: String; I: integer);
var Q,W,QQ,cnt : integer;
oneblock : string;
begin ///////////////////////////1
begin ///////////////////////////4
if (copy(GetMsg,37,1) = '1')or (copy(GetMsg,37,1) = '0') or (copy(GetMsg,38,1) = 'M')then
for Q := 0 to fmMio.ComponentCount - 1 do
if fmMio.Components[Q] is TPanel then
if TPanel(fmMio.Components[Q]).tag = I then
OneBlock := (Copy(GetMsg, Q*38, 33));
begin //////////////////////////////////////2
TPanel(fmMio.Components[Q]).BevelInner := bvNone;
if(copy (GetMsg,37,1) = '1') or (copy(GetMsg2,33,1) = '1') then
begin
TPanel(fmMio.Components[Q]).font.color := clblue;
end
else
begin
TPanel(fmMio.Components[Q]).font.color := clred;
end;
if (copy(GetMsg,37,1) = '1') or (copy(GetMsg,37,1) = '0') then
TPanel(fmMio.Components[Q]).Caption := ' ' +'MIO' +
' ' + Copy(GetMsg,5,8) +
' ' +Copy(GetMsg,13,2) +
' '+Copy(GetMsg,15,16) +
'' + Copy(GetMsg,31,6) +
' ' + Copy(GetMsg,37,1);
TPanel(fmMio.Components[Q]).Hint := GetMsg;
TPanel(fmMio.Components[Q]).visible := true;
TPanel(fmMio.Components[Q+1]).Caption := ' ' + 'MIO' +
' ' + Copy(oneblock,1,8) +
' ' +Copy(oneblock,9,2) +
' '+Copy(oneblock,11,16) +
'' + Copy(oneblock,27,6) +
' ' + Copy(oneblock,33,1);
TPanel(fmMio.Components[Q+1]).Hint := oneblock;
TPanel(fmMio.Components[Q+1]).visible := true;
end; //////////////////////////2
end; ///////////////////////////////4
end; ///////////////////////////////1
<!--CodeE-->
제 생각으론 제일 마지막 루프 돌 때 이미 Q 가 마지막을 가리키고 있는데 [Q+1] 을 참조해서 리스트가
out of bounds 에러가 나는 것 같습니다.
확인해 보세요.