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
파일 보기 프로젝트 열기: sillsdev/FieldWorks 1 사용 예제들

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