Filament ComboBox editor updates

-Add show drop down feature to ObjectTable
-Call finish editing when ComboBox is closed in ObjectList
This commit is contained in:
Ocraftyone 2023-11-27 07:02:43 -05:00
parent d13bbb1890
commit 07a637d35a
No known key found for this signature in database
GPG key ID: 85836ED21AD4D125
2 changed files with 9 additions and 1 deletions

View file

@ -5486,9 +5486,11 @@ void ObjectList::ItemValueChanged(wxDataViewEvent &event)
// Here the last active column is forgotten, so when leaving the editing mode, the next mouse click will not enter the editing mode of the newly selected column. // Here the last active column is forgotten, so when leaving the editing mode, the next mouse click will not enter the editing mode of the newly selected column.
void ObjectList::OnEditingStarted(wxDataViewEvent &event) void ObjectList::OnEditingStarted(wxDataViewEvent &event)
{ {
// Orca: Automatically show drop down on editing start and finish editing when the combobox is closed
if (event.GetColumn() == colFilament) { if (event.GetColumn() == colFilament) {
::ComboBox*c = static_cast<::ComboBox *>(event.GetDataViewColumn()->GetRenderer()->GetEditorCtrl()); ::ComboBox*c = static_cast<::ComboBox *>(event.GetDataViewColumn()->GetRenderer()->GetEditorCtrl());
c->ToggleDropDown(); c->ToggleDropDown();
c->Bind(wxEVT_COMBOBOX_CLOSEUP, [event](wxCommandEvent& evt){ event.GetDataViewColumn()->GetRenderer()->FinishEditing(); });
} }
#ifdef __WXMSW__ #ifdef __WXMSW__
m_last_selected_column = -1; m_last_selected_column = -1;

View file

@ -240,6 +240,9 @@ void GridCellFilamentsEditor::BeginEdit(int row, int col, wxGrid* grid)
Combo()->SetFocus(); Combo()->SetFocus();
// Orca: Show dropdown on editing start
Combo()->ToggleDropDown();
#ifdef __WXOSX_COCOA__ #ifdef __WXOSX_COCOA__
// This is a work around for the combobox being simply dismissed when a // This is a work around for the combobox being simply dismissed when a
// choice is made in it under OS X. The bug is almost certainly due to a // choice is made in it under OS X. The bug is almost certainly due to a
@ -432,6 +435,9 @@ void GridCellChoiceEditor::BeginEdit(int row, int col, wxGrid *grid)
Combo()->SetFocus(); Combo()->SetFocus();
// Orca: Show dropdown on editing start
Combo()->ToggleDropDown();
#ifdef __WXOSX_COCOA__ #ifdef __WXOSX_COCOA__
// This is a work around for the combobox being simply dismissed when a // This is a work around for the combobox being simply dismissed when a
// choice is made in it under OS X. The bug is almost certainly due to a // choice is made in it under OS X. The bug is almost certainly due to a
@ -528,7 +534,7 @@ void GridCellComboBoxRenderer::Draw(wxGrid &grid, wxGridCellAttr &attr, wxDC &dc
dc.SetPen(*wxTRANSPARENT_PEN); dc.SetPen(*wxTRANSPARENT_PEN);
dc.SetBrush(wxBrush(attr.GetBackgroundColour())); dc.SetBrush(wxBrush(attr.GetBackgroundColour()));
dc.DrawRectangle(rect); dc.DrawRectangle(rect);
dc.DrawBitmap(bitmap->GetBitmapFor(dc.GetWindow()), wxPoint(rect.x + offset_x, rect.y + offset_y)); //TODO: determine if this way of getting bitmap works well dc.DrawBitmap(bitmap->GetBitmapFor(dc.GetWindow()), wxPoint(rect.x + offset_x, rect.y + offset_y));
text_rect.x += bitmap_width + grid_cell_border_width * 2; text_rect.x += bitmap_width + grid_cell_border_width * 2;
text_rect.width -= (bitmap_width + grid_cell_border_width * 2); text_rect.width -= (bitmap_width + grid_cell_border_width * 2);
} }