|
-
February 17th, 2009, 08:56 PM
#1
[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;
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|