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
error: no matching function to call
Re: error: no matching function to call
The function signature is
It looks as if your call does not match it:
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.
Code: Select all
void DrawRotatedText (const wxString &text, wxCoord x, wxCoord y, double angle)
Code: Select all
my_wxclientdc->DrawRotatedText(tmp_dlg.Text)->GetValue().tmp_dlg.X->GetValue(),tmp_dlg.Y->GetValue(),tmp_dlg.Angle->GetValue();
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
thanks,its really solve my problem. but when i click the OK button the dialog wont show . what cause this ? thank you 

- mjfmechanic
- In need of some credit
- Posts: 3
- Joined: Wed Jun 03, 2020 6:06 pm
Re: error: no matching function to call
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!
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!