|
-
May 17th, 1999, 01:43 PM
#1
Dynamic Controls
I am writing a reusable class based on CEdit and everything seems to be working OK except that the control does not appear as 3D when created dynamically in a dialog (i.e. no resource ID) but rather appears as a plain old Win16 edit box. The control does appear as 3D when used in a dialog with an associated resource ID.
I would like to create a good framework for dynamic dialgs without having to mess with the resource editor.
BTW, Can anyone point me to a good book or website dealing with creating controls dynamically at runtime?
TIA
-
May 18th, 1999, 05:26 AM
#2
Re: Dynamic Controls
Hello!
I had the same problem with editbox created dynamiclly. It disappeared when I followed the following style.
void CPropEdit::Create(DWORD style, const RECT &rect, CWnd *pParentWnd, int nNewIndex)
{
CreateEx(WS_EX_CLIENTEDGE, "EDIT", "", WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_AUTOHSCROLL | style, rect, pParentWnd, 0);
SetFont(pParentWnd->GetFont(), FALSE);
nIndex=nNewIndex;
}
Here I used nIndex to keep track of componentindexes in the dialog.
Good luck
Hussam
-
May 18th, 1999, 07:42 AM
#3
Re: Dynamic Controls
I came across the same problem before with a custom (CEdit based) control we use at work. I found that by hiding and re-showing it that it drew properly.CMyEdit myEdit;
myEdit.Create(.........);
myEdit.ShowWindow(SW_HIDE);
myEdit.ShowWindow(SW_SHOW);
Ugly, but it worked.
-
May 18th, 1999, 09:24 AM
#4
Re: Dynamic Controls
Many thanks, it worked like a charm!
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
|