Creating Editors the Advanced Way With ICustomEditor

Although this is the advanced way its not really all that difficult, especially since most of the code to implement the interface is generic.

 

The main benefit of this method is if you want to inherit from an existing control and not have to put it on a UserControl.

 

The ICustomEditor interface (Connect4.SQLDesigner.Engine.Common.ICustomEditor), has the following events, methods and properties.

 

Name

Type

Description

EditFinished

Event

You should raise this event to tell the host to remove the editor.

ValidationError

Event

You should raise this event when validation fails, this allows the host to display the error in any method rather than forcing a messagebox.

Condition

Property

This is where the editor will receive a cCondition which provides full access to the condition information and schema.

ConditionIndex

Property

This is the index of the value to be edited (which is obtained via the condition object)

EndEditMode

Property

This is set by the host, telling the editor when to raise the EditFinished event, when it loses focus or when the validating event fires. This is used for when the editors are placed on the QueryPanel or the Prompt For values respectively.

EndEdit

Function

This is called by the host when it wishes the editor to be closed. Also used internally on the LostFocus and Validating events. This should always save the changes, or raise the ValidationError event and not close the editor if it doesn't validate.

CancelEdit

Sub

This is to abort the editor without saving, essentially  it just raises the edit finished event.