흔한 소스 그대로 코딩을 했는데 해당셀에 언저도 콤보박스가 안 나타납니다.
왜 그런지 모르겠지만 1), 2)둘다 안됩니다.
gdFocused in State만 해도 되나요? 무슨 말이냐믄, 따로 Grid위에 해당 셀에 MouseClick Event나 KeyDown Event를 안 설정해줘도 되는지...
아니면 다른 뭔가가 필요한지..
고수님들의 조언이 꼭 좀 필요합니다.
procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin if(gdFocused in State) then
begin
//1) if DBGrid1.SelectedField.fieldName = 'BOOKITEM' then
//2) if (Column.FieldName = DBComboBox1.DataField ) then
begin
Label1.visible := true;
DBComboBox1.Left := Rect.Left + DBGrid1.Left
DBComboBox1.Top := Rect.Top + DBGrid1.Top;
DBComboBox1.Width := Rect.Right - Rect.Left;
DBComboBox1.visible := true;
DBComboBox1.SetFocus;
end
else
Label1.visible := false;
DBComboBox1.visible := false;
end;
end;
제가 원하는 것은 하나의 셀에 입력한 값에 따라 lookup되는 값을 다르게 보여주는 것입니다.
예를 들면 ITEMTYPE셀에 Fabric을 선택하면 ITEMNAME셀에 Fabric종류만 보여주는 것입니다.
그러기 위해서는 아래 소스를 해결해야 하는데... 이런 소스 여러군데서 봤거든요..
아시는 고수분들이 많으리라 생각됩니다. 여기에서 일주일 이상 걸리고 있습니다.
꼭 도와주시기 바랍니다.
happykevin wrote:
> 흔한 소스 그대로 코딩을 했는데 해당셀에 언저도 콤보박스가 안 나타납니다.
> 왜 그런지 모르겠지만 1), 2)둘다 안됩니다.
> gdFocused in State만 해도 되나요? 무슨 말이냐믄, 따로 Grid위에 해당 셀에 MouseClick Event나 KeyDown Event를 안 설정해줘도 되는지...
> 아니면 다른 뭔가가 필요한지..
> 고수님들의 조언이 꼭 좀 필요합니다.
>
>
> procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState);
> begin if(gdFocused in State) then
> begin
> //1) if DBGrid1.SelectedField.fieldName = 'BOOKITEM' then
> //2) if (Column.FieldName = DBComboBox1.DataField ) then
> begin
> Label1.visible := true;
> DBComboBox1.Left := Rect.Left + DBGrid1.Left
> DBComboBox1.Top := Rect.Top + DBGrid1.Top;
> DBComboBox1.Width := Rect.Right - Rect.Left;
> DBComboBox1.visible := true;
> DBComboBox1.SetFocus;
> end
> else
> Label1.visible := false;
> DBComboBox1.visible := false;
> end;
> end;
>