Re: Problem dynamically creating Custom Controls




Ajay Kalra wrote:
I want to create a custom control dynamically that displays a row with
4 controls for 0 to N number of drawings that I will only know only at
runtime.

My problem is that in the Parent Dialog the create function always
returns 0 and then never displays. Per MSDN I expect a Return Value =
Nonzero if successful; otherwise 0. Hence, I am failing every time.
Note, I am ably to display my custom control properly if I place it at
design time, but that will not work.

The control needs to be created after dialog has been created. That
means you cant create these in Dialog's constructor. Do it in
OnInitDialog after calling the base class's OnInitDialog.

---
Ajay

I believe this is what I am already doing.

Parent Dialog
BOOL ReviewDialog::OnInitDialog()
{
CDialog::OnInitDialog(); //Create Dialog
BOOL bcreate;

//Create Control
bcreate = m_testRow.Create(MYWNDCLASS,NULL, WS_CHILD | WS_VISIBLE
,CRect(0, 500, 180, 600),this,1);//Returns unsuccesful 0 every time.

.



Relevant Pages

  • Re: MFC and c++ problems
    ... You say that a control must make no assumptions about its parent. ... messages to its parent will compile and run ... ... One could write an interface class that supported the methodneeded by ...
    (microsoft.public.vc.mfc)
  • Re: Controls - Page_init order
    ... the control after the Page_Load. ... Parent that says "Inside the Parent Page_Load", ... e as EventArgs) Dim sTest as String trace.warn("Inside the ... execute first before anything else since it is initialization code. ...
    (microsoft.public.dotnet.framework.aspnet)
  • RE: Master Detail Event Handling?
    ... > Your example hides the child records unless the user clicks the parent row. ... > then use to identify the child control to work with the child control events. ... >>> Parent Record ...
    (microsoft.public.dotnet.framework.aspnet.webcontrols)
  • Re: MFC and c++ problems
    ... including CWinApp, CView, or CDialog classes that might contain it. ... You say that a control must make no assumptions about its parent. ... messages to its parent will compile and run ... ...
    (microsoft.public.vc.mfc)
  • Re: Getting components name from notification parameter?
    ... Parent or perhaps the Form they're on somehow, ... You can make the windowed control refer to the translation component ... inner component, it automatically goes away once the component has ... The Owner is passed from the TTranslator instance to the TWCMessage ...
    (alt.comp.lang.borland-delphi)