Solved

How to resize a dialog bar ?

Posted on 1998-12-11
7
421 Views
Last Modified: 2013-11-20
I wish to write an MDI application which upon starting up, a workspace window will appear on the left of the main frame. I tried to use  CDialogBar class to implement. It works well except I could not resize it.

Will anyone tell me how to around this problem ?

Thank you all

Serhan
0
Comment
Question by:Serhan
7 Comments
 
LVL 4

Expert Comment

by:pagladasu
ID: 1326068
To resize the dialogbar, obtain a pointer to it and then use the MoveWindow() function.
0
 

Expert Comment

by:dagangwang
ID: 1326069
Because CDialogBar is a window, you can use SetWindowPos to rsposition or move.
0
 

Expert Comment

by:dagangwang
ID: 1326070
You can add splitter window. Your DialogBar is inserted left one. When drag split border,
you should resize DialogBar height. Thus you can imitate resizing function.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Serhan
ID: 1326071
Have tried to use MoveWindow and SetWindowPos but they did not work as expected.
0
 
LVL 2

Expert Comment

by:wyy_cq
ID: 1326072
please use the docking window .
0
 
LVL 3

Accepted Solution

by:
shaig earned 100 total points
ID: 1326073
Note that MoveWindow has a strang way of passing params:
The first two are coordinates, while the following are not! they specify widh and hight.
Check if you passed params correctly, i hope this helps.
0
 
LVL 4

Expert Comment

by:pagladasu
ID: 1326074
Here is some information that might help.
To make a dialog bar resizable:

1.Use the new CBRS_SIZE_DYNAMIC style when creating the dialog bar.

2.Add code to an override of the new CalcDynamicLayout() function.

Control bars support the new CBRS_SIZE_DYNAMIC style. CBRS_SIZE_DYNAMIC allows a floating control bar to be dynamically resized when the user drags the control bar's border. The virtual function
CControlBar::CalcDynamicLayout() has been added to determine the size that a control bar should be resized to.

CalcDynamicLayout() is called for CBRS_SIZE_DYNAMIC control bars when the border of a floating control bar is dragged and when the control bar is docked or floated. The default CControlBar implementation simply calls CalcFixedLayout(), which prevents control bar objects from resizing unless CalcDynamicLayout() is overridden. CDialogBar does not override CalcDynamicLayout(), so by default, dialog bars are not resizable.

To make a resizable dialog bar:

1.Create a new class derived from CDialogBar and override the CalcDynamicLayout() function. Depending on the behavior you
want, it may be necessary to add a member variable to the class.

2.Create an instance of this class using the CBRS_SIZE_DYNAMIC style bit. Dialog bars are typically created in
         CMainFrame::OnCreate():
         if (!m_wndDialogBar.Create(this, IDD_DIALOGBAR,
         CBRS_TOP | CBRS_SIZE_DYNAMIC, 777)) {
            TRACE0("Failed to create dialogbar\n");
               return -1;
      }
      m_wndDialogBar.EnableDocking(CBRS_ALIGN_ANY);
        DockControlBar(&m_wndDialogBar);

Hope this helps
thanks
pagladasu
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Expand to include initial dialog with two choices. 9 86
has77  challenge 9 98
Use of condition with 'serial' in ansible 2 87
Path of Workbook 3 87
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

749 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