Reputation: 4115
I am trying to open a wxFileDialog in MyApp::OnInit(), but I end up with an error message saying "no matching function for call to ‘wxFileDialog::wxFileDialog(MyApp* const, const char [12], const wxChar*&, const wxChar*&, const char [6], )".
MyApp::OnInit()
{
wxFileDialog dialog2(this, _T("open a file"), wxEmptyString, wxEmptyString, _T("*.csv"), wxFD_OPEN);
dialog2.ShowModal();
... open the file and then do something ...
}
The idea is to allow the user to open a config file before the program starts. Can anyone offer some advice to this problem?
Thanks.
Upvotes: 0
Views: 337
Reputation: 34625
According to wxWidgets documenation, the macro _T()
is different from _()
. So, try just with _
while passing the arguments.
wxFileDialog dialog2(this,
_("open a file"),
wxEmptyString,
wxEmptyString,
_("*.csv"),
wxFD_OPEN);
Upvotes: 0
Reputation: 1821
The problem is your first parameter, the dialog parent, it expects a wxWindow*
but you are passing a MyApp*
. Since you don't have a parent just pass NULL
instead.
wxFileDialog dialog2(NULL, _T("open a file"), wxEmptyString, wxEmptyString, _T("*.csv"), wxFD_OPEN);
Upvotes: 1