IBusinessBindable, value is not saved unless lost focus

Author Message
 Posted 8/11/2007 6:37:51 PM
Advanced StrataFrame User

Advanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame User

Group: Forum Members
Last Login: 3/5/2010 7:32:42 PM
Posts: 533, Visits: 2,025
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
Post #10810
Add to Twitter Add to Facebook
 Posted 8/11/2007 6:45:57 PM
Advanced StrataFrame User

Advanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame User

Group: Forum Members
Last Login: 3/5/2010 7:32:42 PM
Posts: 533, Visits: 2,025
BTW, I have set my control's DataSourceUpdateMode and ControlSourceUpdateMode to OnPropertyChanged

Thank you
Post #10811
Add to Twitter Add to Facebook
 Posted 8/5/2011 10:15:40 AM
StrataFrame VIP

StrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIP

Group: StrataFrame Users
Last Login: 10 hours ago
Posts: 2,432, Visits: 23,971
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
(Using VB.Net 2019/SQL Server 2017)


Tags:
Post #30229
Add to Twitter Add to Facebook
 Posted 8/7/2011 7:55:43 AM
Strategic Support Team Member

Strategic Support Team MemberStrategic Support Team MemberStrategic Support Team MemberStrategic Support Team MemberStrategic Support Team MemberStrategic Support Team MemberStrategic Support Team MemberStrategic Support Team MemberStrategic Support Team Member

Group: StrataFrame MVPs
Last Login: 6/15/2019 1:08:46 AM
Posts: 1,920, Visits: 21,109
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
Post #30231
Add to Twitter Add to Facebook
 Posted 8/7/2011 11:10:01 AM
StrataFrame VIP

StrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIP

Group: StrataFrame Users
Last Login: 10 hours ago
Posts: 2,432, Visits: 23,971
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
(Using VB.Net 2019/SQL Server 2017)
Post #30234
Add to Twitter Add to Facebook
 Posted 8/27/2011 1:35:19 PM
StrataFrame VIP

StrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIP

Group: StrataFrame Users
Last Login: 10 hours ago
Posts: 2,432, Visits: 23,971
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
(Using VB.Net 2019/SQL Server 2017)


 SearchLookUpEdit.zip (23 views, 2.29 KB)
Post #30273
Add to Twitter Add to Facebook
 Posted 11/17/2011 10:47:25 AM
StrataFrame VIP

StrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIP

Group: StrataFrame Users
Last Login: 10 hours ago
Posts: 2,432, Visits: 23,971
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
(Using VB.Net 2019/SQL Server 2017)
Post #30616
Add to Twitter Add to Facebook
 Posted 11/17/2011 12:05:50 PM
StrataFrame Novice

StrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame Novice

Group: StrataFrame Users
Last Login: 12/20/2012 6:46:13 AM
Posts: 112, Visits: 1,188
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: 11/17/2011 12:06:58 PM by Alex Luyando
Post #30618
Add to Twitter Add to Facebook
 Posted 11/17/2011 9:11:20 PM
Strategic Support Team Member

Strategic Support Team MemberStrategic Support Team MemberStrategic Support Team MemberStrategic Support Team MemberStrategic Support Team MemberStrategic Support Team MemberStrategic Support Team MemberStrategic Support Team MemberStrategic Support Team Member

Group: StrataFrame MVPs
Last Login: 6/15/2019 1:08:46 AM
Posts: 1,920, Visits: 21,109
Thanks, Alex. Cool
Post #30621
Add to Twitter Add to Facebook
 Posted 11/18/2011 3:51:37 AM
StrataFrame Developer

StrataFrame DeveloperStrataFrame DeveloperStrataFrame DeveloperStrataFrame DeveloperStrataFrame DeveloperStrataFrame DeveloperStrataFrame DeveloperStrataFrame DeveloperStrataFrame Developer

Group: StrataFrame Developers
Last Login: 11/20/2019 8:57:25 AM
Posts: 6,610, Visits: 6,776
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.
Post #30630
Add to Twitter Add to Facebook


Similar Topics

Expand / Collapse

Reading This Topic

Expand / Collapse

Site Map - Home - My Account - Forum - About Us - Contact Us - Try It - Buy It

Microsoft, Visual Studio, and the Visual Studio logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries.