CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2015
    Posts
    6

    Need to delete earlier dynamic controls and redraw in a dialog

    Name:  SampleApp.jpg
Views: 619
Size:  30.6 KB

    I've created a dialog based MFC app which input from user to create that many dynamic controls(Used checkbox to be created dynamically).

    After user input that many checkboxes controls are created but if try to click again then not able to delete previous controls and again new no. of controls.
    Code snippet to add controls on usre input.
    RECT rctA;
    rctA.top = 51;
    rctA.bottom = 80;
    CString temp;
    m_Edit.GetWindowText(temp);
    int noOfControls = _tstoi(temp);

    for(int i=0;i < noOfControls; ++i)
    {
    m_CheckBox[i].Create(_T(""), WS_CHILD|WS_VISIBLE|BS_AUTOCHECKBOX ,
    CRect(10,rctA.top,30,rctA.bottom ), this, 1+i);
    rctA.top+=30;
    rctA.bottom+=30;
    }

  2. #2
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,635

    Re: Need to delete earlier dynamic controls and redraw in a dialog

    The counterpart to Create is DestroyWindow. What are you doing and why isn't it working?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured