|
Falconapollo wrote:
void execute(int &num)
{
(receiver-> *action)(num);
} There is an extra space before the * in <big>receiver-> *action</big> .
Remove that space so it reads <big>receiver->*action</big> .
This will solve the compile problem.
If your actions inspire others to dream more, learn more, do more and become more, you are a leader." - John Quincy Adams You must accept one of two basic premises: Either we are alone in the universe, or we are not alone in the universe. And either way, the implications are staggering” - Wernher von Braun
|
|
|
|
|
Thank you very much, ahmed zahmed!~
You solved my problem!
|
|
|
|
|
Hello world,
I am a rookie here, and want to learn C.
How and where should i begin??
|
|
|
|
|
A little googling may help you to find some tutorial sites - like this link[^]
|
|
|
|
|
Don't fickleness! Just learn!
|
|
|
|
|
Unless you have a need for plain C, you would probably be better ignoring it and going straight to C++ or C#. Lots of tutorials on the web, or get yourself a book. You can also get the free versions of Visual Studio here[^].
|
|
|
|
|
better learn c++, you can get free copy of "thinking in c++" online
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
C for Dummies[^]
If your actions inspire others to dream more, learn more, do more and become more, you are a leader." - John Quincy Adams You must accept one of two basic premises: Either we are alone in the universe, or we are not alone in the universe. And either way, the implications are staggering” - Wernher von Braun
|
|
|
|
|
|
|
Thanks a ton!
|
|
|
|
|
Hi all. I got a huge problem while trying to draw a text with MFC. So, i got my custom class which extends CStatic.
In OnPaint:
CPaintDC dc(this);
Gdiplus::Graphics * gfx = Gdiplus::Graphics::FromHDC(dc.GetSafeHdc());
CDC * pDC = CDC::FromHandle(gfx->GetHDC());
pDC->TextOut(0, 0, "my text");
gfx->ReleaseHDC(pDC->GetSafeHdc());
Simple. But every time OnPaint gets called - new text is drawn over old one, so it is getting bolder and bolder. And, it is not like the old one never erased, but it is erased only when there are about 5 same texts drawn over each one.
Another thing, i've tried not to use Gdiplus at all - do everything only with CDC thing - same effect. Have used DrawText - same effect. Only with Gdiplus DrawString text is drawn correctly. But i need to draw it with Gdi32.
Thanks.
011011010110000101100011011010000110100101101110
0110010101110011
|
|
|
|
|
You can try using Graphics object gfx only for drawing. No need to mix GDI and GDI+.
Instead of TextOut(), use Graphics::DrawString()
|
|
|
|
|
The problem is i cannot use Gdiplus for drawing a string because my requirement is to draw the string with exact same font which windows OS uses. Gdiplus produce different font even if you do:
HFONT hFOnt = ::GetStockObject(DEFAULT_GUI_FONT);
and then create Gdiplus::Font from hFont. In theory you should have default font and maybe you do have, but DrawString draws text with a different font, not system default.
011011010110000101100011011010000110100101101110
0110010101110011
|
|
|
|
|
Use TextOut() or DrawText() function of CDC. Clear the earlier text with null string and then use drawing function.
|
|
|
|
|
Ahh, it was all about this MFC thing - sometimes you have to override some methods you got no idea about to make your control draw itself correctly. In this case it was:
OnWindowPosChanged
And just do nothing inside - static draws perfectly.
011011010110000101100011011010000110100101101110
0110010101110011
|
|
|
|
|
Hi, I have an app (MDI,MFC) with some buttons. I want to show information in a dialogo box with Edit control when I press a button, and, in adittion, I want to show in the same dialog other text when I press other button.
I know how to do the first part, but I dont know how to show other text in the same dialog when I press other button.
Could you help me, plz?
The buttons are in the Ribbon
|
|
|
|
|
Please share any relevant code with us, seeing the code might us help understand the problem you are facing. Please specify where in the code you are having problem.
If you wish to change your question use the Improve Question button.
0100000101101110011001000111001011101001
|
|
|
|
|
|
What is wrong with this[^]?
|
|
|
|
|
doooh :
yes, yes indeed.. SetDlgItemText(Dialogbox, IDC_EDITBOX, sString);
|
|
|
|
|
Your question is not very clear; however, if you mean by pressing an alternate button on the main window, then you will need a modeless dialog. If you mean a button in the dialog then your normal data exchange DDX_??? handlers should do it.
|
|
|
|
|
ok...when you press a button show a modeless dialog with a edit control to show text.
Class view:
void Cprueba4View::OnButton2()
{
CEjemplo *dlgDesc;
dlgDesc = new CEjemplo();
dlgDesc->Create( IDD_DIALOG1 ,GetDesktopWindow());
dlgDesc->ShowWindow(1);
}
In class CEjemplo:
void CEjemplo::ShowText(void)
{
CString cadena= _T("Hi, it is a example");
m_Edit.SetWindowTextW(cadena);
}
But I need, to show text from other class in the same dialog, that mean, the text, it will be added in the same windows when I press other button.
Every button are in the ribbon.
|
|
|
|
|
antonio343 wrote: I need, to show text from other class in the same dialog
How about making the ShowText function as public and pass a CString variable ;
void CEjemplo::ShowText(CString strText)
{
m_Edit.SetWindowTextW(strText);
UpdateData(FALSE);
}
call the public function of CEjemplo object as,
void CSomeOtherClass::ShowText()
{
CEjemplo oEjemplo;
CSting strText(_T("Some text from other class"));
oEjemplo.ShowText(strText);
}
|
|
|
|
|
ok, but..
Where I define strText?
And.. to show the text I need the method OnInitDialog in class CEjemplo, but if I add the parameter I need to pass the paramenter to this method and it isn't possible.
BOOL CEjemplo::OnInitDialog()
{
CDialogEx::OnInitDialog();
ShowText();
return TRUE;
}
|
|
|
|