Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS General Discussion » Setting the Size of a Dialog Bar Collapse All
Subject Author Date
Bill Olson Oct 7, 2009 - 4:41 AM

I am continuing to try and adopt our existing application to Prof UIS.  We have a number of dialog bars derived from CDialogBar.  As I understand it, I should create a CExtControlBar, then the controls should be in a CExtResizableDialog.  I’ve been working in an experimental application to prevent trashing the main ap too much.


So far I’ve been able to get the dialog bar to display, but sizing is proving to be a problem.  I need to be able to control the size of the bar programatically and I don’t want the user to be able to resize it.  I derived my own CExtControlBar class below


class CNewControlBar : public CExtControlBar

{

public:



    inline CNewControlBar::CNewControlBar()  {    m_bFixedMode = true;};

    virtual void _RowResizingStart() const {};

    virtual void _RowRecalcingStart() const {};


};


This displays the bar as a fixed size, but the height is not correct.  I also found that I was supposed to make these calls to set the initial size:


    m_dlgbarDlgBar.SetInitDesiredSizeVertical(CSize( 1, 1 ));

    m_dlgbarDlgBar.SetInitDesiredSizeHorizontal(CSize( 1, 1 ));


However, they don’t seem to work.  It doesn’t seem to matter what I put into the CSize call, the bar always draws the same size.  I thought the size of the dialog child might have something to do with the initial size, but even when I made the dialog with a height several times its original size, it still drew the same size.  The CExtControlBar is about 2X the height of the row of controls on the dialog bar and nothing seems to change it.


I tried calling GetWindowRect for the child dialog, then call MoveWindow for the CExtControlBar derived bar, but that did nothing.  When I called GetWindowRect for the control bar, the dimensions returned had top==bottom, and left==right.


 


One of the dialog bars needs to be programatically resized depending on events.  I’m not sure how to go about resizing the bars.


Thanks in advance,


Bill

Technical Support Oct 8, 2009 - 11:17 AM

We guess you simply should use the CExtPanelControlBar class. You can see it with a child dialog in the FixedSizePanels sample application.

Bill Olson Oct 11, 2009 - 4:51 AM

OK, that solves the problem.  I missed the distinction between the CExtControlBar and the CExtPanelControlBar. :(


Thanks,


Bill

Technical Support Oct 7, 2009 - 11:33 AM

The CExtControlBar class implements a control bar which is designed as always resizable without any limits. Besides its size always mutually depends on the size and location of other bars. It’s possible to limit the size of a resizable bar but only in some particular cases. If you want to make your dialog always accessible and always enough big, then you should create a CExtScrollContainerWnd window inside a CExtControlBar window and then create your dialog inside a scrollable container.

Bill Olson Oct 7, 2009 - 11:11 PM

It doesn’t look like my reply went through.  I apologize if this is going over the same ground.


I’m trying to make the control bar smaller, not larger.  For my purposes, a scroll container is not useful.


I was able to make it a fixed size by subclassing CExtControlBar and setting m_bFixedMode to true in the constructor.  However, no matter what I do, I seem to have no control over the size of the bar produced.  It always starts off about twice the height it needs to be (docked to the top), which wastes screen real estate.  I want to make the control bar’s height essentially the same as the dialog contained within it.


It seems you are saying there is no way to programatically control the size of a control bar?  Even if it is adjustable, I would think that a programmer might want to set the initial size in some situations.  It seems like an uneccesary limitation.


Bill