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 

Populated ComboBox as Editor

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



Joined: 29 Sep 2008
Posts: 23

PostPosted: Sun Aug 23, 2009 12:56 am    Post subject: Populated ComboBox as Editor Reply with quote

I'm trying to use a combo box that is populated with items as an editor in my virtual tree (it's actually a modified combobox that display items as a tree when the user clicks the drop down, but I don't think it's relevant to my problem). I cannot bind the combo box to a datasource - I need to populate the items manually (i.e. combobox.add("Item 1").

I've added an editor in Designer (Edit Virtual Tree) and then set the Control property to my custom combobox. I have the DisplayMode set to "OnEdit". I then set my columns editor property to my Editor.

On the Form_Load event, I populate the combo box with my database items, but nothing appears in the drop down list.

I'm using vb.net. Please help. Thanks.
Back to top
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Sun Aug 23, 2009 10:53 pm    Post subject: Reply with quote

Have a look at the following thread:

http://www.infralution.com/phpBB2/viewtopic.php?t=1074
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
esanabia



Joined: 29 Sep 2008
Posts: 23

PostPosted: Mon Aug 24, 2009 1:09 am    Post subject: Reply with quote

Thanks for the link. I added a handler to the CellEditor.InitializeControl event and it's working fine.

I'm having another issue with trying to add a new record... When a user opens the form, I populate the virtual tree with items the user had previously selected. The last item in the tree is just a blank record with a description of "Add new item". When the user clicks this row and selects an item from the the combo box, I want to add add a new record rather than update the existing row. This way there's always a "Add new item" row in the tree. I believe I should handle this in one of the vt events, but not sure.

Thanks for the help.
Back to top
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Mon Aug 24, 2009 1:18 am    Post subject: Reply with quote

What type of data source are you binding to?

You could update the existing row, but then add another new row (so that you always have another row).

You probably want to handle the SetCellValue event to handle this as a special case.

Code:
Private Sub _virtualTree_SetCellValue(ByVal sender As Object, ByVal e As SetCellValueEventArgs) Handles _virtualTree.SetCellValue

    ' let the default binding set the value
    '
    Dim binding As RowBinding = _virtualTree.GetRowBinding(e.Row)
    binding.SetCellValue(e.Row, e.Column, e.OldValue, e.NewValue)
   
    ' now check if e.Row.Item was a new row - how you do this depends on
    ' the type of data you are bound to - then add a new row

End Sub

_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
esanabia



Joined: 29 Sep 2008
Posts: 23

PostPosted: Mon Aug 24, 2009 4:24 am    Post subject: Reply with quote

I'm binding to a TypedList data source, like shown in the DatabaseBrowser sample. I updated the code in the SetCellValue and everything is working.

Thanks for all the help.
Back to top
View user's profile Send private message
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