// Copyright: (c) Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
// Copyright: (c) Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
void OnAbout(wxCommandEvent&event);
void OnWriteClipboardContents(wxCommandEvent&event);
void OnUpdateUI(wxUpdateUIEvent&event);
void OnAbout(wxCommandEvent&event);
void OnWriteClipboardContents(wxCommandEvent&event);
void OnUpdateUI(wxUpdateUIEvent&event);
EVT_MENU(ID_About, MyFrame::OnAbout)
EVT_BUTTON(ID_Write, MyFrame::OnWriteClipboardContents)
EVT_UPDATE_UI(ID_Write, MyFrame::OnUpdateUI)
EVT_MENU(ID_About, MyFrame::OnAbout)
EVT_BUTTON(ID_Write, MyFrame::OnWriteClipboardContents)
EVT_UPDATE_UI(ID_Write, MyFrame::OnUpdateUI)
- main_sizer->Add( new wxButton( panel, ID_Write, "Get clipboard text" ) );
+ main_sizer->Add( new wxButton( panel, ID_Write, "Get clipboard text" ), 0, wxALL, 5 );
m_textctrl = new wxTextCtrl( panel, ID_Text, "", wxDefaultPosition,
wxDefaultSize, wxTE_MULTILINE );
main_sizer->Add( m_textctrl, 1, wxGROW );
panel->SetSizer( main_sizer );
}
m_textctrl = new wxTextCtrl( panel, ID_Text, "", wxDefaultPosition,
wxDefaultSize, wxTE_MULTILINE );
main_sizer->Add( m_textctrl, 1, wxGROW );
panel->SetSizer( main_sizer );
}
void MyFrame::OnClipboardChange(wxClipboardEvent&event)
{
m_clipboardSupportsText = event.SupportsFormat( wxDF_UNICODETEXT );
m_request = Finished;
}
void MyFrame::OnClipboardChange(wxClipboardEvent&event)
{
m_clipboardSupportsText = event.SupportsFormat( wxDF_UNICODETEXT );
m_request = Finished;
}
- wxTheClipboard->IsSupportedAsync( this );
+ if (!wxTheClipboard->IsSupportedAsync( this ))
+ {
+ // request failed, try again later
+ event.Enable( m_clipboardSupportsText ); // not yet known, assume last value
+ return;
+ }
else if (m_request == Waiting)
{
event.Enable( m_clipboardSupportsText ); // not yet known, assume last value
else if (m_request == Waiting)
{
event.Enable( m_clipboardSupportsText ); // not yet known, assume last value