error: no matching function to call

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
laikokman
In need of some credit
In need of some credit
Posts: 6
Joined: Wed Jan 21, 2015 7:20 pm

error: no matching function to call

Post by laikokman » Sun Jan 25, 2015 6:32 am

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

PB
Part Of The Furniture
Part Of The Furniture
Posts: 2386
Joined: Sun Jan 03, 2010 5:45 pm

Re: error: no matching function to call

Post by PB » Sun Jan 25, 2015 9:02 am

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.

laikokman
In need of some credit
In need of some credit
Posts: 6
Joined: Wed Jan 21, 2015 7:20 pm

Re: error: no matching function to call

Post by laikokman » Sun Mar 01, 2015 8:53 am

thanks,its really solve my problem. but when i click the OK button the dialog wont show . what cause this ? thank you :D

Post Reply