Breaking change for v2007 vol 2.2 (aka 7.2.2)

30 July 2007

In v2007 vol 2.2, we've fixed a problem with inconsistent values being passed to the LookUpEdit.CustomDisplayText event. In fixing the problem, we were forced to change the signature of the BaseEdit.CustomDisplayText event (and the matching RepositoryItem.CustomDisplayText event) and the signature of a corresponding event handler class. We apologize for any inconvenience caused, but as I say, this breaking change was the simplest course of action we could take in this case.

If you used this event in your application, building the project after an upgrade to v2007 vol 2.2 will produce errors that must be fixed manually. The WinForms team prepared these tips that will allow you to fix this issue.

Breaking changes

First of all, here's a list of what's changed:

  1. The CustomDisplayText event now takes a CustomDisplayTextEventArgs object as a parameter (in prior versions, it took a ConvertEditValueEventArgs object).
  2. To set the display text, you must now use the e.DisplayText property (in prior versions, you used the e.Value property instead)
  3. There is no longer any Handled parameter in the CustomDisplayTextEventArgs object.

Strategy for fixing errors

After upgrading, you must do the following to resolve the compilation problems with the CustomDisplayText event:

1. First of all, locate the code used to subscribe to the CustomDisplayText event. In C#, it'll look something like this:

    buttonEdit1.CustomDisplayText += 
new DevExpress.XtraEditors.Controls.ConvertEditValueEventHandler(this.buttonEdit1_CustomDisplayText);

You'll need to replace the ConvertEditValueEventHandler delegate with the CustomDisplayTextEventHandler delegate:

    buttonEdit1.CustomDisplayText += 
new DevExpress.XtraEditors.Controls.CustomDisplayTextEventHandler(this.buttonEdit1_CustomDisplayText);

2. Second, locate your CustomDisplayText event handler, which takes a ConvertEditValueEventArgs parameter:

    private void buttonEdit1_CustomDisplayText(object sender, DevExpress.XtraEditors.Controls.ConvertEditValueEventArgs e) {

Replace the event's ConvertEditValueEventArgs parameter with the ConvertEditValueEventArgs class:

    private void buttonEdit2_CustomDisplayText(object sender, DevExpress.XtraEditors.Controls.CustomDisplayTextEventArgs e) {

3. Third, instead of specifying custom display text via the e.Value parameter, you should use the e.DisplayText parameter. For instance, if you used the following code to change the display text:

    e.Value = "'" + e.Value + "'";

you should replace it as follows:

    e.DisplayText = "'" + e.Value + "'";

4. Finally, you should remove any code statements that reference the e.Handled parameter as it's no longer available.

Free DevExpress Products - Get Your Copy Today

The following free DevExpress product offers remain available. Should you have any questions about the free offers below, please submit a ticket via the DevExpress Support Center at your convenience. We'll be happy to follow-up.
No Comments

Please login or register to post comments.