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 » Inplace toolbar next to scroll bars Collapse All
Subject Author Date
Bacsó Gergely Jan 23, 2006 - 10:37 AM

First of all, thank You for your support so far, You helped me a lot!

My current problem is that I tried to create a toolbar next to scroll bars, like it is in AdoRecordsetView.
I copy-pasted all the code from the prof-uis help (FAQ/Scrollable Windows), but it doesn’t work at all!
You can download my mini app from http://bgergo.sytes.net/ScrollTest.zip. Please send me some working code if you have time!

Thanks,
Gergely Bacso

Technical Support Jan 27, 2006 - 4:42 AM

You can download the modified project from our website. There was one critical error in your source code in the ChildView.cpp file:

BEGIN_MESSAGE_MAP(CChildView, CWnd)
which in fact should be:
BEGIN_MESSAGE_MAP(CChildView, CExtScrollWnd)
Another error is that you forgot to initialize the command profile in the command manager. We did this in the CMainFrame::OnCreate() method:
g_CmdManager->ProfileWndAdd( NULL, m_hWnd );
This is essential and allows the icons to be displayed (on the Prof-UIS toolbar next to the horizontal scroll bar). Besides, you have your own scrollable window. We recommend you override the following members of the CExtScrollWnd class:
virtual CSize OnSwGetTotalSize() const;
virtual CSize OnSwGetPageSize( int nDirection ) const;
virtual CSize OnSwGetLineSize( int nDirection ) const;
virtual void OnSwPaint( CDC & dc );
The first three methods should just return information about the current dimensions of the scrollable content. You need to implement the painting in the last one. If the dimensions change, then you need just to invoke the OnSwUpdateScrollBars() method.

Bacsó Gergely Jan 27, 2006 - 9:20 AM

I didn’t want the scroll bars to flicker and I wanted to use CExtScrollWnd in a CView-derived class so I had to face some other problems as well,
so I decided to write my own inplace toolbar and scrollbar positioning mechanism.

The problem I have is that I don’t know the size the toolbars prefer (depending on button width, count).
How do I get the desired size of a CExtToolControlBar when the buttons are aligned in a horizontal line or a vertical line?

Technical Support Jan 27, 2006 - 12:41 PM

The width of the horizontal toolbar has a linear dependency of the summary width of its buttons + 4 pixels for borders. The same is true for the vertical toolbar.

Bacsó Gergely Jan 28, 2006 - 7:34 AM

Is there a function to calculate it, so that I don’t have to change the width calculation code when I change toolbar buttons?
CalcFixedLayout() is almost good, but it returns a bit bigger size.

Technical Support Jan 30, 2006 - 5:47 AM

We have no such function but it is not difficult to implement it. The CExtToolControlBar::GetButtonsCount() method returns the number of buttons in the toolbar. The CExtToolControlBar::GetButton() method returns a pointer to the CExtBarButton object by index. The CExtBarButton class implements the generic toolbar button in the CExtToolControlBar window. You can invoke the CExtBarButton::CalculateLayout() method to get the button’s size. All these methods allow you to compute the desired size of the toolbar window next to the scroll bar.

Bacsó Gergely Jan 31, 2006 - 6:55 AM

Thank you!