Home - Forums-.NET - FlyGrid.Net (Windows Forms) - Why is it possible to edit dropdown list box.

FlyGrid.Net (Windows Forms)

.NET Datagrid - Fast, highly customizable, industry standards .NET data grid control for WinForms

This forum related to following products: FlyGrid.Net

Why is it possible to edit dropdown list box.
Link Posted: 04-May-2006 08:44
Hello!

I have a flygrid with some columns and some rows.

Some column in the flygrid is a kind of dropdown list box where you can select some items from the list.

The problem is that I can edit in the same cell field where the dropdown list box is.

If I look at the flygrid demo I can find the same kind of problem here on every flygrid.

I want to set select only from the dropdown list box without any
possibility to edit anything in the cell where the dropdown list box.

Is it possible that the flygrid doesn't support that.

//Tony
Link Posted: 07-May-2006 22:39
You can override Column.MakeEditorReadOnly to 'lock' inplace editor:
[c#]
public ColumnWithNonEditableDropdown : Column
{
  public ColumnWithNonEditableDropdown() : base(){}
  public ColumnWithNonEditableDropdown(string name) : base(name){}  
  public ColumnWithNonEditableDropdown(string name, string fieldName) : base(name, fieldName){}
  
  private bool dropdownNonEditable = true;
  
  [DefaultValue(true)]
  public bool DropdownNonEditable
  {
    get
    {
        return dropdownNonEditable;
    }
    set
    {
      dropdownNonEditable = value;
    }
  }
  
  public override bool MakeEditorReadOnly(NodeBase node)
  {
    return (EditorStyle == EditorStyle.DropDown || EditorStyle == EditorStyle.DropDownResizable) ?
    dropdownNonEditable :
    base.MakeEditorReadOnly(node);
  }
}