Re: How to do flat style of CEdit (EDITTEXT) and CComboBox in CDialog
Hi GCDEF i used the resource editor and set the border to false which resulted in loss of boundaries of box , i also set client edge as false from there but no effect. As told i want the second box in the image i pasted above
Re: How to do flat style of CEdit (EDITTEXT) and CComboBox in CDialog
Quote:
Originally Posted by
Beginner_MFC
Hi GCDEF i used the resource editor and set the border to false which resulted in loss of boundaries of box , i also set client edge as false from there but no effect. As told i want the second box in the image i pasted above
Again. use Spy++ as I wrote you in the post#13
Re: How to do flat style of CEdit (EDITTEXT) and CComboBox in CDialog
I used the below code for creating CEdit dynamically, code compiled but editbox is not visible on screen.
Code:
CEdit *tedit = new CEdit;
tedit->CreateEx(WS_EX_CLIENTEDGE , L"Edit", L" ", ES_AUTHOSCROLL | WS_BORDER | WS_VISIBLE | WS_CHILD , CRect(15,150,30,20),this, IDC_EDIT);
Re: How to do flat style of CEdit (EDITTEXT) and CComboBox in CDialog
Is the CRect(15,150,30,20) within the parent?
Re: How to do flat style of CEdit (EDITTEXT) and CComboBox in CDialog
Quote:
Originally Posted by
Beginner_MFC
I used the below code for creating CEdit dynamically, code compiled but editbox is not visible on screen.
Code:
CEdit *tedit = new CEdit;
tedit->CreateEx(WS_EX_CLIENTEDGE , L"Edit", L" ", ES_AUTHOSCROLL | WS_BORDER | WS_VISIBLE | WS_CHILD , CRect(15,150,30,20),this, IDC_EDIT);
Look at the order of parameters for the CRect constructor.
WS_EX_CLIENTEDGE will give you the 3D look you don't want. I only mentioned CreateEx earlier because you were using WS_EX_CLIENTEDGE with Create.
Re: How to do flat style of CEdit (EDITTEXT) and CComboBox in CDialog
Yes Victor it is within the parent
Re: How to do flat style of CEdit (EDITTEXT) and CComboBox in CDialog
Quote:
Originally Posted by
Beginner_MFC
Yes Victor it is within the parent
How did you check it is "within the parent"? Did you call GetWindowRect for both the parent and child to be sure they somehow intersect?
Or did you use some other way? Which one?
Re: How to do flat style of CEdit (EDITTEXT) and CComboBox in CDialog
Quote:
Originally Posted by
Beginner_MFC
I used the below code for creating CEdit dynamically, code compiled but editbox is not visible on screen.
Code:
CEdit *tedit = new CEdit;
tedit->CreateEx(WS_EX_CLIENTEDGE , L"Edit", L" ", ES_AUTHOSCROLL | WS_BORDER | WS_VISIBLE | WS_CHILD , CRect(15,150,30,20),this, IDC_EDIT);
BTW, did you check the CreateEx returned TRUE?
Re: How to do flat style of CEdit (EDITTEXT) and CComboBox in CDialog
Quote:
Originally Posted by
VictorN
BTW, did you check the CreateEx returned TRUE?
It's not displaying because his CRect arguments are wrong. The bottom is higher than the top.
Re: How to do flat style of CEdit (EDITTEXT) and CComboBox in CDialog
CreateEx is returning true..I have wrote this code inside OnInitDialog() function. Does any effect of it ..Any specific message handler to be used ?
Re: How to do flat style of CEdit (EDITTEXT) and CComboBox in CDialog
Quote:
Originally Posted by
Beginner_MFC
CreateEx is returning true..I have wrote this code inside OnInitDialog() function. Does any effect of it ..Any specific message handler to be used ?
Have you read the GCDEF's post (#24)?
Re: How to do flat style of CEdit (EDITTEXT) and CComboBox in CDialog
I read but getting no clue how to fix that.if i am able to see it anywhere on the dialog than atleast i will move it where i want .. within OnInitDialog() i wrote CRect temp; GetWindowRect(&temp); while debugging i got following values [ LT(108,1), RB(712,724)],[656 × 723]. So now accordingly please suggest any rough CRect() coordinates so that editbox get atleast visible
Re: How to do flat style of CEdit (EDITTEXT) and CComboBox in CDialog
Quote:
Originally Posted by
Beginner_MFC
I read but getting no clue how to fix that.if i am able to see it anywhere on the dialog than atleast i will move it where i want .. within OnInitDialog() i wrote CRect temp; GetWindowRect(&temp); while debugging i got following values [ LT(108,1), RB(712,724)],[656 × 723]. So now accordingly please suggest any rough CRect() coordinates so that editbox get atleast visible
No clue how to fix it? Look at the parameters you need to pass in to a CRect constructor and see if the ones you're passing in make sense. You need to figure that one out yourself. I gave a good clue a few posts back.
Re: How to do flat style of CEdit (EDITTEXT) and CComboBox in CDialog
Hitting my trials since last 1 day, but not able to see CEdit on Screen. Below is the code of .rc file
[CODE]
IDD_DIALOG_M 0,0,283,277
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "MYDIALOG"
FONT 8,"TAHOMA"
BEGIN
PUSHBUTTON "OK" 15,251,37,15
END
[/ CODE]
Below is the code in .cpp for constructor and OnInitDialog
Code:
MyCDialog::MyCDialog( MyClass *acct, CWnd* pParent):CDialog(MyCDialog::IDD,pParent)
{
m_acct = acct;
}
BOOL MyCDilaog::OninItDialog()
{
CDialog::OnInitDialog():
m_edit = new CEdit; // CEdit *m_edit declared in .h
m_edit->CreatEx(!WS_EX_CLIENTEDGE , L"EDIT",L" " ,WS_BORDER | WS_VISIBLE | WS_CHILD, CRect(40,120,40,30), this, IDC_EDIT);
return TRUE;
}
Please help me out in passing correct values inside CRect so that box become atleast visible on screen
Re: How to do flat style of CEdit (EDITTEXT) and CComboBox in CDialog
Quote:
Originally Posted by
Beginner_MFC
Hitting my trials since last 1 day, but not able to see CEdit on Screen. Below is the code of .rc file
[CODE]
IDD_DIALOG_M 0,0,283,277
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "MYDIALOG"
FONT 8,"TAHOMA"
BEGIN
PUSHBUTTON "OK" 15,251,37,15
END
[/ CODE]
Below is the code in .cpp for constructor and OnInitDialog
Code:
MyCDialog::MyCDialog( MyClass *acct, CWnd* pParent):CDialog(MyCDialog::IDD,pParent)
{
m_acct = acct;
}
BOOL MyCDilaog::OninItDialog()
{
CDialog::OnInitDialog():
m_edit = new CEdit; // CEdit *m_edit declared in .h
m_edit->CreatEx(!WS_EX_CLIENTEDGE , L"EDIT",L" " ,WS_BORDER | WS_VISIBLE | WS_CHILD, CRect(40,120,40,30), this, IDC_EDIT);
return TRUE;
}
Please help me out in passing correct values inside CRect so that box become atleast visible on screen
Let's start simple. What are the arguments the CRect constructor takes?
FWIW, the resource editor is much easier than doing it this way