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 

Celleditor questions

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



Joined: 21 Oct 2006
Posts: 32

PostPosted: Sat Jan 26, 2008 12:02 am    Post subject: Celleditor questions Reply with quote

Hi,

I amplanning to use a celleditor control in a virtualtree but have a couple of queries. The vt I want to add the celleditor to uses object binding with 2 columns of data. Below is a diagram of the data table:

---------------------------------
ID | Value
---------------------------------
0 | age
1 | gender
2 | status
3 | children
4 | address

I;ve added the editor to the "Value" column using the following code:

Code:
col.CellEditor = New CellEditor(filePropEditBox)


The problem is that this causes the editor to appear for every row in the Value column. How can I make it so that the editor only appears on certain rows depending on their ID. For example, if the ID is an odd number then the celleditor should appear, otherwise not.

My 2nd question relates to the editor itself. I would like to use a combobox control as the editor and fill it with different items each time it is invoked. The items it contains should obviously depend on the row that is selected. Is there some way to take control of the editor when it is initialised i.e. when the user selects a row?
Back to top
View user's profile Send private message
WaqasK



Joined: 21 Oct 2006
Posts: 32

PostPosted: Sun Jan 27, 2008 5:47 pm    Post subject: Reply with quote

Ok, i figured out how to get data from the row when the celleditor is initialised. I just used the cellEditor.InitializeControl handler to take control of the editor and then used the row data property to get information from the tree:

Code:
Private Sub fileDetEditor_Initialize(ByVal sender As System.Object, ByVal e As CellEditorInitializeEventArgs) Handles fileDetEditor.InitializeControl
     
      Dim row As DataRow = DetPropVT.SelectedItem
      'Do stuff...

End Sub


But I still can't choose when to make the editor appear...
Back to top
View user's profile Send private message
WaqasK



Joined: 21 Oct 2006
Posts: 32

PostPosted: Mon Jan 28, 2008 1:02 am    Post subject: Reply with quote

Ok, I've managed to work out a solution for when to make the editor appear. I just set the enabled property for the combobox to true or false depending on whether i wanted to display it for a particular row:

Code:
           
Private Sub fileDetEditor_Initialize(ByVal sender As System.Object, ByVal e As CellEditorInitializeEventArgs) Handles fileDetEditor.InitializeControl
           
            'get row data
            Dim row As DataRow = DetPropVT.SelectedItem

            ' set a combo box as the celleditor control
            Dim newBox As ComboBox = e.Control

            'change enabled state of combobox (hence also the celleditor)
            If row.Item(4) = "Yes" Then
                newBox.Enabled = True
            Else
                newBox.Enabled = False
            End If
End Sub
Back to top
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Mon Jan 28, 2008 4:34 am    Post subject: Reply with quote

Quote:
But I still can't choose when to make the editor appear...


Instead of setting the Editor for the column you can set the Editor for individual RowBindings (via the Virtual Tree editor) or programmatically by handling the GetCellData event and setting the e.CellData.Editor property. If you are using object binding then look at the section in the online help on mixing Programmatic binding with object binding.
_________________
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