View previous topic :: View next topic |
Author |
Message |
keesp Guest
|
Posted: Thu Oct 13, 2005 3:57 pm Post subject: Updating modal UITypeEditors |
|
|
Hi,
In my universal edit box I use a number of UITypeEditors (through reflection) that have a modal edit style. The objects they represent are often complex, and the properties of these objects can be modified.
The problem is that the universal edit box does not consider such objects changed if the properties are modified (which is correct behaviour). How can I ensure that these changes are reflected towards the universal edit box and the cellbinding that uses the universal edit box?
Thanks
Kees |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Fri Oct 14, 2005 12:29 am Post subject: |
|
|
Your UITypeEditor should probably return a new object (unless the user cancels the action). That way the UniversalEditBox can tell something has changed. If you implement the ICloneable interface you can use this to clone the edited object upfront.
You should also override the Equals method to implement equality by value (rather than just reference equality) - as this is what UniversalEditBox uses to determine if the value has changed. _________________ Infralution Support |
|
Back to top |
|
|
keesp Guest
|
Posted: Fri Oct 14, 2005 10:47 am Post subject: continued... |
|
|
Okay,
I understand this, but I have found another way to catch the change in UniversalEditBox. What I currently don't see is how I can pass this change to the cellbinding so that it can perform the actions necessary to effectuate the change
Regards,
Kees |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Fri Oct 14, 2005 10:36 pm Post subject: |
|
|
VirtualTree CellWidget does the same sort of checking on whether the value has changed - so you will run into the same problem there unless you actually return a different object. If your editor just changes internal properties of the original object then you will also probably break the cancel mechanism (when you hit the escape key). You really do need to create a copy of the object for this to work properly. _________________ Infralution Support |
|
Back to top |
|
|
|