C# Класс SIL.FieldWorks.Common.Widgets.PopupTree

PopupTree is a form containing a TreeView, designed to pop up like the list of a combo box to allow a one-time choice from a list. Although this is currently implemented using the standard TreeView class, it is possible that a need will arise for items to be rendered using View code, either to support styled text in items, or to support Graphite rendering. For this reason the TreeView is not made public, and only a limited subset of its capabilities is currently exposed.
Наследование: System.Windows.Forms.Form, IFWDisposable, IDropDownBox
Показать файл Открыть проект Примеры использования класса

Private Properties

Свойство Тип Описание
FindAndSelectNodeStartingWith bool
FindNode System.Windows.Forms.TreeNode
HandleTreeItemSelect void
InitializeComponent void
OnHide void
RemoveFilter void
m_treeView_AfterSelect void
m_treeView_BeforeSelect void
m_treeView_KeyDown void
m_treeView_MouseDown void
m_treeView_MouseUp void

Открытые методы

Метод Описание
BeginUpdate ( ) : void

Begin update on the tree...when you want to add multiple nodes.

CheckDisposed ( ) : void

Check to see if the object has been disposed. All public Properties and Methods should call this before doing anything else.

EnableAfterAndBeforeSelectHandling ( bool enable ) : void

Enables or disables the handlers for the AfterSelect and BeforeSelect events

EndUpdate ( ) : void

End update started with BeginUpdate.

HideForm ( ) : void

Hide the window that shows the popup tree (and activate the parent window, if known).

HideForm ( bool activateParent ) : void

Hide the window that shows the popup tree (and activate the parent window, if requested).

Launch ( Rectangle launcherBounds, Rectangle screenBounds ) : void

Launch the PopupTree. Typical usage, where 'this' is a control that the list should appear below: m_listBox.Launch(Parent.RectangleToScreen(Bounds), Screen.GetWorkingArea(this)); Or, where rect is a rectangle in the client area of control 'this': m_listBox.Launch(RectangleToScreen(rect), Screen.GetWorkingArea(this); (Be sure to set the height and width of the PopupTree first.)

PopupTree ( ) : System

SelectNodeStartingWith ( string start ) : void

Cycle the selection to the next node that begins with the specified text. (Case insensitive.)

SelectObj ( int hvo ) : void

Find the node for the specified Hvo and select it. Note that this DOES trigger the AfterSelect event. Enhance JohnT: currently, if the hvo isn't found, it still fires off the AfterSelect event. - should we (will it work?) set m_treeView.SelectedNode to null so nothing is selected? - if it's an exception not to find the node, do we need a mechanism...maybe passing zero?... to explicitly set it to 'nothing selected' (if that's possible). None of that is needed yet, so we haven't worried about it.

SelectObjWithoutTriggeringBeforeAfterSelects ( int hvo ) : void

Find the node for the specified Hvo and select it. Note that this does NOT trigger the BeforeSelect or AfterSelect events.

Защищенные методы

Метод Описание
Dispose ( bool disposing ) : void

Clean up any resources being used.

OnActivated ( EventArgs e ) : void

JohnT: I don't know why we need this, but for some obscure reason, after everything else happens and we are hidden, we get activated again. Then the main window is not active, and can't get keyboard events. AArgh! This is a horrible kludge but the best I can find.

OnVisibleChanged ( EventArgs e ) : void

Make sure we clean out the message filter if not already done.

Приватные методы

Метод Описание
FindAndSelectNodeStartingWith ( int iStarting, int iEnding, string startKey ) : bool

Select the node whose text starts with the given startKey string (if node exists).

FindNode ( TreeNodeCollection nodes, int hvo ) : TreeNode

Assuming a node collection containing HvoTreeNodes, return the one whose HVO is the specified one. Null if not found.

HandleTreeItemSelect ( ) : void
InitializeComponent ( ) : void

Required method for Designer support - do not modify the contents of this method with the code editor.

OnHide ( ) : void
RemoveFilter ( ) : void
m_treeView_AfterSelect ( object sender, TreeViewEventArgs e ) : void
m_treeView_BeforeSelect ( object sender, System.Windows.Forms.TreeViewCancelEventArgs e ) : void

pass on the event to clients.

m_treeView_KeyDown ( object sender, KeyEventArgs e ) : void
m_treeView_MouseDown ( object sender, MouseEventArgs e ) : void

Handle a MouseDown event, recording the selected node if it seems likely that the TreeView Select operation will ignore it.

m_treeView_MouseUp ( object sender, MouseEventArgs e ) : void

Handle a MouseUp event, selecting the node recorded earlier for MouseDown if it is the same node in the TreeView control.

Описание методов

BeginUpdate() публичный Метод

Begin update on the tree...when you want to add multiple nodes.
public BeginUpdate ( ) : void
Результат void

CheckDisposed() публичный Метод

Check to see if the object has been disposed. All public Properties and Methods should call this before doing anything else.
public CheckDisposed ( ) : void
Результат void

Dispose() защищенный Метод

Clean up any resources being used.
protected Dispose ( bool disposing ) : void
disposing bool
Результат void

EnableAfterAndBeforeSelectHandling() публичный Метод

Enables or disables the handlers for the AfterSelect and BeforeSelect events
public EnableAfterAndBeforeSelectHandling ( bool enable ) : void
enable bool
Результат void

EndUpdate() публичный Метод

End update started with BeginUpdate.
public EndUpdate ( ) : void
Результат void

HideForm() публичный Метод

Hide the window that shows the popup tree (and activate the parent window, if known).
public HideForm ( ) : void
Результат void

HideForm() публичный Метод

Hide the window that shows the popup tree (and activate the parent window, if requested).
public HideForm ( bool activateParent ) : void
activateParent bool
Результат void

Launch() публичный Метод

Launch the PopupTree. Typical usage, where 'this' is a control that the list should appear below: m_listBox.Launch(Parent.RectangleToScreen(Bounds), Screen.GetWorkingArea(this)); Or, where rect is a rectangle in the client area of control 'this': m_listBox.Launch(RectangleToScreen(rect), Screen.GetWorkingArea(this); (Be sure to set the height and width of the PopupTree first.)
public Launch ( Rectangle launcherBounds, Rectangle screenBounds ) : void
launcherBounds System.Drawing.Rectangle A rectangle in 'screen' coordinates indicating where to display the list. Typically, as shown /// above, the location of something the user clicked to make the list display. It's significance is that /// the tree will usually be shown with its top left just to the right of the bottom left of the rectangle, and /// (if the tree width has not already been set explicitly) its width will match the rectangle. If there is not /// room to display the tree below this rectangle, it will be displayed above instead.
screenBounds System.Drawing.Rectangle A rectangle in 'screen' coordinates indicating the location of the actual screen /// that the tree is to appear on.
Результат void

OnActivated() защищенный Метод

JohnT: I don't know why we need this, but for some obscure reason, after everything else happens and we are hidden, we get activated again. Then the main window is not active, and can't get keyboard events. AArgh! This is a horrible kludge but the best I can find.
protected OnActivated ( EventArgs e ) : void
e System.EventArgs
Результат void

OnVisibleChanged() защищенный Метод

Make sure we clean out the message filter if not already done.
protected OnVisibleChanged ( EventArgs e ) : void
e System.EventArgs
Результат void

PopupTree() публичный Метод

public PopupTree ( ) : System
Результат System

SelectNodeStartingWith() публичный Метод

Cycle the selection to the next node that begins with the specified text. (Case insensitive.)
public SelectNodeStartingWith ( string start ) : void
start string the search key
Результат void

SelectObj() публичный Метод

Find the node for the specified Hvo and select it. Note that this DOES trigger the AfterSelect event. Enhance JohnT: currently, if the hvo isn't found, it still fires off the AfterSelect event. - should we (will it work?) set m_treeView.SelectedNode to null so nothing is selected? - if it's an exception not to find the node, do we need a mechanism...maybe passing zero?... to explicitly set it to 'nothing selected' (if that's possible). None of that is needed yet, so we haven't worried about it.
public SelectObj ( int hvo ) : void
hvo int
Результат void

SelectObjWithoutTriggeringBeforeAfterSelects() публичный Метод

Find the node for the specified Hvo and select it. Note that this does NOT trigger the BeforeSelect or AfterSelect events.
public SelectObjWithoutTriggeringBeforeAfterSelects ( int hvo ) : void
hvo int
Результат void