Solved

How to resize a dialog bar ?

Posted on 1998-12-11
7
413 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
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
iSeries FTP Exit Program 8 145
Folder Comparison 12 54
Expand data scrubbing tool 13 35
Can not remove SSL certificate on iPhone 6 - iOS10.2 12 814
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…
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
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.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

789 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