Professional User Interface Suite, Copyright FOSS Software Inc. Help Published with Permission.

Any button in the caption of a CExtControlBar window is not a button control but rather an object of a CExtBarNcAreaButton-derived class. So such a button is windowless. There are several caption buttons provided by default (see Figure 1):

  •    Hide button (the CExtBarNcAreaButtonClose class).
  •    Options button (the CExtBarNcAreaButtonMenu class), which is displayed in the caption of a floating toolbar.
  •    Auto Hide button (the CExtBarNcAreaButtonAutoHide class).

You can insert your custom button into the caption by overriding the CExtControlBar::OnNcAreaReinitialize() virtual method in a CExtControlBar-derived class. Just look at the code of the original method and add any caption button you need. Such a custom button should be an instance of a CExtBarNcAreaButton-derived class. You can even control its position and put it either on the right side or on the left side of the caption. The task bar (the CMyTaskAreaBar class) in the MDI sample (see Figure 2) can be used as a ready-to-use solution. The CMyTaskAreaBar::CBarNcTaskAreaBtn class implements the Back and Forward buttons. This class overrides all the needed virtual methods of the CExtBarNcAreaButton class:

  •    painting in OnNcAreaDraw()
  •    repositioning in OnNcAreaReposition()
  •    visibility adjustment in OnNcQueryVisibility()
  •    click handling in OnNcAreaClicked()


Figure 1. Caption buttons


Figure 2. Custom caption buttons: Previous page and Next page