Professional UI Solutions
Site Map   /  Register


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 » Using CExtScrollBars on custom controls using CExtNCSB Collapse All
Subject Author Date
Loïc Hamon Jun 22, 2011 - 6:54 AM


I am currently attempting to apply CExtScrollbars (for which I have custom skins) to all my custom non-ProfUIS components with the CExtNCSB template. Here are the problems I’ve encountered :


On my custom CListCtrl class ( class MyCListCtrl : public CExtNCSB < CListCtrl > ), the CExtScrollbars are applied and are functional, but when I use the up/down buttons or the mousewheel to scroll.. the central part changes to the default windows scrollbar and changes back to the CExtScrollbar when I stop scrolling. If I define the template on the declarations of my custom CListCtrl components ( CExtNCSB < CListCtrl > _ListCtrl1; ) everything works fine (no more flickering to the old scrollbar).


I tried to apply the CExtNCSB template to my custom CTreeCtrl and CListBox components :


class MyCTreeCtrl : public CExtNCSB < CTreeCtrl >

class MyCListBox : public CExtNCSB < CListBox >


And in both cases I get the following compilation error : ’CTreeCtrl/CListBox::CTreeCtrl/CListBox’ : no overloaded function takes 2 arguments.

Instead for MyCListBox I tried to apply the following templates : class MyCListBox : public CExtNCSB_Impl< CExtANCSB < CListBox > > and the CExtScrollbars were applied, but for almost every event on the window / scrollbars (focus gain/loss, scroll up/down, mousewheel, click) they flicker back to the default windows scrollbars and sometimes take a while before turning back to the CExtScrollbars. Again, defining the template on every MyCListBox declaration solves this problem ( CExtNCSB < MyCListBox > _ListBox1;).

I would prefer not having to define the template on every single non-ProfUIS component declaration, just making sure the template is applied properly in the custom non-ProfUIS component classes. Could you please point me in the right direction?

Thanks in advance,


Technical Support Jun 24, 2011 - 12:01 PM

The tree control does not have any tricks related to applying skinned scroll bars. You can use CExtNCSB < CTreeCtrl > or CExtNCSB < CSomeYourTreeCtrl >. Most of other controls are also very friendly to skinned scroll bars. The list box control is OK. The list view control is the only control which uses specific scrolling and you should use a specialized CExtNCSB < CListCtrl > template version with it. This means your CSomeYourListCtrl > class should be derived from CExtNCSB < CListCtrl >. That’s all. If something is still wrong, please send us a test project.

Loïc Hamon Jun 23, 2011 - 1:49 AM

Ah sorry, that was a mis-type : in the (1) the template on component declaration is supposed to be CExtNCSB < MyCListCtrl > _ListCtrl1;

Technical Support Jun 23, 2011 - 1:05 PM

The basic non-specialized version of the CExtNCSB class works with most of the controls. But it does not work with a list view common control and even may crash when in big icon mode. The list view common control uses a very specific scrolling implementation. That’s why we created the CExtNCSB < CListCtrl > and CExtNCSB < CExtListCtrl > specialized versions and that’s why the CExtNCSB < MyCListCtrl > class does not work well. Please derive the MyCListCtrl class from CExtNCSB < CListCtrl > or CExtNCSB < CExtListCtrl >.

Loïc Hamon Jun 23, 2011 - 2:57 PM

My custom CListBox and CListCtrl classes now succesfully have the CExtScrollBars, it was just a problem with the parent function calls which had to have the template called as well (i.e : CExtNCSB_Impl<CExtANCSB<CListBox>>::ParentFunction() ).

Let me be a bit more specific now concerning my CTreeCtrl class. I in fact have 2 extended classes : MyTreeCtrl which extends CTreeCtrl, and MyExtendedTreeCtrl which extends MyTreeCtrl :

class MyTreeCtrl : public CTreeCtrl; and class MyExtendedTreeCtrl : public MyTreeCtrl;

What would be the best way to proceed so that both of these custom tree controls use the CExtScrollbars? (I have tried to apply the CExtNCSB or a combination of CExtNCSB_Impl<CExtANCSB< > > to these controls without any effect or crashes due to activation context exceptions)

Technical Support Jun 22, 2011 - 11:43 AM

If the CExtNCSB < CListCtrl > template based class works OK and your CMyListCtrl class derived from it does not work, then the CMyListCtrl class probably have some virtual methods which invoke incorrect parent class methods or does not perform parent class method invocation at all. You can use the SubclassChildControls() API to subclass most of dialog controls automatically. We decided not to subclass list/view controls because the CExtListCtrl and CExtTreeCtrl controls are not just skinned common controls, they provide additional features which may conflict with features of default list view and tree view common controls in particular cases.