Tech or Treat! Write an article about your scariest tech disaster to win gadgets!Learn more

x
?
Solved

How to resize a dialog bar ?

Posted on 1998-12-11
7
Medium Priority
?
442 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
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!

 

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

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

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

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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.
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

649 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