Controls within an MDI view

From: Les Paul (none_at_none.none)
Date: 11/12/04


Date: Fri, 12 Nov 2004 09:53:32 GMT

Hi,

I've seen a few threads on this, all of them several years old now. And
I've tried what I saw in those threads with no luck. All I want to do is
add a few controls inside my MDI doc/view windows.

So, in my xxxview.h file, I have:
  public:
  CButton bbb;

And in my xxxview.cpp file, I have:
  int CxxxView::OnCreate(LPCREATESTRUCT lpCreateStruct)
  {
    if (CView::OnCreate(lpCreateStruct) == -1)
      return -1;

    bbb.Create("hello", WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON,
               CRect(50, 50, 200, 100), this, 555);

    return 0;
  }

It builds fine, but I don't get a button. It seems like the button might
be there for a second, but then gets covered by the white background of
the document. That's really just a guess, though. I end up with a blank
white document window and no button.

Things I've tried (that didn't help):
Calling bbb.ShowWindow(SW_SHOW)
Calling bbb.CreateEx instead of just bbb.Create
Using a different control ID
Moving bbb into the ChildFrame class instead of the View class
Using different styles for the button (like TABSTOP)

I did an experiment by moving bbb into the MainFrame class, and that
kinda worked, but not really. This isn't a solution, anyway.

Any help would be appreciated.
Pat


Quantcast