Hello,
I am currently using the UltraCurrencyEditor and have run across a case where we need a special 'All' value. Preferable 'All' would be the 'null' value's text representing whenever the user completely clears the editor (mainly this is a default value and won't be entered manually). I've searched through the editors properties and have not found anything that does what I am hoping for (Version 7.3.20073.1052) . Is there a simple way to do this that I am missing or is this a fairly complicated process? Thanks,
Jason
Hi Jason,
Does the UltraCurrencyEditor control have a NullText or NullTextLabel proprety? If so, that would be the easiest way to display some meaningful text (such as "All") when the value of the control is null (or DBNull).
If there is no such property, then then alternative would be to use a DataFilter.
Thanks for your reply.
That's the sort of property I was hoping for, but the UltraCurrencyEditor has neither "NullText" nor a "NullTextLabel" property. I also do not see anything exposing or accepting a DataFilter on the editor. It appears I would have to cast the UltraCurrencyEditor to an EmbeddableEditorBase to get any access to a DataFilter, but the CurrencyEditor does not implement EmbeddableEditorBase. Are there any other alternatives?
Hm, there's no NullTextLabel, I see. You should Submit a feature request to Infragistics for that. Perhaps it can be added in a future release.
There is certainly a DataFilter proprety right on the control, though. Not sure why you are not seeing it, unless maybe you have a really old version from before DataFilters were added. But if that were the case, you would not be seeing the property on EmbeddableEditorBase. Are you sure you are looking at the right control?
I did find the DataFilter property on the control (not sure how I missed it before..) so I setup a custom data filter and implemented the Convert method like the following:
public object Convert( EditorDataFilterConvertArgs conversionArgs ) { return conversionArgs.Value ?? NullText; }
( Yes, I am ignoring the ConversionDirection in this example. I initially put the above statement in an ' if( args.ConversionDirection == EditorToDisplay', then tried 'EditorToOwner', then tried each of the other possible values, but none of them made any difference. )
This sets the ValueObject on the CurrencyEditor, but the Value property is still set to an 'empty' decimal value. Apparently when the control 'gets' it's display value it goes directly to the Value property reguardless of what the ValueObject is set to. I guess I will have to make a custom control that swaps the CurrencyEditor out with a TextBox to display the 'null-text' when that situation occurs unless I have glossed over something obvious. Thanks a bunch for your time and help!
jason
I already figured that out and replaced the control by the UltraMaskedEdit control.
In the helpfile the Nulltext is mentioned though on the Currency editor: ms-help://MS.VSCC.v90/INFRAGISTICS_NETEN82CLR2_HELP/NetAdvantage_NETEN82CLR2/Win_NETEN82CLR2/WinElements/WinCurrencyEditor_About_WinCurrencyEditor.html
This is in the menu "Windows Forms | Developer's Guide | The Toolset | WinCurrency editor" and than click on "About WinCurrencyEditor"
I'm using the 2008 Vol 2 edition...
I'm not sure exactly what 'about' page you are referring to. But there is no NullText property on the UltraCurrencyEditor.
In the helpfiles in the 'about' page of the WinCurrencyEditor is stated that it should support a Null Text - Is this now the case? and if so, from which version and how to use...
I guess the EditorToDisplay conversion isn't allowed because you might pass back some text that doesn't fit the mask and the control would not be able to handle that.
In that case, I would recommend a DrawFilter. That way you can draw the text yourself and you have total control over it.
I think you've nailed it on the head. I changed my code to....
public object Convert( EditorDataFilterConvertArgs conversionArgs ) { if( conversionArgs.Direction == ConversionDirection.EditorToDisplay ) { conversionArgs.Handled = true; return conversionArgs.Value ?? NullText; } return conversionArgs.Value; }
Then debugged through this and never entered the if statement. The flow appears to go DisplayToEditor, then EditorToOwner, and finally OwnerToEditor. The EditorToDisplay never gets executed. Thanks again for all of your time and help, I'll begin researching other work-arounds.