Question about wClipboard

MaxGaspa nospam at it.sunsite.dk
Mon Dec 3 14:23:02 PST 2007


Hi *,

I'm trying to use the clipboard using wxWidget 2.8.7, I am using this 
code to add text into the clipboard

void SqlListCtrlFrame::OnCopyAll( wxCommandEvent& event )
{

  if (wxTheClipboard->Open())
   {
     wxTheClipboard->Clear();
     wxTheClipboard->AddData(new wxTextDataObject(wxT("aaa")) );
     wxTheClipboard->AddData(new wxTextDataObject(wxT("bbbb")) );

     wxTheClipboard->Flush();
     wxTheClipboard->Close();
   }

}

My understanding is that using AddData I "add" data to clipboard.

With the code above the clipboard content is "bbbb" only. The "aaa" 
string is lost. It seems (to me) that AddData() works like SetData().
I.e. like if Clear() is called before any AddData().

If I try to add more data all the string are lost but the last one.

Where am I wrong? Which mistake am I doing?

Any help is welcome. Thx

Max






More information about the wx-users mailing list