|
마우스로 항목(Model)을 선택을 하면 .csv파일에 있는 선택한 Model의 세부내용만 StringGrid에 나오게끔 하고 싶은데,
현재 csv파일에 있는 항목은 읽어와서 StringGrid에 뿌려주긴합니다.
단, 어떤 Model을 선택하여도 전체 파일만 선택이되는게 문제입니다.
void __fastcall TForm1::FormActivate(TObject *Sender)
{
int i;
ReadOptiondata();
comboxModelSel->Items->Clear();
for(i=0; i<TotalOptionCount; i++) //반복write저장
{
comboxModelSel->Items->Add(OptionData[i+1][1]);
}
}
void __fastcall TForm1::ComboBoxSelect(TObject *Sender)
{
if( InputSelectFlag1 == 0) //마우스 입력
{
ComboboxSelflag = 1;
SelectModel();
}
else
ShowMessage(" 파일이 없습니다");
}
.
.
.
.
.
void __fastcall TForm1::SelectModel(void)
{
FILE *logfile;
int i, textpoint, k, conbuf, j, err;
char textbuf[200];
// SPEC DATA READ
if( ( logfile = fopen( "D:\\test1\\Option.csv", "rt")) != NULL)
{
i=0;
while(!feof(logfile))
{
fgets( pszBuffer1, 10000, logfile);
for( k=0,textpoint=0; pszBuffer1[ textpoint]!='\n'; )
{
for(j=0; pszBuffer1[textpoint]!=',' && pszBuffer1[textpoint]!='\n' ; j++)
{
textbuf[ j] = pszBuffer1[textpoint++];
}
textbuf[ j] = '\0';
strcpy( ConditionData[ i][k], textbuf);
if( strlen( ConditionData[ i][k] ) == 0 && k == 0)
{
i--;
break;
}
strcpy( TestSpec[ i][k++], textbuf);
if( pszBuffer1[ textpoint]=='\n')
break;
textpoint++;
conbuf = k+1;
}
i++;
}
FullTestStepCount = i;
TotalColCount = k;
fclose(logfile);
}
else
{
err = 1;
ShowMessage( AnsiString( strr )+" 화일이 없습니다");
}
if( FullTestActive == 1)
GridDisplay( FullTestStepCount+1 );
else
GridDisplay( step+10);
}
//----------------------------------------------------------------------------
void __fastcall TForm1::GridDisplay(int RowCount)
{
int i,j;
// GRID DISPLAY
for( i=0; i<RowCount; i++)
{
for( j=0; j<TotalColCount; j++)
StringGrid1->Cells[ j][ i] = TestSpec[i][j];
}
}
|