cannot drop on wxGrid with wxmac2.9

Riccardo Cohen rcohen at articque.com
Fri Feb 22 01:57:10 PST 2008


Hi
I try to drag and drop some file on a wxGrid, and it works on windows 
but not on mac (see code below)
When I drop a file from the system on the text control, the file name 
appears, but on the grid nothing happens.
It is the same if I drag a text from a list box for instance

on windows it works.

If someone has a workaround, I'd appreciate very much.
Thanks

class mydroptarget:public wxFileDropTarget
{
public:
   testframe *m_frame;
   mydroptarget(testframe *frame){m_frame=frame;}
   virtual bool OnDropFiles(wxCoord x, wxCoord y, const wxArrayString& 
filenames)
     {m_frame->text->SetValue(filenames[0]);return(true);}
};

void testframe::CreateControls()
{
////@begin testframe content construction
     testframe* itemFrame1 = this;

     wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
     itemFrame1->SetSizer(itemBoxSizer2);

     text = new wxTextCtrl( itemFrame1, ID_TEXTCTRL1, _T(""), 
wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE );
     itemBoxSizer2->Add(text, 1, wxGROW|wxALL, 5);

     grid = new wxGrid( itemFrame1, ID_GRID1, wxDefaultPosition, 
wxSize(200, 150), wxSUNKEN_BORDER|wxHSCROLL|wxVSCROLL );
     grid->SetDefaultColSize(50);
     grid->SetDefaultRowSize(25);
     grid->SetColLabelSize(25);
     grid->SetRowLabelSize(50);
     grid->CreateGrid(5, 5, wxGrid::wxGridSelectCells);
     itemBoxSizer2->Add(grid, 1, wxGROW|wxALL, 5);

////@end testframe content construction
text->SetDropTarget(new mydroptarget(this));
grid->SetDropTarget(new mydroptarget(this));
}

-- 
Très cordialement,

Riccardo Cohen
-------------------------------------------
Articque
http://www.articque.com
149 av Général de Gaulle
37230 Fondettes - France
tel : 02-47-49-90-49
fax : 02-47-49-91-49





More information about the wx-users mailing list