Dynamically adding buttons to a view - Programmer

This is a discussion on Dynamically adding buttons to a view - Programmer ; I'm trying to construct a window which mostly contains graphics drawn in my OnDraw() handler, but for which I'd like to have some buttons. So, I have a CButton* u; member in the view, and in the OnInitialUpdate function I ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Dynamically adding buttons to a view

  1. Dynamically adding buttons to a view

    I'm trying to construct a window which mostly contains graphics drawn
    in my OnDraw() handler, but for which I'd like to have some buttons.

    So, I have a CButton* u; member in the view, and in the
    OnInitialUpdate function I do

    u = new CButton();
    u->Create(_T("My button"), WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON,
    CRect(10,10,100,30), this, 0x1234567);

    But no button appears. I get the impression I'm entirely
    misunderstanding some bit of MFC; I've checked that I'm not drawing
    over the button in my OnDraw(). I've tried calling Invalidate(), but
    that doesn't help.

    Tom


  2. Re: Dynamically adding buttons to a view

    The only bit that looks odd to me is your IDC. Try 25000 instead of
    1234567.

    Paul.


+ Reply to Thread