New Posts New Posts RSS Feed: Can't get UI to update until I tab off LookUpEdit control
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Can't get UI to update until I tab off LookUpEdit control

 Post Reply Post Reply
Author
Customer View Drop Down
Senior Member
Senior Member
Avatar
User Submitted Questions to Support

Joined: 30-May-2007
Location: United States
Posts: 260
Post Options Post Options   Quote Customer Quote  Post ReplyReply Direct Link To This Post Topic: Can't get UI to update until I tab off LookUpEdit control
    Posted: 16-Jul-2007 at 10:09am

A little info for you; when changing the OriginCustomer or DestinCustomer in the selection list (LookUpEdit Controls) the Binding source for those controls does not fire a change event.

 

I am using DevExpress 7.1.1.0 and DevForce Professional 3.5.0.1.

Back to Top
IdeaBlade View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 30-May-2007
Location: United States
Posts: 353
Post Options Post Options   Quote IdeaBlade Quote  Post ReplyReply Direct Link To This Post Posted: 16-Jul-2007 at 10:10am
The change event is firing.  It just doesn’t fire immediately after you have made the new selection.  It fires when the control property is validates (which would happen when you tabbed to a new control).  To make your application behave the way you want, you must set the DataSourceUpdateMode to OnPropertyChanged.  I got your application to behave the way that you want by adding these four lines:

 

      unitCBM.Descriptors.Get(originCustomerLookUpEdit).DataSourceUpdateMode = _

          DataSourceUpdateMode.OnPropertyChanged

        unitCBM.Descriptors.Get(originAddressLookUpEdit).DataSourceUpdateMode = _

          DataSourceUpdateMode.OnPropertyChanged

        unitCBM.Descriptors.Get(destinCustomerLookUpEdit).DataSourceUpdateMode = _

          DataSourceUpdateMode.OnPropertyChanged

        unitCBM.Descriptors.Get(destinCustomerLookUpEdit).DataSourceUpdateMode = _

          DataSourceUpdateMode.OnPropertyChanged

 

Here is the enumeration for DataSourceUpdateMode.

 

 

Member name

Description

Never

Data source is never updated and values entered into the control are not parsed, validated or re-formatted. 

OnPropertyChanged

Data source is updated whenever the value of the control property changes.  

OnValidation

Data source is updated when the control property is validated,  

After validation, the value in the control property will also be re-formatted

 

I’ve attached the completed solution.


Back to Top
Customer View Drop Down
Senior Member
Senior Member
Avatar
User Submitted Questions to Support

Joined: 30-May-2007
Location: United States
Posts: 260
Post Options Post Options   Quote Customer Quote  Post ReplyReply Direct Link To This Post Posted: 16-Jul-2007 at 10:12am
I have added the lines of code that you sent to the Form_Load event after setting the datasource; and still have the same results. If I set a break point on the:

 

    Private Sub originCustomerBS_CurrentChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles originCustomerBS.CurrentChanged

        Me.Validate()

        UpdateOriginAddresses()

    End Sub

 

And I change the originCustomerLookupEdit selection, it will never break on the Binding Source change events. I have also tried the other events:

ListChanged,

CurrentItemChanged,

PositionChanged… etc.

 

All with the same results, none of them break when I change the selection in the control, or when I tabbed to a new control. However they all do break when the form is loading. After the form is loaded, they no longer respond.

Back to Top
IdeaBlade View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 30-May-2007
Location: United States
Posts: 353
Post Options Post Options   Quote IdeaBlade Quote  Post ReplyReply Direct Link To This Post Posted: 16-Jul-2007 at 10:13am

I had a hard time finding something that works, but I eventually found:

Private Sub originCustomerLookUpEdit_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles originCustomerLookUpEdit.TextChanged

        Me.Validate()

    End Sub

 

Note that this is what you can use if you are using DataSourceUpdateMode.OnPropertyChanged

If you are updating on DataSourceUpdateMode.OnValidation, you can also use the following event: 

  Private Sub originCustomerLookUpEdit_Validated(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles originCustomerLookUpEdit.Validated

        Me.Validate()

    End Sub

 

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down