CSplitterWnd, more information, please I need your help for my examen, thanks in advance - Programmer

This is a discussion on CSplitterWnd, more information, please I need your help for my examen, thanks in advance - Programmer ; Hello, I hope someone can fix my problem. I create with two CSplitterWnd in CMainFrame something like this : oooooooooooooooo o o o o o o o o o o oooooooooo o o o o oooooooooooooooo My code is the ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: CSplitterWnd, more information, please I need your help for my examen, thanks in advance

  1. CSplitterWnd, more information, please I need your help for my examen, thanks in advance

    Hello,

    I hope someone can fix my problem. I create with two CSplitterWnd in
    CMainFrame something like this :

    oooooooooooooooo
    o o o o
    o o o o
    o o oooooooooo
    o o o o
    oooooooooooooooo

    My code is the following for OnCreateClient

    BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT /*lpcs*/,
    CCreateContext* pContext)
    {
    if (
    ! m_wndSplitter.CreateStatic(this,1,3) ||
    !
    m_wndSplitter.CreateView(0,0,RUNTIME_CLASS(CExamen 2View),CSize(75,0),pContex
    t) ||
    !
    m_wndSplitter.CreateView(0,1,RUNTIME_CLASS(CMiddel View),CSize(150,0),pContex
    t) ||
    ! m_wndSplitter2.CreateStatic(&m_wndSplitter, 2, 1, WS_CHILD | WS_VISIBLE,
    m_wndSplitter.IdFromRowCol(0,2))||
    !
    m_wndSplitter2.CreateView(0,0,RUNTIME_CLASS(CRecht sBoven),CSize(0,250),pCont
    ext) ||
    !
    m_wndSplitter2.CreateView(1,0,RUNTIME_CLASS(CRecht sOnder),CSize(0,0),pContex
    t))
    return false;
    return true;
    }

    Where CExamen2View is derived from CView and the others or derived from
    CFormView.

    When I run the example it works, but first I get a listbox "New" with my
    "view" classes in like this :
    Examen2View
    MiddelView
    RechtsBoven
    RechtsOnder

    Then I select one (it 's all the same which one I choose) and then I see my
    project correctly. How can I get rid off this enoying listbox ?

    I looked deeper in my problem and now I found where this listbox screen
    appears on my screen. It's in my CExamen2App, more exactly in the function
    InitInstance. It happens between the two messageboxes. See code below.

    BOOL CExamen2App::InitInstance()
    {

    { // BLOCK: doc template registration
    // Register the document template. Document templates serve
    // as the connection between documents, frame windows and views.
    // Attach this form to another document or frame window by changing
    // the document or frame class in the constructor below.
    CSingleDocTemplate* pNewDocTemplate = new CSingleDocTemplate(
    IDR_RECHTSONDER_TMPL,
    RUNTIME_CLASS(CExamen2Doc), // document class
    RUNTIME_CLASS(CMainFrame), // frame class
    RUNTIME_CLASS(CRechtsOnder)); // view class
    AddDocTemplate(pNewDocTemplate);
    }


    { // BLOCK: doc template registration
    // Register the document template. Document templates serve
    // as the connection between documents, frame windows and views.
    // Attach this form to another document or frame window by changing
    // the document or frame class in the constructor below.
    CSingleDocTemplate* pNewDocTemplate = new CSingleDocTemplate(
    IDR_RECHTSBOVEN_TMPL,
    RUNTIME_CLASS(CExamen2Doc), // document class
    RUNTIME_CLASS(CMainFrame), // frame class
    RUNTIME_CLASS(CRechtsBoven)); // view class
    AddDocTemplate(pNewDocTemplate);
    }


    { // BLOCK: doc template registration
    // Register the document template. Document templates serve
    // as the connection between documents, frame windows and views.
    // Attach this form to another document or frame window by changing
    // the document or frame class in the constructor below.
    CSingleDocTemplate* pNewDocTemplate = new CSingleDocTemplate(
    IDR_MIDDELVIEW_TMPL,
    RUNTIME_CLASS(CExamen2Doc), // document class
    RUNTIME_CLASS(CMainFrame), // frame class
    RUNTIME_CLASS(CMiddelView)); // view class
    AddDocTemplate(pNewDocTemplate);
    }

    AfxEnableControlContainer();

    // Standard initialization
    // If you are not using these features and wish to reduce the size
    // of your final executable, you should remove from the following
    // the specific initialization routines you do not need.

    #ifdef _AFXDLL
    Enable3dControls(); // Call this when using MFC in a shared DLL
    #else
    Enable3dControlsStatic(); // Call this when linking to MFC statically
    #endif

    // Change the registry key under which our settings are stored.
    // TODO: You should modify this string to be something appropriate
    // such as the name of your company or organization.
    SetRegistryKey(_T("Local AppWizard-Generated Applications"));

    LoadStdProfileSettings(); // Load standard INI file options (including
    MRU)

    // Register the application's document templates. Document templates
    // serve as the connection between documents, frame windows and views.

    CSingleDocTemplate* pDocTemplate;
    pDocTemplate = new CSingleDocTemplate(
    IDR_MAINFRAME,
    RUNTIME_CLASS(CExamen2Doc),
    RUNTIME_CLASS(CMainFrame), // main SDI frame window
    RUNTIME_CLASS(CExamen2View));
    AddDocTemplate(pDocTemplate);

    // Parse command line for standard shell commands, DDE, file open
    CCommandLineInfo cmdInfo;
    ParseCommandLine(cmdInfo);

    // Dispatch commands specified on the command line
    -----------------> AfxMessageBox("Test 1");

    if (!ProcessShellCommand(cmdInfo))
    return FALSE;

    -----------------> AfxMessageBox("test 2");
    // The one and only window has been initialized, so show and update it.
    m_pMainWnd->ShowWindow(SW_SHOW);
    m_pMainWnd->UpdateWindow();

    return TRUE;
    }

    I hope someone can help me with my problem,

    Thanks in advance,

    Gio



  2. Re: CSplitterWnd, more information, please I need your help for my examen, thanks in advance

    Hi Giovanni,

    > When I run the example it works, but first I get a listbox "New"


    the listbox is caused by the definiton of more than one doc template. MFC
    simply does not know which doc template to use on startup and asks you
    for the right one.

    Now as far as I understand your code, there is just one document type and
    all views are working on this document type. So there is no need for more
    than one doc template. Just delete all the AddDocTemplate calls except one.
    Keep the one that mentions the primary view. If all views are equal, roll the
    dice.

    HTH,
    Frank




  3. Re: CSplitterWnd, more information, please I need your help for my examen, thanks in advance

    Try

    CCommandLineInfo cmdInfo;

    cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing;

    ParseCommandLine(cmdInfo);




    "Giovanni Noppe" wrote in message
    news:40ae8422$0$9868$a0ced6e1@news.skynet.be...
    > Hello,
    >
    > I hope someone can fix my problem. I create with two CSplitterWnd in
    > CMainFrame something like this :
    >
    > oooooooooooooooo
    > o o o o
    > o o o o
    > o o oooooooooo
    > o o o o
    > oooooooooooooooo
    >
    > My code is the following for OnCreateClient
    >
    > BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT /*lpcs*/,
    > CCreateContext* pContext)
    > {
    > if (
    > ! m_wndSplitter.CreateStatic(this,1,3) ||
    > !
    >

    m_wndSplitter.CreateView(0,0,RUNTIME_CLASS(CExamen 2View),CSize(75,0),pContex
    > t) ||
    > !
    >

    m_wndSplitter.CreateView(0,1,RUNTIME_CLASS(CMiddel View),CSize(150,0),pContex
    > t) ||
    > ! m_wndSplitter2.CreateStatic(&m_wndSplitter, 2, 1, WS_CHILD |

    WS_VISIBLE,
    > m_wndSplitter.IdFromRowCol(0,2))||
    > !
    >

    m_wndSplitter2.CreateView(0,0,RUNTIME_CLASS(CRecht sBoven),CSize(0,250),pCont
    > ext) ||
    > !
    >

    m_wndSplitter2.CreateView(1,0,RUNTIME_CLASS(CRecht sOnder),CSize(0,0),pContex
    > t))
    > return false;
    > return true;
    > }
    >
    > Where CExamen2View is derived from CView and the others or derived from
    > CFormView.
    >
    > When I run the example it works, but first I get a listbox "New" with my
    > "view" classes in like this :
    > Examen2View
    > MiddelView
    > RechtsBoven
    > RechtsOnder
    >
    > Then I select one (it 's all the same which one I choose) and then I see

    my
    > project correctly. How can I get rid off this enoying listbox ?
    >
    > I looked deeper in my problem and now I found where this listbox screen
    > appears on my screen. It's in my CExamen2App, more exactly in the function
    > InitInstance. It happens between the two messageboxes. See code below.
    >
    > BOOL CExamen2App::InitInstance()
    > {
    >
    > { // BLOCK: doc template registration
    > // Register the document template. Document templates serve
    > // as the connection between documents, frame windows and views.
    > // Attach this form to another document or frame window by changing
    > // the document or frame class in the constructor below.
    > CSingleDocTemplate* pNewDocTemplate = new CSingleDocTemplate(
    > IDR_RECHTSONDER_TMPL,
    > RUNTIME_CLASS(CExamen2Doc), // document class
    > RUNTIME_CLASS(CMainFrame), // frame class
    > RUNTIME_CLASS(CRechtsOnder)); // view class
    > AddDocTemplate(pNewDocTemplate);
    > }
    >
    >
    > { // BLOCK: doc template registration
    > // Register the document template. Document templates serve
    > // as the connection between documents, frame windows and views.
    > // Attach this form to another document or frame window by changing
    > // the document or frame class in the constructor below.
    > CSingleDocTemplate* pNewDocTemplate = new CSingleDocTemplate(
    > IDR_RECHTSBOVEN_TMPL,
    > RUNTIME_CLASS(CExamen2Doc), // document class
    > RUNTIME_CLASS(CMainFrame), // frame class
    > RUNTIME_CLASS(CRechtsBoven)); // view class
    > AddDocTemplate(pNewDocTemplate);
    > }
    >
    >
    > { // BLOCK: doc template registration
    > // Register the document template. Document templates serve
    > // as the connection between documents, frame windows and views.
    > // Attach this form to another document or frame window by changing
    > // the document or frame class in the constructor below.
    > CSingleDocTemplate* pNewDocTemplate = new CSingleDocTemplate(
    > IDR_MIDDELVIEW_TMPL,
    > RUNTIME_CLASS(CExamen2Doc), // document class
    > RUNTIME_CLASS(CMainFrame), // frame class
    > RUNTIME_CLASS(CMiddelView)); // view class
    > AddDocTemplate(pNewDocTemplate);
    > }
    >
    > AfxEnableControlContainer();
    >
    > // Standard initialization
    > // If you are not using these features and wish to reduce the size
    > // of your final executable, you should remove from the following
    > // the specific initialization routines you do not need.
    >
    > #ifdef _AFXDLL
    > Enable3dControls(); // Call this when using MFC in a shared DLL
    > #else
    > Enable3dControlsStatic(); // Call this when linking to MFC statically
    > #endif
    >
    > // Change the registry key under which our settings are stored.
    > // TODO: You should modify this string to be something appropriate
    > // such as the name of your company or organization.
    > SetRegistryKey(_T("Local AppWizard-Generated Applications"));
    >
    > LoadStdProfileSettings(); // Load standard INI file options (including
    > MRU)
    >
    > // Register the application's document templates. Document templates
    > // serve as the connection between documents, frame windows and views.
    >
    > CSingleDocTemplate* pDocTemplate;
    > pDocTemplate = new CSingleDocTemplate(
    > IDR_MAINFRAME,
    > RUNTIME_CLASS(CExamen2Doc),
    > RUNTIME_CLASS(CMainFrame), // main SDI frame window
    > RUNTIME_CLASS(CExamen2View));
    > AddDocTemplate(pDocTemplate);
    >
    > // Parse command line for standard shell commands, DDE, file open
    > CCommandLineInfo cmdInfo;
    > ParseCommandLine(cmdInfo);
    >
    > // Dispatch commands specified on the command line
    > -----------------> AfxMessageBox("Test 1");
    >
    > if (!ProcessShellCommand(cmdInfo))
    > return FALSE;
    >
    > -----------------> AfxMessageBox("test 2");
    > // The one and only window has been initialized, so show and update it.
    > m_pMainWnd->ShowWindow(SW_SHOW);
    > m_pMainWnd->UpdateWindow();
    >
    > return TRUE;
    > }
    >
    > I hope someone can help me with my problem,
    >
    > Thanks in advance,
    >
    > Gio
    >
    >




+ Reply to Thread