1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-09-19 17:40:51 +02:00

Workaround text controls not getting autoselected

Also fix AutoDuck so the panel doesn't get focus.
This commit is contained in:
Leland Lucius 2015-04-29 03:26:47 -05:00
parent 06a2eab9f6
commit 7950d4fd5a
3 changed files with 26 additions and 3 deletions

View File

@ -109,9 +109,7 @@ private:
none = 99, none = 99,
}; };
#if defined(__WXMAC__) && wxUSE_ACCESSIBILITY
virtual bool AcceptsFocus() const {return false;} virtual bool AcceptsFocus() const {return false;}
#endif
void OnPaint(wxPaintEvent & evt); void OnPaint(wxPaintEvent & evt);
void OnMouseCaptureChanged(wxMouseCaptureChangedEvent & evt); void OnMouseCaptureChanged(wxMouseCaptureChangedEvent & evt);

View File

@ -2605,7 +2605,7 @@ public:
// wxWindow implementation // wxWindow implementation
// ============================================================================ // ============================================================================
bool AcceptsFocus() const virtual bool AcceptsFocus() const
{ {
return mAcceptsFocus; return mAcceptsFocus;
} }
@ -2631,6 +2631,7 @@ private:
#include "../../images/Effect.h" #include "../../images/Effect.h"
BEGIN_EVENT_TABLE(EffectUIHost, wxDialog) BEGIN_EVENT_TABLE(EffectUIHost, wxDialog)
EVT_INIT_DIALOG(EffectUIHost::OnInitDialog)
EVT_ERASE_BACKGROUND(EffectUIHost::OnErase) EVT_ERASE_BACKGROUND(EffectUIHost::OnErase)
EVT_PAINT(EffectUIHost::OnPaint) EVT_PAINT(EffectUIHost::OnPaint)
EVT_CLOSE(EffectUIHost::OnClose) EVT_CLOSE(EffectUIHost::OnClose)
@ -2940,6 +2941,29 @@ bool EffectUIHost::Initialize()
return true; return true;
} }
void EffectUIHost::OnInitDialog(wxInitDialogEvent & evt)
{
// Do default handling
wxDialog::OnInitDialog(evt);
#if wxCHECK_VERSION(3, 0, 0)
#warning "check to see if this still needed in wx3"
#endif
// Pure hackage coming down the pike...
//
// I have no idea why, but if a wxTextCtrl is the first control in the
// panel, then its contents will not be automatically selected when the
// dialog is displayed.
//
// So, we do the selection manually.
wxTextCtrl *focused = wxDynamicCast(FindFocus(), wxTextCtrl);
if (focused)
{
focused->SelectAll();
}
}
void EffectUIHost::OnErase(wxEraseEvent & WXUNUSED(evt)) void EffectUIHost::OnErase(wxEraseEvent & WXUNUSED(evt))
{ {
// Ignore it // Ignore it

View File

@ -485,6 +485,7 @@ public:
bool Initialize(); bool Initialize();
private: private:
void OnInitDialog(wxInitDialogEvent & evt);
void OnErase(wxEraseEvent & evt); void OnErase(wxEraseEvent & evt);
void OnPaint(wxPaintEvent & evt); void OnPaint(wxPaintEvent & evt);
void OnClose(wxCloseEvent & evt); void OnClose(wxCloseEvent & evt);