Annoying doc/view problems - Programmer

This is a discussion on Annoying doc/view problems - Programmer ; I'm trying to get an MDI application to work, and have run into some problems. 1. Window resize: I have an image window in the app. I am able to trap the OnMinMaxInfo event in the CMDIChildWnd so that when ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Annoying doc/view problems

  1. Annoying doc/view problems

    I'm trying to get an MDI application to work, and have run into
    some problems.

    1. Window resize: I have an image window in the app. I am able
    to trap the OnMinMaxInfo event in the CMDIChildWnd so that when
    the user maximizes the window, I can restrict its size to the bitmap
    image size. However, the scrollbars screw everything up as I need to
    account for them when setting the frame size. Even if I could obtain the
    size of a scrollbar (instead of just plugging in a magic number),
    the scrollbars come and go as there are multiple OnMinMaxResize
    events; i.e.:

    CChildWnd::OnGetMinMaxInfo(...
    CView *view = GetActiveView();
    BOOL horz,vert;
    view->CheckScrollBars(horz, vert);
    if (horz) window_size.cx += sb_horz_size
    ...

    When I hit the maximize button, I see two events: the first event
    has scrollbars, but the second event does not see scrollbars. So,
    it ends up computing a window size slightly too small. And always
    blindly adding a scrollbar width mo matter what doesn't work either
    because the window border won't wrap around the image nicely. I tried doing
    it in the CScrollView class, but I can't get it to receive the
    event, and in any case I think it would have the same problem too.

    2. The doctemplate framework wants to create an empty doc when the
    application is started. I don't want it to do that. I put in a
    kludge where the first thing it does is call CloseAllDocuments(0)
    right after the AddDocTemplate instantiation. That works, but there's
    got to be a better way, and it also looks weird when the application
    starts as it creates a window and then kills it.

  2. Re: Annoying doc/view problems

    i can offer a solution for your 2nd problem. here's one way to do it:
    there should be a call to "ProcessShellCommand" in your CWinApp-derived
    InitInstance() function. right before that call is made, override 'cmdInfo'
    as so:

    // override default for new file
    cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing;

    if( !ProcessShellCommand( cmdInfo ) )
    {
    return FALSE;
    }



    "bikerider7" wrote in message
    news:d35d6005.0404141157.18f6a740@posting.google.c om...
    I'm trying to get an MDI application to work, and have run into
    some problems.

    1. Window resize: I have an image window in the app. I am able
    to trap the OnMinMaxInfo event in the CMDIChildWnd so that when
    the user maximizes the window, I can restrict its size to the bitmap
    image size. However, the scrollbars screw everything up as I need to
    account for them when setting the frame size. Even if I could obtain the
    size of a scrollbar (instead of just plugging in a magic number),
    the scrollbars come and go as there are multiple OnMinMaxResize
    events; i.e.:

    CChildWnd::OnGetMinMaxInfo(...
    CView *view = GetActiveView();
    BOOL horz,vert;
    view->CheckScrollBars(horz, vert);
    if (horz) window_size.cx += sb_horz_size
    ...

    When I hit the maximize button, I see two events: the first event
    has scrollbars, but the second event does not see scrollbars. So,
    it ends up computing a window size slightly too small. And always
    blindly adding a scrollbar width mo matter what doesn't work either
    because the window border won't wrap around the image nicely. I tried doing
    it in the CScrollView class, but I can't get it to receive the
    event, and in any case I think it would have the same problem too.

    2. The doctemplate framework wants to create an empty doc when the
    application is started. I don't want it to do that. I put in a
    kludge where the first thing it does is call CloseAllDocuments(0)
    right after the AddDocTemplate instantiation. That works, but there's
    got to be a better way, and it also looks weird when the application
    starts as it creates a window and then kills it.



+ Reply to Thread