This project is read-only.

Open combo box

Mar 25, 2011 at 12:05 AM

I have a cell defined as a combo box.  When it is displayed in the grid, the value of the selected item is displayed along with the arrow to 'open' the combo box; however, when you click the arrow, a smaller combo box appears at the top of the cell.  You then have to click that combo box arrow to open it.

I would like the user to only have to click once to open the combo box.  Anybody have a suggestion on how to do that?

Thanks!

Mar 25, 2011 at 6:57 AM

You obviously made something wrong here. Examples show how to use a combobox, try to compare your code with that from the examples.

Apr 11, 2011 at 10:46 PM

Darias,

Thanks for the reply.  I don't think I did anything wrong. 

Example 54 defines the combobox cell as:

    grid1[r, 3] = new SourceGrid.Cells.Cell("Value 1", cbEditor);
    grid1[r, 3].View = SourceGrid.Cells.Views.ComboBox.Default;

My combobox cell is defined as:

    grid[row, RISK] = new SourceGrid.Cells.Cell ("", riskEditor);
    grid[row, RISK].View = new SourceGrid.Cells.Views.ComboBox();

The example 54 combobox editor is defined as:

   SourceGrid.Cells.Editors.ComboBox cbEditor = new SourceGrid.Cells.Editors.ComboBox(typeof(string));
   cbEditor.StandardValues = new string[]{"Value 1", "Value 2", "Value 3"};
   cbEditor.EditableMode = SourceGrid.EditableMode.Focus | SourceGrid.EditableMode.SingleClick | SourceGrid.EditableMode.AnyKey;

My editor is defined as:           

    riskEditor = new SourceGrid.Cells.Editors.ComboBox(typeof(string), RISK_VALUES, false);
    riskEditor.StandardValues = RISK_VALUES;
    riskEditor.EnableEdit = view.UserPrivledge != UserData.PrivledgeType.ReadOnly && view.UserPrivledge != UserData.PrivledgeType.Developer;
    riskEditor.EditableMode = EditableMode.Default | EditableMode.SingleClick | EditableMode.AnyKey;

So what did I do wrong?  I thnk nothing.  I believe that the issue is related to the fact that the combobox is a standard windows combobox.  The combobox activates at the default combobox height which in both the example and in my case, smaller than the height of the cell.

In example 54, you can see the bottom of the SourceGrid combo box cell at the right side of the cell under the standard combobox.  In my case the cell height is bigger in most cases so you get to see the original SourceGrid combobox display and then the standard combobox on top of it.  I couldn't figure out how to include images in this post or I would have.