Home - Forums-.NET - FlyGrid.Net (Windows Forms) - HowTo OR Feature Request

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

HowTo OR Feature Request
Link Posted: 03-Aug-2006 07:14
Consider the \"Priority\" column in your Tree/ListView Sample App...

Notice that it takes 2 clicks in the cell to make visible and dropdown the list of items. Also, when the user's made their selection, the dropdown button remains visible in the cell. All of this is tedious, inefficient and unsightly, IMHO.

Can you (either or both...) (1) suggest the best way to enable dropping-down the item list on the first click and removing the dropdown button visual  automatically after the user has selected an item in the list (or not) and (2) add these two abilities to FlyGrid ?

Thanks.
Link Posted: 03-Aug-2006 10:06
1. In the nearest FlyGrid.Net update DropDownColumn will contain DropDownListOnCellClick property (default value = false) that will allow you to automatically dropdown list when user click on the cell of this column.
2. You can use followin DropdownListColumn inheritor that automatically drop downs list (when DropDownListOnCellClick property is true) and hides dropdown button when value is selected and stored in the edited cell:
[c#]
public class AutoDropDownListColumn : DropDownListColumn
{
  public AutoDropDownListColumn() : base()
  {
  }
  public AutoDropDownListColumn(string name) : base(name)
  {
  }
  public AutoDropDownListColumn(string name, string fieldName) : base(name, fieldName)
  {
  }
  private bool dropDownListOnCellClick = false;
  [DefaultValue(false)]
  public virtual bool DropDownListOnCellClick
  {
    get {return dropDownListOnCellClick;}
    set
    {
      dropDownListOnCellClick = value;
    }
  }
  public override bool OnCellClick(FlyGrid grid, NodeBase node, Point clickPt)
  {
    if (grid != null && DropDownListOnCellClick)
    {
      IDropDownService dds = (grid as IServiceProvider).GetService(typeof(IDropDownService)) as IDropDownService;
      if (dds != null)
      {
        object[] values = GetValueList(node);
        if (values != null && values.Length > 0)
        {
          object currentValue = base.GetValue(node);
          dds.DropDownValuesList(currentValue, this, values);
          grid.ActivePort.EndEdit(true);
          return true;
        }
      }
    }
    return false;
  }
}
Link Posted: 03-Aug-2006 20:27
Thanks!