🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.windows.ms.programmer
Article #2718

Re: Status/Message bars - suggestions?

#2718
From: Risto Lankinen
Date: Fri, 17 May 1991 08:30
51 lines
2756 bytes
6600phnx@ucsbuxa.ucsb.edu (Phoenix / Fig) writes:

>This has probably been asked before but does anyone have a good
>suggestion on how to implement status/message bars on the top and bottom
>of the window client area, with and without MDI?  You know, for
>description of menu items and such ala W4W.  That be all ...

Hi!

I'll employ maximum brevity, so that FAQ could be updated if appropriate.

Add the following code fragments to the indicated places in the WinProc()
of an application, or the FrameWinProc() of a MDI application.
    ...
  case WM_CREATE:
    hWndClient = CreateWindow( "MDIClient",...,
          WS_CHILD|WS_VISIBLE|WS_CLIBSIBLINGS|WS_HSCROLL|WS_VSCROLL,... );
    hWndStatus = CreateWindow( "Static",...,
          WS_CHILD|WS_VISIBLE|SS_LEFT|SS_NOPREFIX,... );
    ...
  case WM_SIZE:
    GetClientRect( hWnd,&rect );
    // Calculate DIVIDING_LINE s.t. rect.top < DIVIDING_LINE < rect.bottom
    // One choice: DIVIDING_LINE = rect.bottom-GetSystemMetrics(SM_CYMENU);
    MoveWindow( hWndClient,rect.left,rect.top,
          rect.right,DIVIDING_LINE,TRUE );
    MoveWindow( hWndStatus,rect.left,DIVIDING_LINE,
          rect.right,rect.bottom,TRUE );
    ...
    break;  // Do *not* pass to DefFrameProc() of a MDI application !!!
    ...
    // To change the status text:
    SendMessage( hWndStatus,WM_SETTEXT,0,(LONG)(LPSTR)szStatusText );

Notes:
  - For non-MDI applications, all references to hWndClient above will simply
    be removed.
  - Menu selection can be tracked by setting the status text at a response to
    the WM_MENUSELECT message.
  - To draw a line between status bar and the rest of the client area, the
    DIVIDING_LINE should be adjusted in either MoveWindow() call to leave a
    gap between, which is called InvalidateRect() for, and actually being
    painted in response to the WM_PAINT .
  - The parent window should have WS_CLIPCHILDREN style bit set.

Terveisin: Risto Lankinen
-- 
Risto Lankinen / product specialist ***************************************
Nokia Data Systems, Technology Dept *  2                              3   *
THIS SPACE INTENTIONALLY LEFT BLANK * 2 +1 is PRIME!  Now working on 2 -1 *
replies: risto@yj.data.nokia.fi     ***************************************
Technical Details
Message-ID: <1177@tuura.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!elroy.jpl.nasa.gov!decwrl!fernwood!uupsi!sunic!news.funet.fi!fuug!tuura!risto
References: <11278@hub.ucsb.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!elroy.jpl.nasa.gov!decwrl!fernwood!uupsi!sunic!news.funet.fi!fuug!tuura!risto
From: risto@tuura.UUCP (Risto Lankinen)
Newsgroups: comp.windows.ms.programmer
Subject: Re: Status/Message bars - suggestions?
Message-ID: <1177@tuura.UUCP>
Date: 17 May 91 08:30:15 GMT
References: <11278@hub.ucsb.edu>
Distribution: comp
Organization: Nokia Data Systems Oy
Lines: 51