How it works...

The first part is to use a custom form. The binding to the lookup event is done using a specific event handler for this purpose. These events have one very important feature, apart from allowing us to bind to a form control event; in that, they pass the arguments object as a FormControlEventArgs object.

We can then cast this as a FormControlCancelableSuperEventArgs object. When we call the CancelSuperCall() method, it tells the calling control not to call its super. In the case of a lookup event, we would otherwise end up with two lookups: our new lookup and then the standard lookup.

Apart from gathering information, the other key part is that we construct the FormRun object using a factory, which creates FormRun so that it behaves as a lookup and not just a form.

The second part was to create our own lookup, which was largely repeating what we have already learnt. Just follow the pattern. However, the pattern does need a little help, so it understands how to behave itself. This is why we have to override the init and run methods. Even so, this is a lot less effort than in prior releases.

The third part was to create a lookup programmatically. This is often preferable for simple lookups, and we could also add child data sources and filters to the query. This was done in two methods, as it is common to use lookups like this in our own code. So the lookup method could be used as the lookup method on a data source field.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.119.255.44