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();


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

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

Re: error: no matching function to call

Posted: Wed Jun 03, 2020 6:21 pm
by mjfmechanic
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: ... pY&index=3

Hope it helps!