Beispiel #1
0
BOOL CMainWindow::Create() {
	newWindowX = newWindowY = 0;

	BOOL retval = LoadFrame( IDR_MAINWINDOW );

	userListWnd = NULL;
	
	if ( retval ) {
		retval = toolbar.Create( this, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_FLYBY | CBRS_TOOLTIPS );
	}

	if ( retval ) {
		retval = toolbar.LoadToolBar( IDR_MAINWINDOW );
	}

	if ( retval ) {
		status.Create( this );
		UINT indicator = ID_SEPARATOR;
		status.SetIndicators( &indicator, 1 );
	}

	if ( retval ) {
		chooser = new CStudentChooserWnd();
		retval = chooser->Create( this );
	}

	chooser->ShowWindow( preferences.GetInt( "ChooserWindowState" ) );

	if ( !preferences.GetBool( "ShowStudentChooser" ) ) {
		chooser->ShowWindow( SW_HIDE );
	}

	return retval;
}
void CStudentChooserDlg::DoDataExchange( CDataExchange* pDX ) {
    CDialog::DoDataExchange( pDX );
    DDX_Control( pDX, IDC_SEARCHFIRSTNAME,  searchFirstName );
    DDX_Control( pDX, IDC_SEARCHLASTNAME,   searchLastName );
    DDX_Control( pDX, IDC_SEARCHSSN,        searchSSN );
    DDX_Control( pDX, IDC_SEARCHCHECK,      searchCheck );
    DDX_Control( pDX, IDC_STUDENTLIST,      studentList );
    DDX_Control( pDX, IDC_NEWSTUDENT,       newButton );
    DDX_Control( pDX, IDC_OPENSTUDENT,      openButton );
    DDX_Control( pDX, IDC_SEARCHBUTTON,     searchButton );
    DDX_Control( pDX, IDC_SEARCHSCHOOLYEAR, schoolYearList );

    searchCheck.SetCheck( 1 );

    schoolYearList.DisableNull();
    schoolYearList.SetList( storage.GetSchoolYearList() );

    RefreshStudentList();

    searchLastName.SetFocus();

    if ( !user.CanWrite() ) {
        newButton.EnableWindow( FALSE );
    }

    try {
        schoolYearList.Select( preferences.GetInt( "CurrentSchoolYear" ) );
        RefreshStudentList();
    }
    catch (...) {}
}