User (Old forums)MemberSeptember 20, 2007 at 2:11 pmPost count: 23064
Hi this is a slightly different problem than another one I created recently.
I have a CellEditorManager that displays a ComboBox dropdown. The cells are very small — they show an icon based on the cell value. After selecting a new value for the cell from the dropdown, The dropdown arrow [v] takes up the whole cell and the icon is not displayed until the user clicks elsewhere.
How can I accept the selection-change value and dismiss the dropdown after the user selects a dropdown entry? Thanks for your help in this matter.
Imported from legacy forums. Posted by camera (had 3310 views)User (Old forums)MemberSeptember 21, 2007 at 1:32 pmPost count: 23064
*shuffle feet. look around.*
Imported from legacy forums. Posted by camera (had 255 views)User (Old forums)MemberSeptember 21, 2007 at 4:27 pmPost count: 23064
I see three solutions. First, make the cell leave edition once the user has made his selection. Second hide the dropdown button, but then, the user will not be able to drop the control again, until you show the button again. Third, increase the width of the column while a cell in that column is in edition, and reset it to its original size as soon as the cell leaves edition.
Here is the code for the first solution :
<code> void cboEditor_ActivatingControl( object sender, CellEditorEventArgs e )
( ( WinComboBox )e.Control ).DroppedDownChanged += new EventHandler( Form1_DroppedDownChanged );
void Form1_DroppedDownChanged( object sender, EventArgs e )
if( !( ( WinComboBox )sender ).DroppedDown )
gridControl1.CurrentCell.LeaveEdit( true );
void cboEditor_DeactivatingControl( object sender, CellEditorEventArgs e )
//need to unsubscribe because it gets subscribed to every time the editor is activated
( ( WinComboBox )e.Control ).DroppedDownChanged -= new EventHandler( Form1_DroppedDownChanged );
Here is the code you can use for the third solution :
<code> private static int origninalWidth = 0;
void Form1_EnteringEdit( object sender, EnteringEditEventArgs e )
origninalWidth = ( ( DataCell )sender ).ParentColumn.Width;
( ( DataCell )sender ).ParentColumn.Width = origninalWidth + 20;
void Form1_LeavingEdit( object sender, LeavingEditEventArgs e )
( ( DataCell )sender).ParentColumn.Width = origninalWidth;
You can combine the two if you want.
Imported from legacy forums. Posted by André (had 278 views)User (Old forums)MemberSeptember 24, 2007 at 6:18 amPost count: 23064
Thanks (and options too, wow.) I used the grid.CurrentCell.LeaveEdit(true) method and it’s working fine. This suits the UI for my app much better if the cell is updated and the editor disappears immediately after a dropdown item is selected. Thanks for your help in this!
Imported from legacy forums. Posted by camera (had 4670 views)
- You must be logged in to reply to this topic.