IBusinessBindable, value is not saved unless lost focus


Author
Message
Chan
Chan
Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)
Group: Forum Members
Posts: 533, Visits: 2K
Hi,

I have subclassed DevExpress lookupedit and implement IBusinessBindable interface. it works fine, except the excepted value is not saved unless I lost focus the control.



I have attached the source code.



Please advice



Thank you
Chan
Chan
Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)
Group: Forum Members
Posts: 533, Visits: 2K
BTW, I have set my control's DataSourceUpdateMode and ControlSourceUpdateMode to OnPropertyChanged



Thank you
Edhy Rijo
E
StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Chan (8/12/2007)
Hi,
I have subclassed DevExpress lookupedit and implement IBusinessBindable interface. it works fine, except the excepted value is not saved unless I lost focus the control.


Hi Chan,
I am seeing the same problem as yours with the DevExpress SearchLookUpEdit control.  I subclassed this control in the Inherited UI project and used the code from another DevEx control in the project.  The BindingProperty = EditValue and BindingUpdateMode = OnPropertyChanged

Now found out that the control source is not updated unless moving the focus out of the control. 

Where you able to solve this issue?  Anybody have suggestions on how to fix this?

Edhy Rijo

Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
I have a suggestion.

In my base form I have a text box that I use to change the focus to on the base form's BeforeSave method.

        Private Sub PFNStandardForm_BeforeSave(ByVal e As MicroFour.StrataFrame.Data.BeforeSaveUndoByFormEventArgs) _
                    Handles Me.BeforeSave
            '-- Change focus to pre-built control in order to validate control where focus is set in any form, before
            '-- saving. This is needed if user saves the form without leaving control. If Validate has code, it will be
            '-- executed first, refreshing any related contents before saving, otherwise save will occur first.
            Me.txtMoveFocusBeforeSave.Visible = True
            Me.txtMoveFocusBeforeSave.Focus()
            Me.txtMoveFocusBeforeSave.Visible = False
        End Sub

Edhy Rijo
E
StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi Ivan,
Thanks for the suggestion but in my case, I am not trying to save yet so I cannot trigger your code to move the focus of the control.  I have code in the EditValueChanged which uses the BO field that is binded to the control, and of course it is failing because something is not working with the IBusinessBindable.

In other words, when the EditValueChanged is trigger, the BO field property binded to the control is not updated with the EditValue property of the control.  I have to add code like this below to overcome the situation:
Private Sub sleCustomerNameLookup_EditValueChanged(sender As System.Object, e As System.EventArgsHandles sleCustomerNameLookup.EditValueChanged
         '-- Binding is not working properly, so we need to make sure the BO field gets its value updated.
         If Me.BizTransactionItems1.Count > 0 AndAlso Not String.IsNullOrEmpty(Me.sleCustomerNameLookup.EditValue) Then
             If Me.BizTransactionItems1.QBCustomerRefID <> Me.sleCustomerNameLookup.EditValue Then
                 Me.BizTransactionItems1.QBCustomerRefID = Me.sleCustomerNameLookup.EditValue
             End If
         End If
End Sub

I was under the assumption that implementing the IBusinessBindable would take care of updating the BO field property as it is done for the SF controls and other DevExpress like the EditText which works fine, so I believe there must be something different with this control "SearchLookupEdit" which is not respecting the binded field property.  Only thing different I can think of is that this controls uses a BusinessBindingSource as the source of the internal grid and the others don't.

This DevExpress SearchLookupEdit control is very, very useful for replacing the traditional SF combobox and has the ability to show a popup with as many columns as you want and more important the companion textbox is able to search on all the columns you defined as searchable, so the end user can simply start typing for any value and whatever is found would be highlighted and the grid will be filtered with only those records.

http://forum.strataframe.net/Uploads/Images/98f32f5f-9fb6-4bbc-ac60-58b8.png

Edhy Rijo

Edhy Rijo
E
StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi Trent,
I am starting to use the DevExpress.XtraEditors.SearchLookupEdit and replace all my SF comboboxes with this control since it has a lot more advantages to offer to the End Users and value to our application.

I would really appreciate if you can take some time to see if you can make this control work with SF IBusinessBindable.  So far I created a new class in the MicroFour SF Inherited UI project and copied the code from the TextEdit control.  At this point I am using a BBS as the control source with no problem, the only problem is that the control is not reading the value from the BO BindingField property, so no matter what I do, I have to manually update the BO with the EditValue of the control and since I want to start using this control in all my forms where a combobox is used, then it would be a big challenge to having to manually create extra properties to handle the EditValue.

Attached please find the SearchLookUpEdit.zip with the class I created for this control.  Again, keep in mind that I am going the simplest way possible to use this control with a BBS and only care about having the IBusinessBindable working properly so I can just drop this, attach the BBS and move forward.

Thanks!

Edhy Rijo

Attachments
SearchLookUpEdit.zip (138 views, 2.00 KB)
Edhy Rijo
E
StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi Trent,

I would like to bump this thread since this DevExpress new control is very important for my applications and I would like to make it work nicely with StrataFrame IBusinessBindable as the other controls in the Inheritance project. 

I know we may not need this when SF 2.0 arrive, but in the mean time, I would really appreciate if you can take a look at this thread and see if you can shed some light for the
DevExpress.XtraEditors.SearchLookupEdit.

Thanks!


Edhy Rijo

Alex Luyando
Alex Luyando
StrataFrame User (210 reputation)StrataFrame User (210 reputation)StrataFrame User (210 reputation)StrataFrame User (210 reputation)StrataFrame User (210 reputation)StrataFrame User (210 reputation)StrataFrame User (210 reputation)StrataFrame User (210 reputation)StrataFrame User (210 reputation)
Group: StrataFrame Users
Posts: 112, Visits: 1.2K
Ivan George Borges (8/7/2011)
I have a suggestion.

In my base form I have a text box that I use to change the focus to on the base form's BeforeSave method.



Cool workaround, Ivan!

________________
_____/ Regards,
____/ al
Edited 13 Years Ago by Alex Luyando
Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Thanks, Alex. Cool
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Edhy,

I can look into this some, but in truth, you are better off writing a custom control.  Custom controls seems to scare everyone, but if you will just stick it out and write one, you will be in control from that point forward.  You can implement all of your own logic, reduce overhead, and make it match the exact specs of your application.

This is what we have done.  I will be creating some videos and posting them about this at some point in the not too distant future.  Anything that is pivotal to our application is generally a custom control.  This includes our inline searches.  In our charting environment, this is a custom rendered control that is WAY faster than standard 3rd party controls...mainly because we only implement what we need instead of implementing anything that could ever possibly be needed.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search