Solved

MDI and TOOLBAR

Posted on 1998-03-10
4
626 Views
Last Modified: 2013-12-03
I am using WIN32 API to create a Window application that have MDI and Toolbar.
The MDI application work fine with the toolbar except that the ToolBar seems to be draw on the client area eventhough I created the toolbar in the frame window. When the app create a child window, the top portion of the child window is covered by the toolbar.

Does anybody have any suggestion how to fix this?
 
0
Comment
Question by:klt
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 15

Expert Comment

by:Tommy Hui
ID: 1411882
If you look at how MFC fixes this problem, you'll see that the toolbar is a child of the frame. The MDI client window has been resized to match the area not taken by the toolbar. All MDI children are children of the MDI client window, so if the MDI client has been resized to not overlap with the toolbar, then neither will the MDI children.
0
 

Author Comment

by:klt
ID: 1411883
Thanks Thui,

I know the theory. However, My application initially created the toolbar and the MDI Client overlap to each other. How can I change my code so that they will not overlap to each other? Is that anything I need to set in order to make them not overlap to each other initially? Can you give me a little more detail how to fix it or point me to some sample code with MDI and Toolbar? I could not find any sample code with MDI and Toolbar in MSDN though.

Following code show how I create the Toobar:

case WM_CREATE:

           hWndToolbar = CreateToolbarEx(
                                   hWnd,                        // parent
                                   WS_CHILD| WS_BORDER| WS_VISIBLE |
                                   TBSTYLE_TOOLTIPS, // window style
                                   IDR_TOOLBAR,           // toolbar id
                                   8,                               // number of bitmaps
                                   ghInstance,                 // mod instance
                                   IDB_TOOLBAR,      // resource ID for bitmap
                                  (LPCTBBUTTON)&tbButtons,  
                                   5,                        
                                  16,16,                    
                                  16,16,                    
                                  sizeof(TBBUTTON));  

                 if (hWndToolbar == NULL )
                     {
                        MessageBox (NULL, "Tool not created!", NULL, MB_OK );
                        return 0;
                     }

Thanks again!
0
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 100 total points
ID: 1411884
Trap WM_SIZE in the MDI frame and given the size of the frame, reposition and resize your MDI client and toolbar so they do not overlap. Calculate the new rectangles for the toolbar and client based on the frame's new size.



0
 

Author Comment

by:klt
ID: 1411885
Thanks!
0

Featured Post

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Run Program using VBScript 3 84
Windows Drag & Drop Location 2 117
Using MS Code on my Mac 6 78
Why is "packages element is not declared"? 2 516
This article shows how to make a Windows 7 gadget that extends its U/I with a flyout panel -- a window that pops out next to the gadget.  The example gadget shows several additional techniques:  How to automatically resize a gadget or flyout panel t…
This article describes how to add a user-defined command button to the Windows 7 Explorer toolbar.  In the previous article (http://www.experts-exchange.com/A_2172.html), we saw how to put the Delete button back there where it belongs.  "Delete" is …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question