Link to home
Start Free TrialLog in
Avatar of ddudley3
ddudley3Flag for United States of America

asked on

Delphi 7 and TcxTreeView

Trying to get a node in a this Developer Express TreeView to be able to take more than 1 line so when I hit a key press like Shift Enter, it will add another line (like a CR LF)

Does anyone know how to do get this to work?  I've been looking for a while now using The Custom Control flags etc, but I can't find the right combination it seems.

Any help would be greatly appreciated !

Thanks
David
Avatar of aflarin
aflarin

like this?

procedure TForm1.cxTreeView1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
  if (ssShift in Shift) and (Key = VK_RETURN) and Assigned(cxTreeView1.Selected) then
      if cxTreeView1.Selected.getNextSibling <> nil then
        cxTreeView1.Items.Insert(cxTreeView1.Selected.getNextSibling, 'New node' )
      else
        cxTreeView1.Items.AddChild(cxTreeView1.Selected.Parent, 'New node' );

end;
Avatar of ddudley3

ASKER

No that simply adds a new node under the tree..   I want more than 1 line in the node..


Like it would have
 
->Top Node
->New Node
    More of the same node
    More of the same node.
->Next Node
   + Child of Next Node
TTreeView and TcxTreeView can't draw multiline nodes. You have to draw it by youself. Here is the sample:

https://www.experts-exchange.com/questions/10595181/Format-text-display-in-TTreeView.html#3160833
Avatar of Geert G
or use the QuantumTreeView
What set of components is the QuantumTreeView in?
ASKER CERTIFIED SOLUTION
Avatar of Geert G
Geert G
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Be nice if they gave an example on how to implement
actually you would add a column with a memo field
then set it to show the full text
the quantumtreeview should have a onMeasureItem event
in this event you would give the measurements of each record

this event doesn't exist in the TTreeview and TcxTreeview

there is also a preview column
this column is put below the first line and can be multiple lines long
there really isn't any code
just set the property PreviewColumn

there is also a banded treeview, here you can have multiple columns on multiple rows
(basically no limits :) )
do you have a quantumgrid ?

you could simulate the treeview for a limited number of levels with group and detail grids