Creating a Popup Editor

Creating a popup editor requires two steps

  1. Create the actual popup form

  2. Create the editor class using the Advanced or Simple method

 

Creating the Popup form

The first step is to inherit from the PopupFormBase form, which provides the basic functionality of the popup.

 

Since this is just a normal WinForm you can do almost whatever you want to do with it.

 

There are a few methods you will need to override (they are not marked as MustOverride, because if the class is made Abstract/MustInherit the ability to design the interface visually will be gone, so its a small price to pay)

 

Name

Description

DisplayValue

Optional, Provides a display value for editor text portion, if not overridden the text portion of the editor will always be blank

Value

The actual value of the data being edited

DataSource

Optional, If your editor can accept a datasource, the custom class can assign it here.

DoValidation

This will be called when the editor is going to be closed, it will return true by default if you don't override this, so it is recommended that you do override it unless you can guarantee there will never be any invalid entries.

 

If during the course of the user entering data, you wish to update the popup editor's text display, simply make a call to UpdateDisplayValue, that will inform the popup editor to refresh the text.

 

Creating the Editor Class

The steps for this are virtually identical to a normal editor (in advanced or simple mode), with the following addition

 

You need to specify the .PopupControl property for the popup editor, this is the form that you would have created above. This can be done in the constructor of the editor class.