Try to make wxClipboard::Flush() test in sample actually useful
Calling Flush() before putting anything on the clipboard didn't make much sense. See https://github.com/wxWidgets/wxWidgets/pull/1316
This commit is contained in:
@@ -143,10 +143,28 @@ MyFrame::MyFrame(const wxString& title)
|
|||||||
|
|
||||||
void MyFrame::OnFlush(wxCommandEvent &WXUNUSED(event))
|
void MyFrame::OnFlush(wxCommandEvent &WXUNUSED(event))
|
||||||
{
|
{
|
||||||
if ( wxTheClipboard->Flush() )
|
wxClipboardLocker clipLock;
|
||||||
m_textctrl->SetValue( "Clipboard flushed successfully!!\n" );
|
|
||||||
else
|
if ( !clipLock )
|
||||||
m_textctrl->SetValue( "Flushing clipboard failed!!\n" );
|
{
|
||||||
|
m_textctrl->AppendText("Failed to lock clipboard.\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !wxTheClipboard->AddData(new wxTextDataObject("Text from wx clipboard sample")) )
|
||||||
|
{
|
||||||
|
m_textctrl->AppendText("Failed to put text on clipboard.\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !wxTheClipboard->Flush() )
|
||||||
|
{
|
||||||
|
m_textctrl->AppendText("Failed to flush clipboard.\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_textctrl->AppendText("Clipboard flushed successfully, you should now "
|
||||||
|
"be able to paste text even after closing the sample.");
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::OnWriteClipboardContents(wxCommandEvent& WXUNUSED(event))
|
void MyFrame::OnWriteClipboardContents(wxCommandEvent& WXUNUSED(event))
|
||||||
|
Reference in New Issue
Block a user