Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do you default a checkbox to checked on 2nd property page

Status
Not open for further replies.

Technokrat

Programmer
Jul 20, 2001
92
0
0
US
How do you default a checkbox to checked on 2nd property page?

I have a tab control page with 2 tabs. I have a checkbox on the 2nd tab that needs to default to checked when adding a new record. However, on an add, the handle for the checkbox isn't available until the user clicks NEXT after filling in the info for the first tab. How do I get around this?
 
I figured out one method to do it, but there may be a better one. I added the following to the OnEvent function of the master form for the property pages.
Code:
switch(nEvent)
{
case  TABEVT_MOVENEXT:
   if( m_DlgMode == ADD )
     ((CButton*)m_ptrPage2->GetDlgItem(IDC_CHK_BOX))->SetCheck(1);
break
...
 
TabControl pages do not get initialized until they are used for the first time. A better approach might be to have an object that keeps copies of values from all the pages, and when the page gets initialized (or shown) - they are filled in with values from the object. The object as well gets synchronized when values change in tab pages.

------------------
When you do it, do it right.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top