-
[RESOLVED] CEdit::Create & GetWindowRect
Hey guys. I'm creating these CEdits, placing them within their parent dialog. I do this by adding offsets from the parent dialog's rect. The only problem is the CEdits end up being offset by a much larger amount than I set them to be. For example, this->GetWindowRect(&rect) sets rect as rect = {top=275 bottom=654 left=393 right=869}. But further down when I test the value of the first CEdit's (at_edit) rect, it's rect = {top=576 bottom=588 left=794 right=834}, which is not correct.
Cheers.
Code:
BOOL WM2000_Simulator::OnInitDialog()
{
Simulator_Base::OnInitDialog();
DWORD style = WS_VISIBLE | WS_CHILD | WS_BORDER |
WS_TABSTOP | ES_AUTOHSCROLL | ES_RIGHT;
RECT rect;
this->GetWindowRect(&rect);
at_edit.Create(style, CRect(rect.left + 8, rect.top + 26, rect.left + 8 + 40, rect.top + 26 + 12),
this, IDC_EDIT_AT);
ws_edit.Create(style, CRect(rect.left + 148, rect.top + 26, rect.left + 148 + 40, rect.top + 26 + 12),
this, IDC_EDIT_WS);
wd_edit.Create(style, CRect(rect.left + 8, rect.top + 56, rect.left + 8 + 40, rect.top + 56 + 12),
this, IDC_EDIT_WD);
sr_edit.Create(style, CRect(rect.left + 148, rect.top + 56, rect.left + 148 + 40, rect.top + 56 + 12),
this, IDC_EDIT_SR);
rh_edit.Create(style, CRect(rect.left + 78, rect.top + 26, rect.left + 78 + 40, rect.top + 26 + 12),
this, IDC_EDIT_RH);
ra_edit.Create(style, CRect(rect.left + 78, rect.top + 56, rect.left + 78 + 40, rect.top + 56 + 12),
this, IDC_EDIT_RA);
at_edit.GetWindowRect(&rect);
at_edit.SetLimitText(WM2000_MAX_CEDIT_DIGITS);
ws_edit.SetLimitText(WM2000_MAX_CEDIT_DIGITS);
wd_edit.SetLimitText(WM2000_MAX_CEDIT_DIGITS);
sr_edit.SetLimitText(WM2000_MAX_CEDIT_DIGITS);
rh_edit.SetLimitText(WM2000_MAX_CEDIT_DIGITS);
ra_edit.SetLimitText(WM2000_MAX_CEDIT_DIGITS);
return TRUE;
}
-
Re: CEdit::Create & GetWindowRect
You're mixing up window coordinates and client coordinates I believe. GetWindowRect returns the rect relative to the screen. The rect you pass into create is relative to the parent's client area. So when you say, rect.left + 8, you're specifying the left coordinate to be 401 pixels to the right of the left side of the parent dialog. If you want the edit to be offset by 8, just specify 8, not rect.left+ 8.
-
1 Attachment(s)
Re: CEdit::Create & GetWindowRect
Oh... that would make sense haha. Cheers GCDEF!
One other question... apart from left justification, how would I make the CEdit up the top look like the editor-placed one below it? I gave the manually created on these styles:
Code:
DWORD style = WS_VISIBLE | WS_CHILD | WS_BORDER |
WS_TABSTOP | ES_AUTOHSCROLL | ES_RIGHT;
Cheers.
-
Re: CEdit::Create & GetWindowRect
Quote:
Originally Posted by
Mybowlcut
Oh... that would make sense haha. Cheers GCDEF!
One other question... apart from left justification, how would I make the CEdit up the top look like the editor-placed one below it? I gave the manually created on these styles:
Code:
DWORD style = WS_VISIBLE | WS_CHILD | WS_BORDER |
WS_TABSTOP | ES_AUTOHSCROLL | ES_RIGHT;
Cheers.
I think that's the client edge style.
-
Re: CEdit::Create & GetWindowRect
Oh, cheers! I searched around and found this article that explained it. Did I do it correctly? The text is still bolded..
Code:
at_edit.CreateEx(WS_EX_CLIENTEDGE, "EDIT", "", style,
0, 0, 10, 10, this->GetSafeHwnd(), NULL, (HMENU)IDC_EDIT_AT);
-
Re: CEdit::Create & GetWindowRect
Quote:
Originally Posted by
Mybowlcut
Oh, cheers! I searched around and found
this article that explained it. Did I do it correctly?
Code:
at_edit.CreateEx(WS_EX_CLIENTEDGE, "EDIT", "", style,
0, 0, 10, 10, this->GetSafeHwnd(), NULL, (HMENU)IDC_EDIT_AT);
Try it and see.
-
Re: CEdit::Create & GetWindowRect
Sorry, edited shortly after I posted. The text is still bolded and it looks very windows 95ish! Haha. Any idea what the style would be to change that?
Edit: I also have a MESSAGE_MAP that doesn't seem to be working (IE the OnEnChangeEdit* functions aren't getting called):
Code:
BEGIN_MESSAGE_MAP(WM2000_Simulator, CDialog)
ON_EN_CHANGE(IDC_EDIT_AT, &WM2000_Simulator::OnEnChangeEditAt)
ON_EN_CHANGE(IDC_EDIT_RA, &WM2000_Simulator::OnEnChangeEditRa)
ON_EN_CHANGE(IDC_EDIT_RH, &WM2000_Simulator::OnEnChangeEditRh)
ON_EN_CHANGE(IDC_EDIT_SR, &WM2000_Simulator::OnEnChangeEditSr)
ON_EN_CHANGE(IDC_EDIT_WD, &WM2000_Simulator::OnEnChangeEditWd)
ON_EN_CHANGE(IDC_EDIT_WS, &WM2000_Simulator::OnEnChangeEditWs)
END_MESSAGE_MAP()
Code:
void WM2000_Simulator::OnEnChangeEditAt()
{
Set_Data_From_CEdit(IDC_EDIT_AT, data.air_temp);
}
void WM2000_Simulator::OnEnChangeEditWd()
{
Set_Data_From_CEdit(IDC_EDIT_WD, data.wnd_dir);
}
void WM2000_Simulator::OnEnChangeEditRh()
{
Set_Data_From_CEdit(IDC_EDIT_RH, data.rel_hum);
}
void WM2000_Simulator::OnEnChangeEditRa()
{
Set_Data_From_CEdit(IDC_EDIT_RA, data.rnfall);
}
void WM2000_Simulator::OnEnChangeEditWs()
{
Set_Data_From_CEdit(IDC_EDIT_WS, data.wnd_spd);
}
void WM2000_Simulator::OnEnChangeEditSr()
{
Set_Data_From_CEdit(IDC_EDIT_SR, data.sol_rad);
}
I declared the MESSAGE_MAP:
Code:
class WM2000_Simulator : public Simulator_Base
{
DECLARE_DYNAMIC(WM2000_Simulator)
public:
WM2000_Simulator(CWnd* pParent = NULL); // standard constructor
virtual ~WM2000_Simulator();
virtual void Do_Command(CSerial& serial);
virtual std::string Get_Data() const;
// Dialog Data
enum { IDD = IDD_WM2000_SIMULATOR };
private:
static const int WM2000_MAX_CEDIT_DIGITS = 6;
WM2000_Data data;
void Set_Data_From_CEdit(int ID, double& data);
protected:
//virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
virtual BOOL OnInitDialog();
DECLARE_MESSAGE_MAP()
public:
CEdit at_edit;
CEdit ra_edit;
CEdit rh_edit;
CEdit sr_edit;
CEdit wd_edit;
CEdit ws_edit;
afx_msg void OnEnChangeEditAt();
afx_msg void OnEnChangeEditWd();
afx_msg void OnEnChangeEditRh();
afx_msg void OnEnChangeEditRa();
afx_msg void OnEnChangeEditWs();
afx_msg void OnEnChangeEditSr();
};
Cheers.
-
Re: CEdit::Create & GetWindowRect
I continue to faill understanding why you are creating controls instead letting OS use dialog template to do it for you.
If you want to resize controls at the run time it would be less difficult than your approach.
If you insert edit controls using dialog editor, client edge is implied.
When you attach window handle to any MFC control using Create member, passing WS_BORDER style, control will be created with this style, not WS_EX_CLIENTEDGE.
Create control without WS_BORDER and modify extended style adding WS_EX_CLIENTEDGE or use CreateWindowEx.
Furthermore: your homemade control is using system font (default). Template controls use font used by template (the same font dialog is using).
In order to display the same font you will have to assign one using SetFont and passing a pointer to a dialog font or creating control’s own font.
As for using DoDataExchange for validation, you can still do it, providing homemade control has the same ID and you either replace variable name inserted by wizard, with a name you are using to call Create.
I still fail understanding why you are creating controls instead letting OS use dialog template to do it for you.
Is it an exercise?
-
Re: CEdit::Create & GetWindowRect
Quote:
Originally Posted by
JohnCz
I continue to faill understanding why you are creating controls instead letting OS use dialog template to do it for you.
If you want to resize controls at the run time it would be less difficult than your approach.
If you insert edit controls using dialog editor, client edge is implied.
When you attach window handle to any MFC control using Create member, passing WS_BORDER style, control will be created with this style, not WS_EX_CLIENTEDGE.
Create control without WS_BORDER and modify extended style adding WS_EX_CLIENTEDGE or use CreateWindowEx.
Furthermore: your homemade control is using system font (default). Template controls use font used by template (the same font dialog is using).
In order to display the same font you will have to assign one using SetFont and passing a pointer to a dialog font or creating control’s own font.
As for using DoDataExchange for validation, you can still do it, providing homemade control has the same ID and you either replace variable name inserted by wizard, with a name you are using to call Create.
I still fail understanding why you are creating controls instead letting OS use dialog template to do it for you.
Is it an exercise?
I'm creating them myself because otherwise I don't know how to change the type to my derived edit class.
-
Re: CEdit::Create & GetWindowRect
Hmmmm, why you did not mention it in your first post?
In VS 6.0 after deriving class from CEdit (or any other window control) use class wizard to insert variable. Pick your class from the "Variable Type" drop box.
In later versions of the VS, or if you want to change type of variable after inserting it, simply replace class inserted by wizard with your derived class. Make sure appropriate headers are available.
That is it.
-
Re: CEdit::Create & GetWindowRect
But if you add a variable via the add variable wizard, it isn't placed onto the visual editor. I've already got the CEdits working fine though, so it doesn't matter. Cheers for the font advice as well.
-
Re: CEdit::Create & GetWindowRect
Quote:
Originally Posted by
Mybowlcut
I'm creating them myself because otherwise I don't know how to change the type to my derived edit class.
I told you days ago. In the header file change the control variable type from CEdit to your CEdit derived class. That's all you have to do.
If that's the reason, I would strongly and I mean strongly recommend throwing away this code and doing it properly. It'll be easier for you to maintain, whoever works on it after you will be happier, it's really easy to do, and you can't jump through all these hoops every time you need to use a control class you've created yourself.
One thing about being a good programmer is knowing when you're headed down the wrong path and not creating a convoluted workaround because you're stuck on a simple problem.
-
Re: CEdit::Create & GetWindowRect
Quote:
Originally Posted by
Mybowlcut
But if you add a variable via the add variable wizard, it isn't placed onto the visual editor. I've already got the CEdits working fine though, so it doesn't matter. Cheers for the font advice as well.
Pick CEdit and change it manually. There's nothing to id.
-
Re: CEdit::Create & GetWindowRect
Mybowlcut:
You keep asking questions even though they are already answered. You have to pay attention.
Quote:
Originally Posted by
me earlier
simply replace class inserted by wizard with your derived class. Make sure appropriate headers are available.
-
Re: CEdit::Create & GetWindowRect
Guys... I know how to change the type of a variable. My problem has always been what I said above. That if I add the controls via the visual editor, they aren't created as instances and so I didn't know how to change their type. John, you said it yourself:
Quote:
Once dialog resource is saved, all information is written to a resource file as ASCII script.
Quote:
I told you days ago. In the header file change the control variable type from CEdit to your CEdit derived class. That's all you have to do.
If that's the reason, I would strongly and I mean strongly recommend throwing away this code and doing it properly. It'll be easier for you to maintain, whoever works on it after you will be happier, it's really easy to do, and you can't jump through all these hoops every time you need to use a control class you've created yourself.
One thing about being a good programmer is knowing when you're headed down the wrong path and not creating a convoluted workaround because you're stuck on a simple problem.
That's not what I meant at all. I meant:
Quote:
I'm creating them myself because otherwise, if I place them visually, I don't know how to change the type to my derived edit class.
I don't know how to change their type if they were placed visually with the editor. When I place them with the editor, there are no instances created that I can edit:
Quote:
As you realize now, once control is placed in a dialog template you do not have to create it.
So, I have two options. 1) Add them via the add variable wizard. They're created as instances and I can change their type (I always understood how do to that). But if I do it that way, then I have to position them manually... which is harder.
2) Create them with the visual editor by placing them on the dialog. Easier to do but there is no way to change their type as there are no instances created and I have not yet found a way to change their type via properties or anything else like that.
-
Re: CEdit::Create & GetWindowRect
Quote:
Originally Posted by
Mybowlcut
Guys... I know how to change the type of a variable.
Quote:
Originally Posted by
Mybowlcut
I don't know how to change their type if they were placed visually with the editor. When I place them with the editor, there are no instances created that I can edit:
I think at this point you should consider serious focused reading about C++, Windows programming, Visual Studio and resource editor.
After really focusing on those topics, come back here and read all posts from the beginning of this thread.
-
Re: CEdit::Create & GetWindowRect
Question to GCDEF:
Do you fill that we are being played? Like about "Any Key"?
I do not know about you but I quit here.
-
Re: CEdit::Create & GetWindowRect
Quote:
Originally Posted by
JohnCz
I think at this point you should consider serious focused reading about C++, Windows programming, Visual Studio and resource editor.
After really focusing on those topics, come back here and read all posts from the beginning of this thread.
What does learning C++ have to do with using changing a control type in Visual Studio? If there's one thing I've wanted to know through these two threads, it is how to change the type of a control placed with the visual editor. Quote the post where someone has explained to me how to do this and I will mark the thread as resolved. Oh, and this is not "it":
Quote:
In VS 6.0 after deriving class from CEdit (or any other window control) use class wizard to insert variable. Pick your class from the "Variable Type" drop box.
In later versions of the VS, or if you want to change type of variable after inserting it, simply replace class inserted by wizard with your derived class. Make sure appropriate headers are available.
That is it.
That is not what I am trying to, nor is it what I have been trying to do. I am talking about changing the type of a control after placing it with the visual editor, not the class wizard.
Quote:
Originally Posted by
JohnCz
Question to GCDEF:
Do you fill that we are being played? Like about "Any Key"?
I do not know about you but I quit here.
Good. Please do. I'd rather receive no help at all than have someone exhibit such a condescending and inconsiderate attitude towards people.
-
Re: CEdit::Create & GetWindowRect
Quote:
Originally Posted by
JohnCz
Question to GCDEF:
Do you fill that we are being played? Like about "Any Key"?
I do not know about you but I quit here.
No I don't. But I do think that he's not really taking the time to understand what's being said and went for a convoluted work around when he couldn't understand the simple solution.
-
Re: CEdit::Create & GetWindowRect
Quote:
Originally Posted by
Mybowlcut
Quote the post where someone has explained to me how to do this and I will mark the thread as resolved.
http://www.codeguru.com/forum/showpo...42&postcount=9
-
Re: CEdit::Create & GetWindowRect
Quote:
Originally Posted by
Mybowlcut
What does learning C++ have to do with using changing a control type in Visual Studio? If there's one thing I've wanted to know through these two threads, it is how to change the type of a control placed with the visual editor.
No, you don't change the type of a control.
And you don't have to change the type of a control.
What you have to do is the change the type (class) of a control member variable you are to associate with this control (so called subclassing).
And you was told many times about it. :cool:
-
Re: CEdit::Create & GetWindowRect
Quote:
Originally Posted by
GCDEF
No I don't. But I do think that he's not really taking the time to understand what's being said and went for a convoluted work around when he couldn't understand the simple solution.
Quite the opposite. I'm really trying to understand what's being said, but it seems that everyone is misunderstanding me or am I really blind.
Quote:
Originally Posted by
GCDEF
Quote:
Originally Posted by
VictorN
No, you don't change the type of a control.
And you don't have to change the type of a control.
What you have to do is the change the type (class) of a control member variable you are to associate with this control (so called subclassing).
And you was told many times about it. :cool:
You guys are saying to use the add variable wizard to add all the variables. That will set up the instances and do the DDX stuff. I always understood that. It would be something like this:
Code:
class WM2000_Simulator : public Simulator_Base
{
DECLARE_DYNAMIC(WM2000_Simulator)
public:
WM2000_Simulator(CWnd* pParent = NULL); // standard constructor
virtual ~WM2000_Simulator();
virtual void Do_Command(CSerial& serial);
virtual std::string Get_Data() const;
// Dialog Data
enum { IDD = IDD_WM2000_SIMULATOR };
private:
static const int WM2000_MAX_CEDIT_DIGITS = 6;
WM2000_Data data;
void Set_Data_From_CEdit(int ID, double& data);
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
virtual BOOL OnInitDialog();
DECLARE_MESSAGE_MAP()
public:
CEdit at_edit; // change to CDecimalEdit at_edit;
CEdit ra_edit; // change to CDecimalEdit ra_edit;
CEdit rh_edit; // change to CDecimalEdit rh_edit;
CEdit sr_edit; // change to CDecimalEdit sr_edit;
CEdit wd_edit; // change to CDecimalEdit wd_edit;
CEdit ws_edit; // change to CDecimalEdit ws_edit;
afx_msg void OnEnChangeEditAt();
afx_msg void OnEnChangeEditWd();
afx_msg void OnEnChangeEditRh();
afx_msg void OnEnChangeEditRa();
afx_msg void OnEnChangeEditWs();
afx_msg void OnEnChangeEditSr();
};
I always understood that that is what you meant. But my question was, if I wanted to place the controls visually, then how would I change the type? It has been confirmed that by placing the controls visually, it is easier to position them, they come with the client edge and normal font as default and it's generally a lot easier. But when I click on Edit control in the toolbox and make one, I do not see a way to change its type as there is no instance created in the dialog's code. The link to the post you gave me does not explain this. It tells me to use the add variable wizard, which is not what I wanted to do (see this post).
-
Re: CEdit::Create & GetWindowRect
Quote:
Originally Posted by
Mybowlcut
... it seems that everyone is misunderstanding me or am I really blind.
Exactly. :eek:
Quote:
Originally Posted by
Mybowlcut
You guys are saying to use the add variable wizard to add all the variables. That will set up the instances and do the DDX stuff. I always understood that. It would be something like this:
Code:
class WM2000_Simulator : public Simulator_Base
{
...
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
virtual BOOL OnInitDialog();
DECLARE_MESSAGE_MAP()
public:
CEdit at_edit; // change to CDecimalEdit at_edit;
CEdit ra_edit; // change to CDecimalEdit ra_edit;
CEdit rh_edit; // change to CDecimalEdit rh_edit;
CEdit sr_edit; // change to CDecimalEdit sr_edit;
CEdit wd_edit; // change to CDecimalEdit wd_edit;
CEdit ws_edit; // change to CDecimalEdit ws_edit;
...
};
I always understood that that is what you meant.
Good! Then do it that way, remove all CEdit declarations and uncomment CDecimalEdit ones.
And don't forget to #include header file with CDecimalEdit declarations.
Quote:
Originally Posted by
Mybowlcut
But my question was, if I wanted to place the controls visually,
What do you mean by "visually"?
In the "resource editor"? - You already got a lot of answers: just do it! :thumb:
Quote:
Originally Posted by
Mybowlcut
then how would I change the type? ...
But when I click on Edit control in the toolbox and make one, I do not see a way to change its type as there is no instance created in the dialog's code. The link to the post you gave me does not explain this. It tells me to use the add variable wizard, which is not what I wanted to do (see
this post).
You was already told then in this case (using VS versions higher than VS6) you just add the control variable of the *standard* type (CEdit), then go to the header file and edit the control declaration (change it from CEdit to your CDecimalEdit or any other type). And again: don't forget to #include header file with the new class declarations.
-
Re: CEdit::Create & GetWindowRect
Quote:
Originally Posted by
VictorN
Exactly. :eek:
Good! Then do it that way, remove all CEdit declarations and uncomment CDecimalEdit ones.
And don't forget to #include header file with CDecimalEdit declarations.
What do you mean by "visually"?
In the "resource editor"? - You already got a lot of answers: just do it! :thumb:
You was already told then in this case (using VS versions higher than VS6) you just add the control variable of the *standard* type (CEdit), then go to the header file and edit the control declaration (change it from CEdit to your CDecimalEdit or any other type). And again: don't forget to #include header file with the new class declarations.
Yes, the resource editor would be the simplest and easiest way to create the controls because of the reasons I mentioned (I'm really not aiming for a convoluted workaround). Again, you are telling me that I have got a lot of answers and that they are all telling me to change the variable type from CEdit to my derived class.. I would but like I have already said several times, that I can see no variables to edit because they don't exist when I place the controls with the resource editor, as outlined by JohnCz here:
Quote:
Resource editor allows visually position controls in a dialog. Windows for controls are created at this time only as a representation of the template contents.
Once dialog resource is saved, all information is written to a resource file as ASCII script.
This is my problem... there are no variables for me to edit if I place the controls with the resource editor.
-
Re: CEdit::Create & GetWindowRect
Quote:
Originally Posted by
Mybowlcut
... I can see no variables to edit because they don't exist when I place the controls with the resource editor, as outlined by JohnCz here...
This is my problem... there are no variables for me to edit if I place the controls with the resource editor.
:confused:
But you posted the code snippet with all of the control variable declarations here! :confused:
-
Re: CEdit::Create & GetWindowRect
Quote:
Originally Posted by
Mybowlcut
Code:
CEdit at_edit; // change to CDecimalEdit at_edit;
CEdit ra_edit; // change to CDecimalEdit ra_edit;
CEdit rh_edit; // change to CDecimalEdit rh_edit;
CEdit sr_edit; // change to CDecimalEdit sr_edit;
CEdit wd_edit; // change to CDecimalEdit wd_edit;
CEdit ws_edit; // change to CDecimalEdit ws_edit;
afx_msg void OnEnChangeEditAt();
afx_msg void OnEnChangeEditWd();
afx_msg void OnEnChangeEditRh();
afx_msg void OnEnChangeEditRa();
afx_msg void OnEnChangeEditWs();
afx_msg void OnEnChangeEditSr();
};
I always understood that that is what you meant. But my question was, if I wanted to place the controls visually, then how would I change the type? It has been confirmed that by placing the controls visually, it is easier to position them, they come with the client edge and normal font as default and it's generally a lot easier. But when I click on Edit control in the toolbox and make one, I do not see a way to change its type as there is no instance created in the dialog's code. The link to the post you gave me does not explain this. It tells me to use the add variable wizard, which is not what I wanted to do (see
this post).
You don't change the type when adding the variable. As your comments indicate above, you let it create CEdit variables and change it yourself. I've said that at least four times now.
Change this
to this
Code:
CDecimalEdit ws_edit;
That's it. That's all. You're done.
-
Re: CEdit::Create & GetWindowRect
Quote:
Originally Posted by
Mybowlcut
This is my problem... there are no variables for me to edit if I place the controls with the resource editor.
What do you mean there are no variables???? You're showing them all in the code snippet you posted.
-
1 Attachment(s)
Re: CEdit::Create & GetWindowRect
Yes they are all there because I added them with the add variable wizard. I did not create them with the resource editor.
For example, I can create a new project. I can add two Edit controls as pictured in the attachment. But it doesn't give me any instances to work with, as seen here:
Code:
// ttttttttttestDlg.h : header file
//
#pragma once
// CttttttttttestDlg dialog
class CttttttttttestDlg : public CDialog
{
// Construction
public:
CttttttttttestDlg(CWnd* pParent = NULL); // standard constructor
// Dialog Data
enum { IDD = IDD_TTTTTTTTTTEST_DIALOG };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
// Implementation
protected:
HICON m_hIcon;
// Generated message map functions
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
DECLARE_MESSAGE_MAP()
};
My whole point is that I want to change the type of these controls, but have no way to... there are no instances from which I can change their type.
-
Re: CEdit::Create & GetWindowRect
Quote:
Originally Posted by
Mybowlcut
Yes they are all there because I added them with the add variable wizard. I did not create them with the resource editor.
Why are you being so stubborn on this. That's what everybody's been telling you. Use the resource editor to draw your controls. Then use the add variable wizard to add CEdit controls. Then go in to your header and change their type from CEdit to your class. Is there some part of that that's still unclear? I don't know how else to put it.
-
Re: CEdit::Create & GetWindowRect
Quote:
Originally Posted by
VictorN
Exactly. :eek:
Good! Then do it that way, remove all CEdit declarations and uncomment CDecimalEdit ones.
And don't forget to #include header file with CDecimalEdit declarations.
What do you mean by "visually"?
In the "resource editor"? - You already got a lot of answers: just do it! :thumb:
You was already told then in this case (using VS versions higher than VS6) you just add the control variable of the *standard* type (CEdit), then go to the header file and edit the control declaration (change it from CEdit to your CDecimalEdit or any other type). And again: don't forget to #include header file with the new class declarations.
Quote:
Originally Posted by
GCDEF
Why are you being so stubborn on this. That's what everybody's been telling you. Use the resource editor to draw your controls. Then use the add variable wizard to add CEdit controls. Then go in to your header and change their type from CEdit to your class. Is there some part of that that's still unclear? I don't know how else to put it.
I really am sorry that you guys are mistaking this as me being stubborn. I have no reason to be stubborn when I am the one asking for help. I have genuinely not understood what you guys were saying, because I honestly believe it was missing an important detail (which was to first place the controls visually but also add the control variables via the add class wizard). From the line you just wrote, I understand what you mean. But nowhere did I see anyone explain it like that. It was always like this (by wizard I assume you meant add variable wizard - I saw no mention of placing the control via the resource editor first, hence my confusion):
Quote:
The easiest thing to do here is let the wizards add the CEdit control variable and the DDX mechanism for you. Then with the text editor, change the control type from CEdit to your CEdit derived class and you're done.
and this:
Quote:
you just add the control variable of the *standard* type (CEdit), then go to the header file and edit the control declaration (change it from CEdit to your CDecimalEdit or any other type).
I hope you can see it from my point of view (especially never having used MFC before)? I saw no mention of first placing the control with the resource editor first, hence my repetitive questions.
-
Re: CEdit::Create & GetWindowRect
Quote:
Originally Posted by
Mybowlcut
I have genuinely not understood what you guys were saying, because I honestly believe it was missing an important detail (which was to first place the controls visually but also add the control variables via the add class wizard).
FYI: Adding, Editing, or Deleting Controls
Quote:
Originally Posted by
Mybowlcut
I saw no mention of first placing the control with the resource editor first, hence my repetitive questions.
You lie again. :(
Reread this thread beginning from the post#8.
Reread your another thread, particularly post#12
-
Re: CEdit::Create & GetWindowRect
Lie? Forget it. I don't want to quote every post made to defend myself as it seems you're only interested in telling me that I'm lying. If someone is genuinely interested as to how I understood every post beginning from #8, then I'll explain it. But while you want to tell me I'm lying, I'll leave the thread here.
A sincere thank you to all who helped and I apologize for the confusion.