Ticket T1279263
Visible to All Users

Changing a dxBar caption empties EditValue of cxBarEditItems (cxImageComboBox) under a dxBarSubItem on that dxBar

created 3 days ago

Dir Sir/Madam,

After upgrading DevEx VCL from 22.2.4 to 24.2.4, we encountered a significant issue.

We call dxResourceStringsRepository.NotifyListeners command in the OnEditValueChanged event of the TcxBarEditItem(ImageComboBoxProperties) object that is on a Ribbon. It is working well on 22.2.4 version.

If ImageComboBox located on a Bar, there is no problem, it is working expected, but if you locate it into a subItem, changing Bar.Caption fires OnEditValueChanged event a second time with EditValue is null, so EditValue does not keep the selection and empties its value.

I attached the sample project.

There is only one TcxBarEditItem. I placed it in both a bar and a SubItem in the bar.
If you change the value from the Edit on Bar there is no problem, but if you change the value from the Edit on SubItem problem occurs.

Answers approved by DevExpress Support

created 2 days ago

Hello,

Our bar controls invoke complex routines when their elements (e.g., captions or layout) are changed. While this code could work without issues in previous versions, such routines may potentially break a normal notification sequence when they are invoked in not a proper moment (e.g., when an editor is active).

A common way to avoid issues is to execute sensitive code in a postponed procedure:

Delphi
uses dxThreading; procedure TForm1.edtLanguage1PropertiesEditValueChanged(Sender: TObject); begin FLanguage := TcxImageComboBox(Sender).EditValue; TdxUIThreadSyncService.EnqueueInvokeInUIThread(Sender, procedure () begin dxResourceStringsRepository.NotifyListeners; end ); end;
    Comments (1)

      Thank you, I’m really glad I learned this.

      Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

      Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.