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: 2434
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

User avatar
mjfmechanic
In need of some credit
In need of some credit
Posts: 3
Joined: Wed Jun 03, 2020 6:06 pm

Re: error: no matching function to call

Post by mjfmechanic » Wed Jun 03, 2020 6:21 pm

Since I've been messing around with this video also, the problem is the font background color. While the documentation states that on windows you need to choose something other than the system font, it doesn't say how to accomplish it. I wish they had code examples for every piece of documentation like C++ does, that would be really helpful, however here is the fix.

In the RotatedText.wxs, choose the Text control with identifier ID_TEXTCTRL1, scroll down until you see the background color, on the drop down menu choose the "Text in window caption" option.

Also, not sure if it was just on my CodeBlocks while compiling, you also need to create this line in RotatedText.cpp if it's not there or refers to an onInit error with RotatedText.

void RotatedText::OnInit(wxInitDialogEvent& event)
{
}

Video of reference is here: https://www.youtube.com/watch?v=aPdzPPQ ... pY&index=3

Hope it helps!

Post Reply