스트링그리드에 콤보박스를 넣었습니다.
콤보박스의 OnChange이벤트에 ComboBoxChange라는 프로시져를 넣었습니다.
그런데 스트링그리드에 콤보박스의 값이 않들어가네요.
문제점을 지적해주세요.
1 procedure TfDoc_Service.StringGrid3SelectCell(Sender: TObject; ACol,
2 ARow: Integer; var CanSelect: Boolean);
3 begin
4 TComboBox(StringGrid3.Objects[ACols, ARows]).Free;
5 If ((ACols = -1) And (ARows = -1)) Then
6 Begin
7 BCols := ACol;
8 BRows := ARow;
9 End Else
10 Begin
11 BCols := ACols; BRows := ARows;
12 End;
13 ACols := ACol; ARows := ARow;
14 StringGrid3.Objects[ACols, ARows] := TComboBox.Create(StringGrid3);
15 with TComboBox(StringGrid3.Objects[ACols, ARows]) do
16 begin
17 OnChange := ComboBoxChange;
18 Parent := StringGrid3;
19 BoundsRect := StringGrid3.CellRect(ACols, ARows);
20 Width := StringGrid3.ColWidths[ACols];
21 Height := StringGrid3.RowHeights[ARows];
22 Items.Add('Local1');
23 Items.Add('Local2');
24 Items.Add('Local3');
25 end;
26 end;
1 procedure TfDoc_Service.ComboBoxChange(Sender: TObject);
2 begin
3 TComboBox(Sender).Text := TComboBox(Sender).SelText;
4 StringGrid3.Cells[ACols,ARows] := TComboBox(Sender).Text;
5 end;