Page 1 of 1

error: no matching function to call

Posted: Sun Jan 25, 2015 6:32 am
by laikokman
newbie here, how to solve this ? i followed exactly the youtube video

error: no matching function to call my_wxclientdc::DrawRotatedText
im Using codeblock +wxSmith to build

RotatedText tmp_dlg(this);
int dlg=tmp_dlg.ShowModal();
if(dlg==wxID_OK)
{
my_wxclientdc->DrawRotatedText(tmp_dlg.Text)->GetValue().tmp_dlg.X->GetValue(),tmp_dlg.Y->GetValue(),tmp_dlg.Angle->GetValue();
}
}

regard
Mavis

Re: error: no matching function to call

Posted: Sun Jan 25, 2015 9:02 am
by PB
The function signature is

Code: Select all

void DrawRotatedText (const wxString &text, wxCoord x, wxCoord y, double angle)
It looks as if your call does not match it:

Code: Select all

my_wxclientdc->DrawRotatedText(tmp_dlg.Text)->GetValue().tmp_dlg.X->GetValue(),tmp_dlg.Y->GetValue(),tmp_dlg.Angle->GetValue();
There are several issues, for example:
1. Invalid syntax, such as wrongly placed parenthesis and a period used when a comma is expected, e.g.
"my_wxclientdc->DrawRotatedText(tmp_dlg.Text)->GetValue(). <snipped>"
should be
"my_wxclientdc->DrawRotatedText(tmp_dlg.Text->GetValue(), <snipped>"

2. If tmp_dlg.X, tmp_dlg.Y and tmp_dlg.Angle are wxTextCtrls, they will return wxStrings and not wxCoords and a double. If they are wxSpinCtrl(Double) than it should work.

Somewhat unrelated but still true. Generally speaking, you should not draw anything in the event handler, because anything you draw there will be erased by the next window refresh. The recommended procedure is to draw everything in your wxPaintEvent handler and in other code only collect/update the data and call Refresh() and Update() to redraw the window.

Re: error: no matching function to call

Posted: Sun Mar 01, 2015 8:53 am
by laikokman
thanks,its really solve my problem. but when i click the OK button the dialog wont show . what cause this ? thank you :D