View previous topic :: View next topic |
Author |
Message |
CNET Channel Guest
|
Posted: Tue Jan 31, 2006 1:28 pm Post subject: Label edit |
|
|
Does VirtualTree support subj ? |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Tue Jan 31, 2006 10:14 pm Post subject: |
|
|
Does Virtual Tree support label edit?
Yes you need to add a TextBox CellEditor and set it as the Editor for the main column (using the Virtual Tree designer). _________________ Infralution Support |
|
Back to top |
|
|
CNET Channel Guest
|
Posted: Wed Feb 01, 2006 4:47 pm Post subject: |
|
|
Is it possible to set and reset CellEditor dynamicaly ? |
|
Back to top |
|
|
Guest
|
Posted: Wed Feb 01, 2006 9:43 pm Post subject: |
|
|
I'm not quite sure what you mean by "set and reset"? You can setup the CellEditor programmatically - but generally you don't need to. If you set the CellEditor.DisplayMode to OnEdit then the editor is only displayed when the user clicks on the label. If you want behaviour similar to Windows explorer where the user has to first select the label and then click again to start editing then set the SelectBeforeEdit property to true. |
|
Back to top |
|
|
CNET Channel Guest
|
Posted: Thu Feb 02, 2006 9:00 am Post subject: |
|
|
Thnaks for your response !
But I have several question:
1) Could I initiate editing mode programatically
2) Could I set editor only for several rows, because I have no need to edit some rows at all.
Thanks. |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Thu Feb 02, 2006 11:28 am Post subject: |
|
|
Quote: | Could I initiate editing mode programatically |
Yes you can call EditFirstCellInFocusRow. If the user presses F2 Virtual Tree calls this function.
Quote: | Could I set editor only for several rows, because I have no need to edit some rows at all. |
Yes you can either set an editor for a column (which means that all rows in that column will have that editor) or you can set the editor in the CellBinding for specific rows. _________________ Infralution Support |
|
Back to top |
|
|
CNET Channel Guest
|
Posted: Thu Feb 09, 2006 6:24 am Post subject: |
|
|
could you explain or post code example how spesify UniversalEditBox for the custom row. I've just found how to set it to the whole column (Column.CellEditor = new CellEditor(new UniversalEditBox())
Thanks. |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Thu Feb 09, 2006 8:19 am Post subject: |
|
|
Normally you would set up the Cell Editor at design time in the VirtualTree designer (right click on the control and select "Edit Virtual Tree"). You select the Editors tab and use the buttons to create a new editor. To associate the editor with a column you select the Columns tab, select the column and set the CellEditor property to the CellEditor you just created.
To associate a CellEditor with a row/cell (instead of a whole column) you select the Data Binding tab, expand the RowBinding to see the CellBindings, select the CellBinding and set the Editor property. If you are not using RowBindings (ie you are using programmatic binding) then you will have to set the CellData.CellEditor programmatically in the GetCellData event/method _________________ Infralution Support |
|
Back to top |
|
|
CNET Channel Guest
|
Posted: Thu Feb 09, 2006 12:17 pm Post subject: |
|
|
Thnaks, works fine !
But now I can't receive event on EndEdit in TextBox... |
|
Back to top |
|
|
CNET Channel Guest
|
Posted: Thu Feb 09, 2006 12:35 pm Post subject: |
|
|
I'm trying to set up editor at the GetCellDate Event :
UniversalEditBox editBox = new UniversalEditBox();
e.CellData.Editor = new CellEditor(editBox);
editBox.ValueChanged += new EventHandler(editBox_ValueChanged);
e.CellData.Editor.UpdateValueEventName = "ValueChanged";
e.CellData.Editor.UpdateValueEvent = editBox.GetType().GetEvent("ValueChanged");
but editBox_ValueChanged never calls ... |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Thu Feb 09, 2006 9:41 pm Post subject: |
|
|
It is best not to create the UniversalEditBox and CellEditor in the GetCellData event. Creating controls is an expensive operation. The way you have done this will mean that an editor control has to be created for each and every cell displayed (whether an editor is required or not). That is why you usually use the designer to create them at design time. If you don't want to do this you should still create them in the constructor and hold a reference to them in a member variable.
The editor control that is created when you add a an editor in the Virtual Tree designer is a template for the actual controls (there may be many) that are created as needed by Virtual Tree. This means that you can't simply attach an event handler to the template control. Instead Virtual Tree provides a mechanism to allow you to Initialize the editor controls when they are created and this is where you can attach handlers for the controls events.
To do this you add a handler to the CellEditor InitializeControl event. This event is called each time a control is used (the NewControl flag indicates whether the control is being used/created for the first time).
See the following thread for more info:
http://www.infralution.com/phpBB2/viewtopic.php?t=284&highlight=initializecontrol _________________ Infralution Support |
|
Back to top |
|
|
CNET Channel Guest
|
Posted: Fri Feb 10, 2006 7:53 am Post subject: |
|
|
Thanks !
And the last question I think
How to increase delay between two mouse clicks those call EditFirstCellInFocusRow() ?
Is it possible to disable this feature, I mean rename by mouse clicks ? |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Fri Feb 10, 2006 8:08 am Post subject: |
|
|
I assume here you have SelectBeforeEdit enabled and you want to have a delay before you can eidt - is this correct?
You could disable editing via mouse selection by deriving your own CellWidget class and overriding OnMouseDown as follows:
Code: |
public override void OnMouseDown(MouseEventArgs e)
{
Tree.OnCellMouseDown(this, e);
RowWidget.OnMouseDown(e);
}
|
This omits the code that normally initiates the edit.
Code: | if (Editable && e.Button == MouseButtons.Left)
{
if (!Tree.SelectBeforeEdit || rowSelected)
{
Tree.EditWidget = this;
}
} |
To get VirtualTree to use your new CellWidget class you need to derive a new VirtualTree class and override CreateCellWidget(). You could probably also implement a delay by recording the time at which the mouse is pressed and only calling the code to initiate an edit if the last time is greater than a certain value. _________________ Infralution Support |
|
Back to top |
|
|
CNET Channel Guest
|
Posted: Fri Feb 10, 2006 2:30 pm Post subject: |
|
|
Thanks, for your response.
But I think it will be more user friendly to implement the same aproach as in windows explorer.
Now editing begins after ordinary double click.
Do you plan to fix it in future release ? |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Sun Feb 12, 2006 9:01 am Post subject: |
|
|
OK I see what you mean. We will look at changing this in a future release. _________________ Infralution Support |
|
Back to top |
|
|
|