Question
Is it possible to define multiple combo-boxes in the grid of the gant with different values?
For example:
Column 1: Color (red, green, blue)
Column 2: User (User1, User2, User3)
When yes -> how to I have to define the combo-boxes?
Answer
The ComboBox values should be added to just before the combobox-edit-cell goes into edit mode.
The correct event to use is the Grid.OnBeforeEditCell
One possible implementation of this event looks like this:
private void grid1_OnBeforeEditCell(PlexityHide.GTP.Grid grid, PlexityHide.GTP.BeforeEditEventArgs beforeEdit)
{
if (beforeEdit.Cell.Content is ComboText)
{
(beforeEdit.Cell.Content as ComboText).EditBox.Items.Clear();
(beforeEdit.Cell.Content as ComboText).EditBox.Items.Add("Item 1");
(beforeEdit.Cell.Content as ComboText).EditBox.Items.Add("Item 2");
(beforeEdit.Cell.Content as ComboText).EditBox.Items.Add("Item 3");
(beforeEdit.Cell.Content as ComboText).EditBox.Items.Add("Item 4");
}
}
Note; in early versions of GTP.NET the beforeEdit.Cell.Content returned null in the OnBeforeEditCell event, get the latest patch to fix this issue