Hide dialog before running picker tool.

(If the user were to close the dialog in between,
we'd be in a world of hurt.)
This commit is contained in:
Jeff Young 2025-07-29 12:37:44 +01:00
parent 0128fb2eaf
commit 606a5c7d21
2 changed files with 13 additions and 13 deletions

View File

@ -253,28 +253,27 @@ void DIALOG_CREATE_ARRAY::OnSelectCenterButton( wxCommandEvent& event )
{
event.Skip();
PCB_PICKER_TOOL* pickerTool = m_frame->GetToolManager()->GetTool<PCB_PICKER_TOOL>();
TOOL_MANAGER* toolMgr = m_frame->GetToolManager();
PCB_PICKER_TOOL* pickerTool = toolMgr->GetTool<PCB_PICKER_TOOL>();
wxCHECK( pickerTool, /* void */ );
// Hide, but do not close, the dialog
Hide();
if( event.GetEventObject() == m_btnSelectCenterItem )
{
m_frame->GetToolManager()->RunAction(
PCB_ACTIONS::selectItemInteractively,
PCB_PICKER_TOOL::INTERACTIVE_PARAMS{ this, _( "Select center item..." ) } );
toolMgr->RunAction( PCB_ACTIONS::selectItemInteractively,
PCB_PICKER_TOOL::INTERACTIVE_PARAMS { this, _( "Select center item..." ) } );
}
else if( event.GetEventObject() == m_btnSelectCenterPoint )
{
m_frame->GetToolManager()->RunAction(
PCB_ACTIONS::selectPointInteractively,
PCB_PICKER_TOOL::INTERACTIVE_PARAMS{ this, _( "Select center point..." ) } );
toolMgr->RunAction( PCB_ACTIONS::selectPointInteractively,
PCB_PICKER_TOOL::INTERACTIVE_PARAMS { this, _( "Select center point..." ) } );
}
else
{
wxFAIL_MSG( "Unknown event source" );
}
// Hide, but do not close, the dialog
Hide();
}

View File

@ -231,10 +231,11 @@ void DIALOG_POSITION_RELATIVE::OnSelectPointClick( wxCommandEvent& event )
PCB_PICKER_TOOL* pickerTool = m_toolMgr->GetTool<PCB_PICKER_TOOL>();
wxCHECK( pickerTool, /* void */ );
m_toolMgr->RunAction( PCB_ACTIONS::selectPointInteractively,
PCB_PICKER_TOOL::INTERACTIVE_PARAMS{ this, _( "Select reference point..." ) } );
// Hide, but do not close, the dialog
Hide();
m_toolMgr->RunAction( PCB_ACTIONS::selectPointInteractively,
PCB_PICKER_TOOL::INTERACTIVE_PARAMS { this, _( "Select reference point..." ) } );
}