|
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
|
|
|
|
|
does c++ support a 'this' operator? i'm wondering if you can do something like this in c++:
//java syntax -
class Person{
//members
Person(){
// init defaults
}
Person(int id){
this(); // <-- call 0 param constructor for init defaults
m_id = id;
}
}
*->>Always working on my game, teach me
*->>something new.
cout << "dav1d\n";
|
|
|
|
|
Nope.
People usually just end up making a common init routine.
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?
|
|
|
|
|
C++ does support a this pointer, which points to the current instance and is secretly passed to member method.
You cannot explicitly call another constructor. Just make a private initialization routine for the common initialization code.
Michel
It is a lovely language, but it takes a very long time to say anything in it, because we do not say anything in it, unless it is worth taking a very long time to say, and to listen to.
- TreeBeard
|
|
|
|
|
I got a Property sheet with some pages on it in wizard style. On first page i am disabling the back and next button. The next button gets enabled when user enters something into edit control of page i.e. first page. Since Back and Next buttons are disabled while dispalying sheet, the cancel button is becoming as Default button. Now i want to make Next burtton as Default button as soon as user enters something into Edit control. So please give me suggestion or solution on this. Thanks for everything.
|
|
|
|
|
That should happen automatically. What code do you use to re-activate the Next button?
Good Luck,
Bill
|
|
|
|
|
Thanks Bill. Here is the scenario.
I am enabling the Next button as soon as user enters something into Edit control. I mapped a message of edit control ON_EN_CHANGE in this function i am checking edit control is empty or not. If it is not empty then i am getting a pointer to next button from Sheet by using GetDlgItem(ID_WIZNEXT) and calling EnableWindow(TRUE). Now it is working perfectly as far as Enbling concerned. I want Next button as Default as soon as it gets enabled.
Once again Thanks.
|
|
|
|