portable SetFocus() example

This commit is contained in:
dickelbeck 2007-11-25 06:42:47 +00:00
parent 10b14fea52
commit 625ed22f6d
2 changed files with 39 additions and 14 deletions

View File

@ -47,10 +47,12 @@ IMPLEMENT_DYNAMIC_CLASS( WinEDA_PcbTracksDialog, wxDialog )
BEGIN_EVENT_TABLE( WinEDA_PcbTracksDialog, wxDialog ) BEGIN_EVENT_TABLE( WinEDA_PcbTracksDialog, wxDialog )
////@begin WinEDA_PcbTracksDialog event table entries ////@begin WinEDA_PcbTracksDialog event table entries
EVT_BUTTON( wxID_OK, WinEDA_PcbTracksDialog::OnOkClick ) EVT_BUTTON( wxID_OK, WinEDA_PcbTracksDialog::OnOkClick )
EVT_BUTTON( wxID_CANCEL, WinEDA_PcbTracksDialog::OnCancelClick ) EVT_BUTTON( wxID_CANCEL, WinEDA_PcbTracksDialog::OnCancelClick )
EVT_ACTIVATE( WinEDA_PcbTracksDialog::OnActivate )
////@end WinEDA_PcbTracksDialog event table entries ////@end WinEDA_PcbTracksDialog event table entries
END_EVENT_TABLE() END_EVENT_TABLE()
@ -69,6 +71,22 @@ WinEDA_PcbTracksDialog::WinEDA_PcbTracksDialog( WinEDA_PcbFrame* parent, wxWindo
Create(parent, id, caption, pos, size, style); Create(parent, id, caption, pos, size, style);
} }
/**
* Function OnActivate
* gets control when the dialog becomes activated.
* After creation, not during creation.
*/
void WinEDA_PcbTracksDialog::OnActivate( wxActivateEvent& event )
{
m_OptViaSize->SetFocus();
// deselect the existing text, seems SetFocus() wants to emulate Microsoft, which is not desireable here.
m_OptViaSize->SetSelection(0,0);
event.Skip();
}
/*! /*!
* WinEDA_PcbTracksDialog creator * WinEDA_PcbTracksDialog creator
*/ */

View File

@ -88,6 +88,13 @@ public:
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL /// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
void OnCancelClick( wxCommandEvent& event ); void OnCancelClick( wxCommandEvent& event );
/**
* Function OnActivate
* gets control when the dialog becomes activated.
* After creation, not during creation.
*/
void OnActivate( wxActivateEvent& event );
////@end WinEDA_PcbTracksDialog event handler declarations ////@end WinEDA_PcbTracksDialog event handler declarations
////@begin WinEDA_PcbTracksDialog member function declarations ////@begin WinEDA_PcbTracksDialog member function declarations