Cancel autocomplete when STC loses focus.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/17124

(cherry picked from commit 539bd62a7b)
This commit is contained in:
Jeff Young 2024-02-26 22:28:53 +00:00
parent 50c5b56781
commit 5b303b268f
5 changed files with 11 additions and 0 deletions

View File

@ -630,6 +630,12 @@ void PROPERTIES_FRAME::onScintillaCharAdded( wxStyledTextEvent &aEvent )
}
void PROPERTIES_FRAME::onScintillaFocusLost( wxFocusEvent& aEvent )
{
m_stcText->AutoCompCancel();
}
void PROPERTIES_FRAME::onHelp( wxCommandEvent& aEvent )
{
// Show the system variables for worksheet text:

View File

@ -84,6 +84,7 @@ public:
void OnAcceptPrms( wxCommandEvent& event ) override;
void OnSetDefaultValues( wxCommandEvent& event ) override;
void onScintillaCharAdded( wxStyledTextEvent &aEvent );
void onScintillaFocusLost( wxFocusEvent& aEvent ) override;
void onHelp( wxCommandEvent& aEvent ) override;
void onHAlignButton( wxCommandEvent &aEvent );
void onVAlignButton( wxCommandEvent &aEvent );

View File

@ -631,6 +631,7 @@ PANEL_PROPERTIES_BASE::PANEL_PROPERTIES_BASE( wxWindow* parent, wxWindowID id, c
// Connect Events
m_notebook->Connect( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, wxNotebookEventHandler( PANEL_PROPERTIES_BASE::OnPageChanged ), NULL, this );
m_buttonHelp->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PROPERTIES_BASE::onHelp ), NULL, this );
m_stcText->Connect( wxEVT_KILL_FOCUS, wxFocusEventHandler( PANEL_PROPERTIES_BASE::onScintillaFocusLost ), NULL, this );
m_buttonOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PROPERTIES_BASE::OnAcceptPrms ), NULL, this );
m_buttonDefault->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PROPERTIES_BASE::OnSetDefaultValues ), NULL, this );
m_buttonGeneralOptsOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PROPERTIES_BASE::OnAcceptPrms ), NULL, this );
@ -641,6 +642,7 @@ PANEL_PROPERTIES_BASE::~PANEL_PROPERTIES_BASE()
// Disconnect Events
m_notebook->Disconnect( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, wxNotebookEventHandler( PANEL_PROPERTIES_BASE::OnPageChanged ), NULL, this );
m_buttonHelp->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PROPERTIES_BASE::onHelp ), NULL, this );
m_stcText->Disconnect( wxEVT_KILL_FOCUS, wxFocusEventHandler( PANEL_PROPERTIES_BASE::onScintillaFocusLost ), NULL, this );
m_buttonOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PROPERTIES_BASE::OnAcceptPrms ), NULL, this );
m_buttonDefault->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PROPERTIES_BASE::OnSetDefaultValues ), NULL, this );
m_buttonGeneralOptsOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PROPERTIES_BASE::OnAcceptPrms ), NULL, this );

View File

@ -468,6 +468,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnKillFocus">onScintillaFocusLost</event>
</object>
</object>
<object class="sizeritem" expanded="true">

View File

@ -151,6 +151,7 @@ class PANEL_PROPERTIES_BASE : public wxPanel
// Virtual event handlers, override them in your derived class
virtual void OnPageChanged( wxNotebookEvent& event ) { event.Skip(); }
virtual void onHelp( wxCommandEvent& event ) { event.Skip(); }
virtual void onScintillaFocusLost( wxFocusEvent& event ) { event.Skip(); }
virtual void OnAcceptPrms( wxCommandEvent& event ) { event.Skip(); }
virtual void OnSetDefaultValues( wxCommandEvent& event ) { event.Skip(); }