C# Class SIL.FieldWorks.Common.Widgets.FwListBox

FwListBox is a simulation of a regular Windows.Forms.ListBox. It has much the same interface, though not all events and properties are yet supported. There are two main differences: (1) It is implemented using FieldWorks Views, and hence can render Graphite fonts properly. (2) Item labels can be TsStrings, in which case, formatting of items can vary based on the properties of string runs. To get this behavior, you can (a) Let the items actually be ITsStrings. (b) Let the items implement the SIL.FieldWorks.FDO.ITssValue interface, which has just one property, public ITsString AsTss {get;} You must also pass your writing system factory to the FwListBox (set the WritingSystemFactory property). Otherwise, the combo box will not be able to interpret the writing systems of any TsStrings it is asked to display. It will improve performance to do this even if you are not using TsString data.
Inheritance: System.Windows.Forms.Panel, IFWDisposable, IVwNotifyChange
Mostra file Open project: sillsdev/FieldWorks Class Usage Examples

Protected Properties

Property Type Description
m_highlightedIndex int
m_selectedIndex int

Private Properties

Property Type Description
EnsureRoot void
FwListBox System
GetItem object
RaiseSameItemSelected void
RaiseSelectedIndexChanged void
SetItem void

Public Methods

Method Description
BeginUpdate ( ) : void

Begins the update.

CheckDisposed ( ) : void

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

EndUpdate ( ) : void

Ends the update.

FindStringExact ( string str ) : int

Find the index where the specified string occurs. If it does not, or the argument is null, return -1.

FocusAndCapture ( ) : void

Move the focus to the real view. (Used to capture the mouse also, but that interferes with the scroll bar, so I'm using a filter instead.)

PropChanged ( int hvo, int tag, int ivMin, int cvIns, int cvDel ) : void

Receives notifications when something in the data cache changes.

ScrollHighlightIntoView ( ) : void

Scroll so that the selection can be seen.

TextOfItem ( object item ) : ITsString

Obtain the text corresponding to the specified item in your contents list.

Protected Methods

Method Description
Dispose ( bool disposing ) : void

Clean up any resources being used.

FindIndexOfTss ( ITsString tss ) : int

Find the index where the specified TsString occurs. If it does not, or the argument is null, return -1.

IsHighlighted ( int index ) : bool

IsSelected ( int index ) : bool

Answer whether the indicated index is selected. This is trivial now, but will be less so if we implement multiple selections.

Private Methods

Method Description
EnsureRoot ( ) : void

Ensure the root box has been created.

FwListBox ( ) : System
GetItem ( int itemIndex ) : object

Gets the item.

RaiseSameItemSelected ( ) : void

Fire the SameItemSelected event.

RaiseSelectedIndexChanged ( ) : void

Fire the SelectedIndexChanged event.

SetItem ( object item, int &itemIndex ) : void

Sets the item.

Method Details

BeginUpdate() public method

Begins the update.
public BeginUpdate ( ) : void
return void

CheckDisposed() public method

Check to see if the object has been disposed. All public Properties and Methods should call this before doing anything else.
public CheckDisposed ( ) : void
return void

Dispose() protected method

Clean up any resources being used.
protected Dispose ( bool disposing ) : void
disposing bool
return void

EndUpdate() public method

Ends the update.
public EndUpdate ( ) : void
return void

FindIndexOfTss() protected method

Find the index where the specified TsString occurs. If it does not, or the argument is null, return -1.
protected FindIndexOfTss ( ITsString tss ) : int
tss ITsString
return int

FindStringExact() public method

Find the index where the specified string occurs. If it does not, or the argument is null, return -1.
public FindStringExact ( string str ) : int
str string
return int

FocusAndCapture() public method

Move the focus to the real view. (Used to capture the mouse also, but that interferes with the scroll bar, so I'm using a filter instead.)
public FocusAndCapture ( ) : void
return void

IsHighlighted() protected method

protected IsHighlighted ( int index ) : bool
index int
return bool

IsSelected() protected method

Answer whether the indicated index is selected. This is trivial now, but will be less so if we implement multiple selections.
protected IsSelected ( int index ) : bool
index int
return bool

PropChanged() public method

Receives notifications when something in the data cache changes.
public PropChanged ( int hvo, int tag, int ivMin, int cvIns, int cvDel ) : void
hvo int
tag int
ivMin int
cvIns int
cvDel int
return void

ScrollHighlightIntoView() public method

Scroll so that the selection can be seen.
public ScrollHighlightIntoView ( ) : void
return void

TextOfItem() public method

Obtain the text corresponding to the specified item in your contents list.
public TextOfItem ( object item ) : ITsString
item object
return ITsString

Property Details

m_highlightedIndex protected_oe property

The index highlighted, may be different from selected during tracking in combo. This is set true in a combo box, when we want to track mouse movement by highlighting the item hovered over. When it is true, changing the selected index does not trigger events, but a MouseDown does.
protected int m_highlightedIndex
return int

m_selectedIndex protected_oe property

The index actually selected.
protected int m_selectedIndex
return int