|
GetCheckBoxState를 보면 bool __fastcall GetCheckBoxState(int ACol, int ARow, bool & state) 요렇게 정의되어 있습니다. state가 포인터입니다. 보통 결과값이 단순히 리턴값외에 여러개일때 이 방법을 씁니다.
GetCheckBoxState를 호출하면 state에 체크박스 상태를 저장시키고 리턴값으로 체크박스 유무를 리턴합니다.
bool State;
grid->GetCheckBoxState(1, i, &State);
이렇게 State의 주소를 넘겨주면 GetCheckBoxState함수는 State에 체크박스 상태를 저장해 줍니다. 그리고 리턴값으로 체크박스 유무를 알려줍니다.
소스는 이렇게 바뀌어야 겠죠.
AnsiString __fastcall TActionArrayForm::GetAddString()
{
AnsiString result;
bool IsChecked;
for(int i=1; i<grid1->RowCount; i++)
{
grid1->GetCheckBoxState(1, i, &IsChecked);
if (IsChecked)
{
result.cat_printf("%s;", grid1->Cells[2][i].c_str());
}
}
ShowMessage(result);
return result;
}
박진수 님이 쓰신 글 :
: AnsiString __fastcall TActionArrayForm::GetAddString()
: {
: AnsiString result;
: for(int i=1; i<grid1->RowCount; i++)
: {
: if(grid1->GetCheckBoxState(1, i, true)==true)
: {
: result.cat_printf("%s;", grid1->Cells[2][i].c_str());
: }
: }
: ShowMessage(result);
: return result;
: }
:
:
: 이게 소스구요...
:
: grid1->GetCheckBoxState(1, i, true) 이게 무조건 true값이 나오네요.
:
: 체크박스가 해제 되어 있는데도 불구하고...
:
: grid1->GetCheckBoxState(1, i, false) 이렇게 해도 true값이 나옵니다.
:
: 이거 왜 이러는지 아시는 분 있나요?
:
: 혹은 체크박스의 체크 여부를 알 수 있는 방법이라도 있나요?
:
: 자꾸 질문 해서 죄송합니다...
|