Dynamic controls
-
I have a property page that is used multiple times in a wizard with slight variations each time. Therefore for each instance of the page I want to show/not show various controls. How do I do that? I thought I could just make a control variable and then do something like m_nListBox1.SetVisible or something or other. How do I dynamically make controls visible and invisible? I am missing something obvious and it must be because I got up far too early this morning.
-
I have a property page that is used multiple times in a wizard with slight variations each time. Therefore for each instance of the page I want to show/not show various controls. How do I do that? I thought I could just make a control variable and then do something like m_nListBox1.SetVisible or something or other. How do I dynamically make controls visible and invisible? I am missing something obvious and it must be because I got up far too early this morning.
use CWnd::ShowWindow function to show or hide them.
-
use CWnd::ShowWindow function to show or hide them.
Tried this in OnInitDialog and OnSetActive. Causes and assertion both times.
-
Tried this in OnInitDialog and OnSetActive. Causes and assertion both times.
ShowWindow is THE API to use to show and hide windows, if your window does not exist yet, the function will assert. Try making sure that the window you are calling this function on is valid before you call this function. an exmaple of this would be Page::OnInitDialog(); { BOOL ret = CPropertyPage::OnInitDialog(); CWnd *pWnd = GetDlgItem(IDC_MY_WINDOW); if (!pWnd || !::IsWindow(pWnd->GetSafeHwnd()) { ASSERT(FALSE); } else pWnd->ShowWindow(SW_HIDE); // or whatever you want to do with it. } Did you use classwizard to generate control variables for your window objects? /yawar