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 

Cannot edit using UniversalEditBox

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





PostPosted: Tue May 10, 2005 11:24 am    Post subject: Cannot edit using UniversalEditBox Reply with quote

Hello Support,

Im trying to get the UniversalEditBox to work as editor for my cell(-values). When I use a normal textbox as control all works fine (all value's are editied as strings). Using an UniversalEditBox however, I cannot edit my cell-values at all: the value in the cell is displayed and selected when I click on it but it does not react on any user-input (key-strokes).
The following code shows what I do (I don't use the 'Edit Virtual Tree'-designer functionality):

Code:

// In the InitializeComponent() of a derived class from VirtualTree :
// Using a textbox, editing works
// this._cellEditorControl = new TextBox();
// Using a UniversalEditBox, editing does not work yet
this._cellEditorControl = new Infralution.Controls.UniversalEditBox();
this._cellEditorControl.Location = new System.Drawing.Point(0, 0);
this._cellEditorControl.Name = "_cellEditorControl";
this._cellEditorControl.Size = new System.Drawing.Size(195, 24);
this._cellEditorControl.TabIndex = 0;
this._cellEditorControl.TabStop = false;

this._cellEditor = new CellEditor(this._cellEditorControl);
this._cellEditor.DisplayMode = CellEditorDisplayMode.Always;

// CellBinding: object.Value<->Value column
ObjectCellBinding valueExceptionCellBinding = new ObjectCellBinding();
valueExceptionCellBinding.Column = this._columnValue;
valueExceptionCellBinding.Field = "Value";

// Set the editor for this cellbinding
valueExceptionCellBinding.Editor = this._cellEditor;


I'm sure I must be missing something but I cannot find out what.
Can you help me out?

Thank you in advance
Harri
Back to top
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Tue May 10, 2005 10:47 pm    Post subject: Reply with quote

What is the type of the object you are displaying in the cell? The UniversalEditBox uses the TypeConverter associated with the type to determine how to display values and convert strings back to typed values - if there is no TypeConverter or the TypeConverter does not support conversion from string then you won't be able to edit the value. If it is your own type you can define a TypeConverter and associate it with the type using the TypeConverter attribute.

Try puting a UniversalEditBox on a form and setting the UniversalEditBox value directly to the type you want to edit to check out the behaviour.
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
Harri
Guest





PostPosted: Wed May 11, 2005 2:31 pm    Post subject: Reply with quote

Thank you for your suggestions.

The property to which the cellBinding binds is the "Value"-property.
This "value"-property is defined in an interface and is of the type object.
Several classes implement this interface; the actual Value can be anything (depending on the class that implements the interface, e.g. integer, double, boolean, array, object... etc)

I've discovered that if the cellbinding binds to a property that is of the type object, the UniversalEditBox does not let me to edit the values. As soon as I bind to a 'strongly-typed' property (i.e. string or int...) of the type object, I can edit the value.

I guess I need to derive from ObjectCellBinding, and override the GetCellData; in here I should set the cellData.TypeConverter ?

Thank you in advance,
Harri
Back to top
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Wed May 11, 2005 10:39 pm    Post subject: Reply with quote

Yes that's probably the solution. Because the property is not strongly typed the ObjectCellBinding cannot set the TypeConverter property of the CellData and so the UniversalEditBox does not know how to edit the values.
_________________
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