[archived content]

About

A TreeView ? is a control used to represent a branching tree that may or may not be folded but has distinct levels.

Usage

TreeViews ? are all about nodes. Since each node of a TreeView ? may be a Tree all the TreeNodes ? can have children added to them using the nodes property to get a TreeNodeCollection ?.

Example

import dfl.all;
void main() {
 auto form = new Form;
 auto label = new Label;
 auto tree = new TreeView;
 tree.dock = DockStyle.LEFT;
 tree.afterSelect ~= delegate void (TreeView t, TreeViewEventArgs e) {
 label. text = "Text: " ~ e.node.text ~
 "\nPath: " ~ e.node.fullPath;
 };
 tree.text = "I am the TreeView";
 auto currentNode = new TreeNode;
 currentNode.text = "First Root";
 tree.nodes.add(currentNode);
 currentNode = new TreeNode;
 currentNode.text = "First Child";
 tree.nodes[0].nodes.add(currentNode);
 currentNode = new TreeNode;
 currentNode.text = "Second Root";
 tree.nodes.add(currentNode);
 currentNode = new TreeNode;
 form.controls.add(tree);
 label.dock = DockStyle.FILL;
 label.text = "Select a node.";
 form.controls.add(label);
 Application.run(form);
}

module dfl.treeview;
public class NodeLabelEditEventArgs : EventArgs
{
public final bool cancelEdit ; [property getter]
public final bool cancelEdit ; [property setter]
public final char[] label ; [property getter]
public final TreeNode node ; [property getter]
[+] Inherited members
empty
}
public class TreeNode
{
public final void beginEdit ();
public final Rect bounds ; [property getter]
public final void collapse ();
public final void ensureVisible ();
public final void expand ();
public final void expandAll ();
public final TreeNode firstNode ; [property getter]
public static TreeNode fromHandle (TreeView tree,HTREEITEM handle);
public final char[] fullPath ; [property getter]
public final HTREEITEM handle ; [property getter]
public final int index ; [property getter]
public final bool isExpanded ; [property getter]
public final bool isSelected ; [property getter]
public final TreeNode lastNode ; [property getter]
public final TreeNode nextNode ; [property getter]
public final TreeNodeCollection nodes ; [property getter]
public int opCmp (TreeNode node);
public int opCmp (char[] val);
public int opCmp (Object o);
public int opEquals (TreeNode node);
public int opEquals (char[] val);
public int opEquals (Object o);
public final TreeNode parent ; [property getter]
public final TreeNode prevNode ; [property getter]
public final void remove ();
public final Object tag ; [property getter]
public final Object tag ; [property setter]
public final char[] text ; [property setter]
public final char[] text ; [property getter]
public final void toggle ();
public char[] toString ();
public final TreeView treeView ; [property getter]
}
public class TreeNodeCollection
{
public void add (TreeNode node);
public void add (char[] text);
public void add (Object val);
public void add (char[] s);
public void addRange (Object[] range);
public void addRange (char[][] range);
public void addRange (TreeNode[] range);
public bool contains (char[] s);
public int indexOf (char[] s);
public void insert (int index,char[] s);
public void remove (char[] s);
}
public class TreeView : Control
{
public Event afterCollapse (TreeView,TreeViewEventArgs);
public Event afterExpand (TreeView,TreeViewEventArgs);
public Event afterLabelEdit (TreeView,NodeLabelEditEventArgs);
public Event afterSelect (TreeView,TreeViewEventArgs);
public Color backColor ; [property getter]
public Color backColor ; [property setter]
public Event beforeCollapse (TreeView,TreeViewCancelEventArgs);
public Event beforeExpand (TreeView,TreeViewCancelEventArgs);
public Event beforeLabelEdit (TreeView,NodeLabelEditEventArgs);
public Event beforeSelect (TreeView,TreeViewCancelEventArgs);
public final void beginUpdate ();
public final BorderStyle borderStyle ; [property getter]
public final BorderStyle borderStyle ; [property setter]
public final void collapseAll ();
protected void createParams (ref CreateParams cp);
public static Color defaultBackColor ; [property getter]
public static Color defaultForeColor ; [property getter]
protected Size defaultSize ; [property getter]
public final void endUpdate ();
public final void expandAll ();
public Color foreColor ; [property getter]
public final bool fullRowSelect ; [property getter]
public final bool fullRowSelect ; [property setter]
public final TreeNode getNodeAt (Point pt);
public final TreeNode getNodeAt (int x,int y);
public final bool hideSelection ; [property setter]
public final bool hideSelection ; [property getter]
public final bool hoverSelection ; [property getter]
public final bool hoverSelection ; [property setter]
public final int indent ; [property getter]
public final int indent ; [property setter]
public final int itemHeight ; [property setter]
public final int itemHeight ; [property getter]
public final bool labelEdit ; [property setter]
public final bool labelEdit ; [property getter]
public final TreeNodeCollection nodes ; [property getter]
protected void onAfterCollapse (TreeViewEventArgs ea);
protected void onAfterExpand (TreeViewEventArgs ea);
protected void onAfterLabelEdit (NodeLabelEditEventArgs ea);
protected void onAfterSelect (TreeViewEventArgs ea);
protected void onBeforeCollapse (TreeViewCancelEventArgs ea);
protected void onBeforeExpand (TreeViewCancelEventArgs ea);
protected void onBeforeLabelEdit (NodeLabelEditEventArgs ea);
protected void onBeforeSelect (TreeViewCancelEventArgs ea);
protected void onHandleCreated (EventArgs ea);
protected void onHandleDestroyed (EventArgs ea);
public final dchar pathSeparator ; [property getter]
public final dchar pathSeparator ; [property setter]
protected void prevWndProc (ref Message msg);
public final bool scrollable ; [property getter]
public final bool scrollable ; [property setter]
public final TreeNode selectedNode ; [property getter]
public final TreeNode selectedNode ; [property setter]
public final bool showLines ; [property setter]
public final bool showLines ; [property getter]
public final bool showPlusMinus ; [property getter]
public final bool showPlusMinus ; [property setter]
public final bool showRootLines ; [property setter]
public final bool showRootLines ; [property getter]
public final bool singleExpand ; [property setter]
public final bool singleExpand ; [property getter]
public final bool sorted ; [property setter]
public final bool sorted ; [property getter]
public final TreeNode topNode ; [property getter]
public final int visibleCount ; [property getter]
protected void wndProc (ref Message m);
[+] Inherited members
backColor backColorChanged bottom bounds bringToFront bringUpOne canFocus canSelect capture click clientRectangle clientSize contains containsFocus contextMenu contextMenuChanged controlAdded ControlCollection controlRemoved controls createControl createControlsInstance created createGraphics createHandle createParams cursor cursorChanged defaultBackColor defaultFont defaultForeColor defaultSize defWndProc delayInvoke destroyHandle disable disableVisualStyle displayRectangle dispose disposed dock doubleClick enable enabled enabledChanged findForm focus focused font fontChanged foreColor foreColorChanged fromChildHandle fromHandle getAutoScaleSize getChildAtPoint getStyle getTopLevel gotFocus handle handleCreated handleDestroyed hasChildren hasLayout hasLayoutChanged height helpRequested hide initLayout invalidate invoke invokeRequired isHandleCreated isMnemonic keyDown keyPress keyUp layout left location lostFocus modifierKeys mouseButtons mouseDown mouseEnter mouseHover mouseLeave mouseMove mousePosition mouseUp mouseWheel move name onBackColorChanged onClick onContextMenuChanged onControlAdded onControlRemoved onCursorChanged onDisposed onDoubleClick onEnabledChanged onFontChanged onForeColorChanged onGotFocus onHandleCreated onHandleDestroyed onHasLayoutChanged onHelpRequested onKeyDown onKeyPress onKeyUp onLayout onLostFocus onMouseDown onMouseEnter onMouseHover onMouseLeave onMouseMove onMouseUp onMouseWheel onMove onPaint onPaintBackground onParentChanged onReflectedMessage onResize onRightToLeftChanged onSystemColorsChanged onTextChanged onVisibleChanged opCmp opEquals paint parent parentChanged performLayout pointToClient pointToScreen preProcessMessage processKeyEventArgs processMnemonic recreateHandle recreatingHandle rectangleToClient rectangleToScreen redraw refresh region resetBackColor resetCursor resetFont resetForeColor resetRightToLeft resetText resize resizeRedraw resumeLayout right rightToLeft rightToLeftChanged select selectNextControl sendBackOne sendToBack setBounds setBoundsCore setClientSizeCore setStyle setVisibleCore show size supportsMouseTracking suspendLayout systemColorsChanged tabStop tag text textChanged top topLevelControl toString update updateStyles visible visibleChanged width wndProc zIndex
}
public static class TreeView.ControlCollection
{
public void add (Control ctrl);
public bool contains (Control ctrl);
public int indexOf (Control ctrl);
public int length ; [property getter]
public int opApply (int delegate(ref Control) dg);
public int opIndex ; [property getter]
protected final Control owner ; [property getter]
public void remove (Control ctrl);
public void removeAt (int i);
}
public enum TreeViewAction ;
public class TreeViewCancelEventArgs : CancelEventArgs
{
public final TreeViewAction action ; [property getter]
public final TreeNode node ; [property getter]
[+] Inherited members
cancel empty
}
public class TreeViewEventArgs : EventArgs
{
public final TreeViewAction action ; [property getter]
public final TreeNode node ; [property getter]
[+] Inherited members
empty
}

Page last modified on July 03, 2008, at 07:11 PM

AltStyle によって変換されたページ (->オリジナル) /