A B
A B

Reputation: 1521

TcxPopUpEdit with TcxTreeList

I am working on one project where in the main from I have to use a TcxPopUpEdit Control to show PopupList for each node in the TcxTreeList Control.

I am bit new in Delphi.

For Now I am able to show the Popup edit control in the TcxTreeList for each Item.

Now the problem is I want to get the selected popupedit control from the Treelist and also want to show Some text in the PopupEdit control for each PopupEdit control in the Treelist on Selection of the node.

Can anyone Help me to get the result as desired?

Any type of help can be appreciated.

Thank you in Advance.

Upvotes: 0

Views: 1041

Answers (1)

Ravaut123
Ravaut123

Reputation: 2808

Quick solution is to set code in the 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;

For Listbox as popupcontrol in a property 'PopupEdit' of a TcxTreelistColumn:

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;

Upvotes: 1

Related Questions