C# Класс SIL.FieldWorks.FdoUi.TypeAheadSupportVc

TypeAheadSupportVc is a view constructor used to display a (typically real) object reference property in a mode that allows the user to type part of an identifying string in order to make a selection. Typical call code: // Member variable of main VC, typically. TypeAheadSupportVc m_tasvc; // (In constructor of main VC, or similar place.) m_tasvc = new TypeAheadSupportVc((int)LexSense.LexSenseTags.kflidSemanticDomain, m_cache); m_tasvc.InitXXX(...); // Optional, choose any appropriate method if further Init required. // (As part of Display method or similar, where type-ahead property is wanted. m_tasvc.Insert(IVwEnv vwenv, int hvo); // atomic m_tasbc.InsertSeq(IVwEnv vwenv, int hvo); // sequence (or collection) -- not yet fully implemented? At least not tested. To make things work properly, the client must also override OnKeyPress and (after checking that no update is in progress) arrange to call m_tasvc.OnKeyPress(EditingHelper, e, ModifierKeys, m_vwGraphics). If this returns true, the normal call to base.OnKeyPress should be omitted. protected override void OnKeyPress(KeyPressEventArgs e) { if (DataUpdateMonitor.IsUpdateInProgress(DataAccess)) return; //throw this event away using (new HoldGraphics(this)) { if (m_vc.TasVc.OnKeyPress(EditingHelper, e, ModifierKeys, m_vwGraphics)) return; } base.OnKeyPress(e); } The client should also override SelectionChanged and (among any other behavior) calle m_tasvc.SelectionChanged(rootb, sel). This is used to expand any selection that covers more than one item in the sequence to cover the whole of the items partly selected. Finally, the client should override OnLoseFocus and (among any other behavior) call m_tasvc.LoseFocus(rootb); Similarly OnGotFocus(rootb).
Наследование: SIL.FieldWorks.Common.RootSites.VwBaseVc
Показать файл Открыть проект Примеры использования класса

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

Метод Описание
Display ( IVwEnv vwenv, int hvo, int frag ) : void

All our display method does is to display the name of each item in the fake virtual property. If it is the active object we are editing, at the relevant position in the relevant owner, we display the name using the special marker property.

InitDefault ( ) : void

This is the default initialization of the VC. It is adequate if 1. A list of possible values for the real property can be obtained from FDO by calling ReferenceTargetCandidates Enhance JohnT: support the following also: 2. The signature of the real property is CmPossibility (or a subclass), and the actual list can be obtained from the ListRootId.

Insert ( IVwEnv vwenv, int hvo ) : void

Insert a display of the relevant property for the indicated object, which is atomic.

InsertSeq ( IVwEnv vwenv, int hvo ) : void

Insert a display of the relevant property for the indicated object, which is a sequence or collection.

OnGotFocus ( IVwRootBox rootb ) : void
OnKeyPress ( EditingHelper ehelp, KeyPressEventArgs e, Keys modifiers, IVwGraphics vwGraphics ) : bool

This is the real guts of type-ahead. It is called by the client whenever a key is pressed. It returns true if it handled the key press, which it does if the current selection is in a type-ahead name property.

OnLostFocus ( IVwRootBox rootb ) : void
SelectionChanged ( IVwRootBox rootb, IVwSelection sel ) : void

Receives a notification that the selection in the root box has changed.

TypeAheadSupportVc ( int tag, SIL.FieldWorks.FDO.FdoCache cache ) : System

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

Метод Описание
Lookup ( ITsString tssTyped, ICmObject &objNew ) : ITsString

Given the string the user typed, generate the best available guess as to which of the options he intended. Set hvoNew to 0 (and return tssTyped) if it doesn't match any option. It is assumed that he is setting an object in property m_tag of object m_hvoParent.

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

Метод Описание
SelectedObject ( IVwRootBox rootb, IVwSelection sel, int &hvoParent, int &ihvo ) : int

Determine whether the current selection is at a place suitable for type-ahead. If not, answer 0. (In this case the values of hvoParent and ihvo should not be relied on.) If so, indicate the object whose property may be set by type-ahead (hvoParent), the object in the relevant property that is selected (return result), and its index within the property (0 if atomic).

SwitchTagAndFixSel ( int newTagName, IVwRootBox rootb ) : void

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

Display() публичный метод

All our display method does is to display the name of each item in the fake virtual property. If it is the active object we are editing, at the relevant position in the relevant owner, we display the name using the special marker property.
public Display ( IVwEnv vwenv, int hvo, int frag ) : void
vwenv IVwEnv
hvo int
frag int
Результат void

InitDefault() публичный метод

This is the default initialization of the VC. It is adequate if 1. A list of possible values for the real property can be obtained from FDO by calling ReferenceTargetCandidates Enhance JohnT: support the following also: 2. The signature of the real property is CmPossibility (or a subclass), and the actual list can be obtained from the ListRootId.
public InitDefault ( ) : void
Результат void

Insert() публичный метод

Insert a display of the relevant property for the indicated object, which is atomic.
public Insert ( IVwEnv vwenv, int hvo ) : void
vwenv IVwEnv
hvo int
Результат void

InsertSeq() публичный метод

Insert a display of the relevant property for the indicated object, which is a sequence or collection.
public InsertSeq ( IVwEnv vwenv, int hvo ) : void
vwenv IVwEnv
hvo int
Результат void

Lookup() защищенный метод

Given the string the user typed, generate the best available guess as to which of the options he intended. Set hvoNew to 0 (and return tssTyped) if it doesn't match any option. It is assumed that he is setting an object in property m_tag of object m_hvoParent.
protected Lookup ( ITsString tssTyped, ICmObject &objNew ) : ITsString
tssTyped ITsString
objNew ICmObject
Результат ITsString

OnGotFocus() публичный метод

public OnGotFocus ( IVwRootBox rootb ) : void
rootb IVwRootBox
Результат void

OnKeyPress() публичный метод

This is the real guts of type-ahead. It is called by the client whenever a key is pressed. It returns true if it handled the key press, which it does if the current selection is in a type-ahead name property.
public OnKeyPress ( EditingHelper ehelp, KeyPressEventArgs e, Keys modifiers, IVwGraphics vwGraphics ) : bool
ehelp EditingHelper
e System.Windows.Forms.KeyPressEventArgs
modifiers Keys
vwGraphics IVwGraphics
Результат bool

OnLostFocus() публичный метод

public OnLostFocus ( IVwRootBox rootb ) : void
rootb IVwRootBox
Результат void

SelectionChanged() публичный метод

Receives a notification that the selection in the root box has changed.
public SelectionChanged ( IVwRootBox rootb, IVwSelection sel ) : void
rootb IVwRootBox
sel IVwSelection
Результат void

TypeAheadSupportVc() публичный метод

public TypeAheadSupportVc ( int tag, SIL.FieldWorks.FDO.FdoCache cache ) : System
tag int
cache SIL.FieldWorks.FDO.FdoCache
Результат System