快速解决方案是在 PropertiesCloseUp 中设置代码。
type
TForm1 = class(TForm)
cxTreeList1: TcxTreeList;
cxTreeList1Column1: TcxTreeListColumn;
cxTreeList1Column2: TcxTreeListColumn;
cxPopupEdit1: TcxPopupEdit;
procedure cxPopupEdit1PropertiesCloseUp(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.cxPopupEdit1PropertiesCloseUp(Sender: TObject);
begin
if self.cxTreeList1.SelectionCount>0 then
begin
self.cxPopupEdit1.Text:= self.cxTreeList1.Selections[0].Values[cxTreeList1Column2.ItemIndex];
end;
end;
对于 TcxTreelistColumn 的属性“PopupEdit”中的列表框作为弹出控件:
procedure TForm1.cxTreeList1Column2PropertiesCloseUp(Sender: TObject);
begin
if self.cxListBox1.ItemIndex<>-1 then
begin
self.cxTreeList1.FocusedNode.Texts[self.cxTreeList1.FocusedColumn.ItemIndex]:= self.cxListBox1.Items.Strings[self.cxListBox1.ItemIndex];
end;
end;