Hi,Is there a way of adding a button to a tree cell without using EditorWithText classs ?The main reason why I want to do this is that I want the cell to contain only the button without textbox.If I use e.g. EditorWithText the cell value is also editable unless AllowCellEdit property is set to a value that do not allow it, but then the button is in read only state too.
Regards,
Pawel
I just checked because I wasn't sure how the cell's read-only status affected the buttons; if the column's AllowCellEdito property is set to 'ReadOnly', the button's Click event will still fire when the button is clicked.
I checked it again with AllowCellEdit property set to ReadOnly. It turned out that what you wrote is true when the TextBox has focus and displays a prompt char, but it requires user to click first on a text and then on editors' associated button.Is there any other way of adding a CLICKABLE button to a tree cell besides implementing a custom EmbbedableEditor? If there isn't any could you give me some tips how to implement such editor?ps. I'm using NetAdvantage v8.3 (2021).
Regards,Pawel
Yes, I see now that you did mention you wanted the button to cover the whole cell, sorry I rushed over that part. I was able to hack this out by changing AllowCellEdit as the cell goes in an out of edit mode:
EditorWithText editor = new EditorWithText();column.Editor = editor;editor.ButtonsLeft.Add(button);editor.BeforeEnterEditMode += new CancelEventHandler(editor_BeforeEnterEditMode);editor.BeforeExitEditMode += new BeforeExitEditModeEventHandler(editor_BeforeExitEditMode);editor.EditorButtonClick += new Infragistics.Win.UltraWinEditors.EditorButtonEventHandler(editor_EditorButtonClick);
void editor_BeforeExitEditMode(object sender, BeforeExitEditModeEventArgs e){ EmbeddableEditorBase editor = sender as EmbeddableEditorBase; this.OnEditModeChanged( editor, false );}
void editor_BeforeEnterEditMode(object sender, CancelEventArgs e){ EmbeddableEditorBase editor = sender as EmbeddableEditorBase; this.OnEditModeChanged( editor, true );}
private void OnEditModeChanged( EmbeddableEditorBase editor, bool entering ){ EmbeddableUIElementBase embeddableElement = editor != null ? editor.ElementBeingEdited : null; UltraTreeNodeCellUIElement cellElement = embeddableElement.GetAncestor( typeof(UltraTreeNodeCellUIElement) ) as UltraTreeNodeCellUIElement; if ( cellElement != null ) cellElement.Column.AllowCellEdit = entering ? AllowCellEdit.ReadOnly : AllowCellEdit.Full;}
Thanks for the workaround, works like a charm!