SplitterWindow



  • Hallo,

    ich habe wieder mal ein kleines Problem.
    Ich habe ein Fenster, das ist geteilt in 2 "Frames"

    if (!m_wndSplitter.CreateView(0, 0, RUNTIME_CLASS(CLeftView), CSize(900, 400), pContext) ||
      !m_wndSplitter.CreateView(1, 0, RUNTIME_CLASS(CEditorView), CSize(900, 200), pContext))
     {
      m_wndSplitter.DestroyWindow();
      return FALSE;
     }
    

    Nun möchte ich gern den oberen Frame aktualisieren. Normalerweise macht man das ja mit UpdateWindow(), aber es wird dabei einfach nicht die Methode OnDraw in der Klasse CLeftView nicht aufgerufen sondern irgendwas ich weiß es leider nicht.
    Wie kann ich jetzt das obere Fenster dazu zu bewegen, dass es sich neuzeichnet oder auch das komplette Fenster, das wäre auch nciht so schlimm.

    Kann mir da jemand weiterhelfen?

    Danke

    Christoph



  • Versuchs mal mit Invalidate() oder RedrawWindow() ...

    Gruß
    :: NoName ::



  • habe ich bereits das führt nicht zum Erfolg.



  • Hi,

    das folgende habe ich aus dem Buch von Prosise "Programming Windows with MFC":

    Concurrent views of a document displayed in a splitter window must be synchronized just like concurrent views in an MDI application. The call to UpdateAllViews in CSketchDoc::AddLine ensures that both views are updated if the window is split when a line is drawn. Rather than rely on the default implementation of OnUpdate, CSketchView overrides OnUpdate and performs a "smart update" by relying on hint information passed to UpdateAllViews. Specifically, each time a line is added to the document, AddLine calls UpdateAllViews and passes a CLine pointer referencing the new line in pHint:

    UpdateAllViews (NULL, 0x7C, pLine);

    The view's OnUpdate function casts pHint back to a CLine and asks the CLine to draw itself on the screen:

    void CSketchView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint)
    {
    if (lHint == 0x7C) {
    CLine* pLine = (CLine*) pHint;
    ASSERT (pLine->IsKindOf (RUNTIME_CLASS (CLine)));
    CClientDC dc (this);
    OnPrepareDC (&dc);
    pLine->Draw (&dc);
    return;
    }
    CScrollView::OnUpdate (pSender, lHint, pHint);
    }

    This is much more efficient than redrawing the entire view with OnDraw because updating a view involves drawing just the one new line no matter how many lines are stored in the document. As a result, Sketch doesn't exhibit the flashing effect that afflicts MdiSquares.

    Ich habe das so verwendet und hat einwandfrei funktioniert. Der Trick dabei ist, dass Du über den zweiten Parameter von UpdateAllViews steuern kannst, welchen View Du in welcher Form updaten willst.

    Gruss

    yeti


Anmelden zum Antworten