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 Interface as datasource

 
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 03, 2005 8:17 am    Post subject: Using Interface as datasource Reply with quote

Currently I'm evaluating the Virtual Tree and I encounter a problem. It is essential to solve this problem for possible usage in our application.

When I try to fill the control using the visual tree editor, I've no problem when I 'Auto-generate' from on class. The tree/columns fill properly when I run my test application. However when I 'Auto generate' from an interface (which defines exactly the same functions as in the class in my test application), the control does not fill, the tree as well as the 'columns' are not filled; only the first root-item is display.

Can you tell me how to build a tree based on an interface-definition rather then a class-definition.

Thank you in advance for your answers.
Back to top
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Tue May 03, 2005 11:42 am    Post subject: Reply with quote

Object bindings by default bind to the type name of the object to be displayed ie the binding used is selected by matching the TypeName specified in your binding to the name of the object type.

So if you have an object of class A that implements interface B, you still need to create an object binding with TypeName set to "A" so that it is selected.

If you have multiple classes that implement the interface B and you want to use one binding for all of them you can still do this if you employ some kind of naming convention for you classes. For instance if all the classes you want to bind to implement interface B and end with _B then you could change the TypeName property of the binding to "_B".

This will work because when selecting a match the bindings will allow partial matches based on the last part of the TypeName. The bindings are also matched in the order they are displayed in the VirtualTree editor - which also gives you some more control over the way bindings are selected.

If none of this helps you could derive a new RowBinding class (eg BObjectRowBinding) from ObjectRowBinding and override the BindsTo method so that it binds to objects which implement your interface. You can then change the code generated by the designer for the interface binding to change the type declaration to BObjectRowBinding.

ObjectRowBindings should probably work in the way you expected where a full type name is specified. We can probably change this in the next minor release.
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
Harri
Guest





PostPosted: Tue May 03, 2005 2:12 pm    Post subject: Reply with quote

Thank you very much for your quick answer.
I've implemented a class derived from ObjectRowBinding as you suggested and now the control is filled properly!

Thanks again & best regards
Back to top
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Thu May 26, 2005 3:45 am    Post subject: Reply with quote

Version 1.5.0 has now been released. It fixes the behaviour of ObjectBindings so that bindings for base classes or interfaces will bind to derived objects (or objects that implement the interface). So you no longer have to rely on naming conventions.
_________________
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