|
Ok, then at this point you are getting into specifics I know nothing about.
So I can't honestly contribute.
But if you want me to, I can try to make up crap that sounds good.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
Tim Smith wrote:
But if you want me to, I can try to make up crap that sounds good
Please do, can't be worse than the crap i written alreaday.
Thanks for the help anyway.
I think i leave this now, drown my sorrows in huge amounts of booze, and try again tomorrow.
/Magnus
|
|
|
|
|
Tim Smith wrote:
But if you want me to, I can try to make up crap that sounds good.
Your Dark side of Marketing that comes from selling your own product
(OK ! OK ! I admit , it was a nasty one )
Cheers,
Joao Vaz
A person who is nice to you, but rude to the waiter, is not a nice person - Natalie Portman (Padme/Amidala of Star Wars)
|
|
|
|
|
You need to use Contained Windows and Alternate Message Maps.
The "CContainedWindow" documentation sums this up pretty good
1) Add a member CContainedWindow m_wnd1, m_wnd2 to your class
(could also be CContainedWindow<mybaseclass>)
2) in your dlg CTor, call the CContainedWindow's CTor with
1) Window Class String for the window to create
2) this
3) a dialog-unique number, e.g. 1 and 2
3) add a message map like this:
BEGIN_MSG_MAP(CMyDialog)
...
MESSAGE_HANDLER(WM_CREATE, OnCreate)
...
ALT_MSG_MAP(1)
MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLBDown_FirstControl)
ALT_MSG_MAP(2)
MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLBDown_SecondControl)
END_MSG_MAP()
that's it, pretty much.
The earth is not dying. It is being killed.
|
|
|
|
|
I dont want to use CContainedWindows, they are good if
you would like to do some special processing for controls without
creating a subclass class yourself, but for a control
you intend to reuse they are no good.
You cannot resue the code based on them. (not in any good way anyway)
Anyway i found out what the problem was, very easy just as long
as you look in the right place.
The statics have to have the SS_NOTIFY style set to recive the message.
/Magnus
|
|
|
|
|
ahhh... ok (I missed that it's just two statics)
If a parent window shall handle messages that go to a child window only, you need CContainedWindow (or some similar technique)
The earth is not dying. It is being killed.
|
|
|
|
|
http://www.codeproject.com/script/comments/forums.asp?forumid=1647&app=50&select=188698#xx188698xx
plese enlighten me!
Thanks
|
|
|
|
|
Huh? What is the question. Your link just points back to the forum.
Good Luck,
Bill
|
|
|
|
|
Hi, i need to change the colour arrangement for an edit ctrl, i have managed to change the outlines but cannot change the background colour (the white bit) can someone help me plz.
Thanks.
==================================================
When Your Mind Wonders...Where Does It Go???
|
|
|
|
|
The Eclypse wrote:
When Your Mind Wonders...
Did you mean "wanders"?
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
no i meant wonders....is wanders an actual word??
==================================================
When Your Mind Wonders...Where Does It Go???
|
|
|
|
|
I think the original quote is "When your mind wanders, where does it go?". "wander" means "to go about from place to place usually without a plan or definite purpose".
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
i never knew that there was actually a saying.
==================================================
When Your Mind Wonders...Where Does It Go???
|
|
|
|
|
Ok,
In the OnCtlColor you also need
to set the BkColor of the Text.
ex for blue
pDC->SetBkColor(RGB(0,0,255)) ;
|
|
|
|
|
i did that but its still not working.
nb: This is a seperate class for the edit control.
==================================================
When Your Mind Wonders...Where Does It Go???
|
|
|
|
|
Ok,
In the Derived edit class override
OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
and do the same things.(Set the BkColor/TestColor/Brush).
And remember dont attach an instance of this to a edit
control placed on a dialog, rather create this dynamically
which will endure that the control will get a chance to
process the WM_CTLCOLOR msg.
Just try tinckering in this manner, it is bound to work!
|
|
|
|
|
I have tried what you suggested but it will not work, i even created a fresh class derived from CEdit, where the only thing I did was insert this code:
HBRUSH EditBox::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CEdit::OnCtlColor(pDC, pWnd, nCtlColor);
pDC->SetBkColor(RGB(0, 0, 255));
return hbr;
}
and when i dynamically assigned an instance of the class to an edit box with this code:
EditBox EB;
EB.SubclassDlgItem(IDC_EDIT2, this);
the edit box did not appear, it had not been drawn.
Sorrt to be a bother but I am a newbie
==================================================
When Your Mind Wonders...Where Does It Go???
|
|
|
|
|
Pleaese help me (and excuse my English)!
I have written a SDI Application which opens on start 2 (non modal) dialogs. When I now in a memer-function of Dialog 1 how can I access (member)functions on Dialog 2? Both Dialogs are instances of the Doc-Class.
In Dialog 1 an FlexGrid with an Array of Coordinates. In Dialog 2 should be paint the graph....
|
|
|
|
|
The recommended way is for dialog1 to post a command to dialog2. The handler for that command can execute the appropriate method. For example, when you click the "Show Graph In Dialog2" button in dialog1, its handler should do this:
pDialog2->PostMessage (WM_COMMAND, CMD_SHOW_GRAPH);
Dialog2's handler for the CMD_SHOW_GRAPH command should paint the graph.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
OK, but how can I get the Pointer from Dialog 2? Both Dialogs are opend on the Doc-Class!
|
|
|
|
|
One way to do is to store it as a member of a higher level object (the mainframe window, for example). Then, dialog1 can just do:
CDialog2* pDialog2 = ((CMainFrame *) AfxGetMainWnd())->m_pDialog2; /ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Hi:
I was wondering if there is a way to put ToolTips to a CBitmap object. I have a line that says:
m_ToolTip.AddTool(&m_Bmp, _T("This is a picture"));
were m_Bmp is a CBitmap object. The compiler comes with an error saying:
...int __thiscall CToolTipCtrl::AddTool(class CWnd *,unsigned int,const struct tagRECT *,unsigned int)' : cannot convert parameter 1 from 'class CBitmap *' to 'class CWnd *'
Is there something that I need to do to make this work? Any answer is more than welcome.
Best regards,
Luis E.
|
|
|
|
|
Put the bitmap in a static picture control and pass the address of the control to AddTool() .
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
By a static picture you meant a static CBitmap object? How I can pass the address? Sorry for the questions, I'm starting with MFC
Luis E. Cuadrado
)
|
|
|
|
|
Luis E. Cuadrado wrote:
By a static picture you meant a static CBitmap object?
Not quite. The resource editor contains a "picture" control (that happens to be derived from CStatic , but that's not important). Add the control to your dialog and select the bitmap image (eg: IDC_MYBITMAP ) to be displayed in the control. All this is done within the resource editor.
In your code, you can manipulate the picture control just like any other control. If the id of the picture control is IDC_FOO , you can set its tooltip by doing:
CWnd* pWnd = GetDlgItem (IDC_FOO);
ASSERT (pWnd != NULL);
m_ToolTip.AddTool(pWnd, _T("This is a picture"));
Luis E. Cuadrado wrote:
Sorry for the questions, I'm starting with MFC
Please don't apologize! We're here to help!
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|