Board index » delphi » MDI frame with a toolbar

MDI frame with a toolbar

Hi,
   I'm trying to convert an application to MDI-compliant form, and I have
a problem with the toolbar, which is currently implemented as a simple
child window with buttons.
Specifically, how do I tell Windows that
the client area for the child windows should not include the toolbar at the
top? I'm using TPW 1.5, so no fancy OWL or MFC classes please!

Thanks
  Eyal Doron

 

Re:MDI frame with a toolbar


Quote
do...@mickey.mpi-hd.mpg.de (Eyal Doron) wrote:
>Hi,
>   I'm trying to convert an application to MDI-compliant form, and I have
>a problem with the toolbar, which is currently implemented as a simple
>child window with buttons.
>Specifically, how do I tell Windows that
>the client area for the child windows should not include the toolbar at the
>top? I'm using TPW 1.5, so no fancy OWL or MFC classes please!

Hi,
all you need to do is to process the WM_SIZE message for your frame
window. There, you size the toolbar such that it fills the top row of
your frame window's client area. You will need to know the height of
your toolbar window. You subtract this height from the area available
to the client window, and set the client are appropriately:

/* processing of WM_SIZE */
void FrameWnd_OnSize(
                   HWND hWnd,         /* frame window handle */
                   UINT SizeType,     /* WPARAM */
                   int cx,            /* width = LOWORD(lParam) */
                   int cy)            /* height = HIWORD(lParam) */
{
     MoveWindow(hwndBtnbar, 0, 0, cx, BAR_HEIGHT, TRUE);
     MoveWindow(hwndClient, 0, BAR_HEIGHT, cx, cy - BAR_HEIGHT, TRUE);

Quote
}

Sorry, this is in C, but should give you the idea.
Good Luck, Klaus
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Klaus Eichele         keich...@is.dal.ca  
http://is.dal.ca/~keichele/keichele.html

Re:MDI frame with a toolbar


Quote
Eyal Doron wrote:

> Hi,
>    I'm trying to convert an application to MDI-compliant form, and I have
> a problem with the toolbar, which is currently implemented as a simple
> child window with buttons.
> Specifically, how do I tell Windows that
> the client area for the child windows should not include the toolbar at the
> top? I'm using TPW 1.5, so no fancy OWL or MFC classes please!

I'll assume you have the child/parent relationships correct, i.e. toolbar
child of frame window, doc windows children of MDI client.

One way is to process WM_SIZE, subtract what's used by the toolbar, then
pass it on.  More general implementation would create a rect structure
initialized to client area size, pass it on to all toolbars and such to
allow them to subtract their own area, then set size of MDI client window.

- Alf

Re:MDI frame with a toolbar


one of these days Alf P. Steinbach (al...@online.no) wrote:

Quote
: Eyal Doron wrote:

: >
: > Hi,
: >    I'm trying to convert an application to MDI-compliant form, and I have
: > a problem with the toolbar, which is currently implemented as a simple
: > child window with buttons.
: > Specifically, how do I tell Windows that
: > the client area for the child windows should not include the toolbar at the
: > top? I'm using TPW 1.5, so no fancy OWL or MFC classes please!

: I'll assume you have the child/parent relationships correct, i.e. toolbar
: child of frame window, doc windows children of MDI client.

: One way is to process WM_SIZE, subtract what's used by the toolbar, then
                        ^^^^^^^

  Make that WM_WINDOWPOSChanging. Subclass MDI client and process this
  message.

Alex

Re:MDI frame with a toolbar


Quote
alex korobka wrote:

> one of these days Alf P. Steinbach (al...@online.no) wrote:
> : Eyal Doron wrote:
> : >
> : > Hi,
> : >    I'm trying to convert an application to MDI-compliant form, and I have
> : > a problem with the toolbar, which is currently implemented as a simple
> : > child window with buttons.
> : > Specifically, how do I tell Windows that
> : > the client area for the child windows should not include the toolbar at the
> : > top? I'm using TPW 1.5, so no fancy OWL or MFC classes please!

> : I'll assume you have the child/parent relationships correct, i.e. toolbar
> : child of frame window, doc windows children of MDI client.

> : One way is to process WM_SIZE, subtract what's used by the toolbar, then
>                         ^^^^^^^

>   Make that WM_WINDOWPOSChanging. Subclass MDI client and process this
>   message.

> Alex

Uh, could you elaborate?  WM_SIZE works just fine in the toolbar unit
supplied by Borland with BPW 7.0 (not a general unit, an example prog).
You get in earlier in the sizing process, but doesn't seem to matter?

- Alf

Other Threads