Infralution Support Forum Index Infralution Support
Support groups for Infralution products
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

using format in Universal edit box

 
Post new topic   Reply to topic    Infralution Support Forum Index -> Virtual Tree Support
View previous topic :: View next topic  
Author Message
keesp
Guest





PostPosted: Mon Aug 22, 2005 7:11 am    Post subject: using format in Universal edit box Reply with quote

Hi,

I want to format the strings that are displayed in the universal editbox (the provided data may be any object), so that, for instance, when the ToString() of an object I provide returns the string representation of a double like 0.12345678, I can just show 0.123.
What is the best way to tackle this?

Thanks

Kees
Back to top
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Tue Aug 23, 2005 9:56 am    Post subject: Reply with quote

There are two ways you could do this:

1. Write your own TypeConverter and associate it with the property being edited using the TypeConverterAttribute. Your type converter ConvertTo function would convert to a rounded string as you require.

2. Use a different editor control such as the standard NumericUpDown control that supports setting the format string.
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
keesp
Guest





PostPosted: Tue Aug 30, 2005 9:42 am    Post subject: using typedescriptors in cell data Reply with quote

Could it be possible to associate the custom type converter with the type converter property of the CellData? I have tried to influence the value of the universal editbox by applying a format to this value, but this results in a popup box that the value is 'not a valid string value' (which seems strange as string values should be pretty robust).

The problem is, that I need to be able to scan through all kinds of properties and fill in the correct format when needed. In a property grid, I can do this by creating property descriptors for each property and apply the formatting there. I take it that there is no equivalent for the universal text box, unless they too can handle property descriptors?

Thanks,

Kees
Back to top
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Tue Aug 30, 2005 10:33 am    Post subject: Reply with quote

If you set the TypeConverter property of the CellData to a custom TypeConverter it is passed to the UniversalEditBox editor for the cell (and used to convert the string value to a value).

If you are having problems with this try putting a UniversalEditBox on a form and testing it there by programatically setting the TypeConverter property. Sounds like your type converter is not quite right. If you want to send a sample project we can take a look for you.
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
keesp
Guest





PostPosted: Wed Oct 05, 2005 12:24 pm    Post subject: A different solution Reply with quote

Hi,

I have currently solved the formatting issue by creating a new universal textbox, derived from the standard one, and adding the formatting data to this textbox to set the TextBox.Text property. This works fine, except upon initial use.
In my cellbinding I perform a cellData.Editor = myFormatEditor
and then continue with a celldata.Value = someObject.Value.

I had thought that if I override the OnValueChanged method of the universaltextbox, that I could perform the formatting there, but apparently the textbox text is set at a later stage, so the default representation is shown. Which would be the best event to apply the format?

Thanks

Kees
Back to top
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Wed Oct 05, 2005 11:24 pm    Post subject: Reply with quote

Try overriding the GetTextForValue method.
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Infralution Support Forum Index -> Virtual Tree Support All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group