?
Solved

How to resize a dialog bar ?

Posted on 1998-12-11
7
Medium Priority
?
436 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
[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
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

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 200 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

Technology Partners: 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!

Question has a verified solution.

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

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Suggested Courses
Course of the Month8 days, 14 hours left to enroll

764 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