Board index » cppbuilder » Docked window bar

Docked window bar

Hello,

How can I prevent the docked window "titlebar" and close button from
appearing in a docked form.

Also does anyone know if there is a ComboBoxEx control somewhere for
BCB4.

Thanks,
------------------------------------------------------------------------
Nicolas Koulouris                        nicolas.koulou...@ift.ulaval.ca

                   "The best way to predict the future is to invent it."

                                                              - Alan Kay

 

Re:Docked window bar


Hi Nicolas --

Quote
> How can I prevent the docked window "titlebar" and close button from
> appearing in a docked form.

The "titlebar" (grabber bar) and close button are rendered by the DockManager,
which defaults to the TDockTree class.  TDockTree renders the grabber bar and
close button in its virtual PaintDockFrame() member function.  Ir offsets the
dock client by the size of the grabber bar in the virtual AdjustDockRect()
member function.  What you can do is create a TDockTree decendant class and
override these two member functions, providing a more customized, or, no
implementation.  For example...

class TMyDockTree : public TDockTree
{
protected:
   virtual void __fastcall AdjustDockRect(TControl* AControl,
      TRect& ARect) { /* do nothing */ }
   virtual void __fastcall PaintDockFrame(TCanvas* ACanvas,
      TControl* AControl, const TRect& ARect) { /* do nothing */ }
public:
   __fastcall TMyDockTree(TWinControl* ADockSite) :
      TDockTree(ADockSite) {}

Quote
};

Now, in order for your dock site to use an instance of TMyDockTree instead of
plain TDockTree, you'll need to augment the dynamic
TWinControl::CreateDockManager() member function.  Within the definition, create
an new instance of TMyDockTree (instead of TDockTree, which the TWinControl
class does). So, for example...

class TDockPanel : public TPanel
{
protected:
   DYNAMIC _di_IDockManager __fastcall CreateDockManager()
   {
      if (!DockManager && DockSite && UseDockManager)
      {
         // create an instance of the derived class TMyDockTree
         TMyDockTree* MyDockTree = new TMyDockTree(this);
         DockManager = static_cast<_di_IDockManager>(*MyDockTree);
      }
      return TPanel::CreateDockManager();
   }
public:
   __fastcall TDockPanel(TComponent* AOwner) : TPanel(AOwner)
   {
      UseDockManager = true;
      DockSite = true;
   }

Quote
};
> Also does anyone know if there is a ComboBoxEx control somewhere for
> BCB4.

Try asking this in the .thirdpartytools group, or alternatively, try searching
the following sites...

Torry's: http://www.torry.ru/
Code Corner: http://www.codecorner.com/

Good luck.

--
Damon Chandler (TeamB)
http://bcbcaq.freeservers.com

Re:Docked window bar


Quote
Damon Chandler wrote:

> class TMyDockTree : public TDockTree
> {
> protected:
>    virtual void __fastcall AdjustDockRect(TControl* AControl,
>       TRect& ARect) { /* do nothing */ }
>    virtual void __fastcall PaintDockFrame(TCanvas* ACanvas,
>       TControl* AControl, const TRect& ARect) { /* do nothing */ }
> public:
>    __fastcall TMyDockTree(TWinControl* ADockSite) :
>       TDockTree(ADockSite) {}
> };

Hello,

Thanks for your nice example. I had to override the PaintSite(HDC DC)
member as well, which is declared in Controls.hpp. For some reason it
worked as is in a sample project I created to test, but created an
unresolved external after integrating the new class/component in the
target application. Of course I'm always interested in knowing why,
since I'm a curious guy, and provided it can be deducted from the line I
inserted. I don't quite know what other information would be relevant to
add..

class TMyDockTree : public TDockTree
{

protected:
   virtual void __fastcall AdjustDockRect(TControl* AControl,
      TRect& ARect) { /* do nothing */ }
   virtual void __fastcall PaintDockFrame(TCanvas* ACanvas,
      TControl* AControl, const TRect& ARect) { /* do nothing */ }
   virtual void __fastcall PaintSite(HDC DC) { /* do nada! */ }

public:
   __fastcall TMyDockTree(TWinControl* ADockSite) :
      TDockTree(ADockSite) {}

Quote
};

Why was it necessary to override it as well? Is it better, worse or
irrelevant(besides allowing linkage)?

Thanks,
------------------------------------------------------------------------
Nicolas Koulouris                        wwwbacc.ift.ulaval.ca/~koulourn

                   "The best way to predict the future is to invent it."

                                                              - Alan Kay

Other Threads