Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - Can the command bar be positioned at bottom right?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Can the command bar be positioned at bottom right?

 Post Reply Post Reply
Author
Message
Josh233 View Drop Down
Newbie
Newbie
Avatar

Joined: 02 May 2007
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote Josh233 Quote  Post ReplyReply Direct Link To This Post Topic: Can the command bar be positioned at bottom right?
    Posted: 02 May 2007 at 3:15am
Hello,
         I Know we can set the command bar at any one of the following positions
  .
  .
    xtpBarTop = 0,        // Docked at top.
    xtpBarBottom = 1,    // Docked at bottom.
    xtpBarLeft = 2,        // Docked at left.
    xtpBarRight = 3,    // Docked at right.
  .
 
But i want to set the position at the bottom right by default.

      I know we can drag the bar to the right but i don't want to do that, i want the command bar to be placed at bottom right whenever the application is opened. Is there any way to do that?
-Joshua
Back to Top
Josh233 View Drop Down
Newbie
Newbie
Avatar

Joined: 02 May 2007
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote Josh233 Quote  Post ReplyReply Direct Link To This Post Posted: 02 May 2007 at 3:21am
Originally posted by Josh233 Josh233 wrote:

Hello,
         I Know we can set the command bar at any one of the following positions
  .
  .
    xtpBarTop = 0,        // Docked at top.
    xtpBarBottom = 1,    // Docked at bottom.
    xtpBarLeft = 2,        // Docked at left.
    xtpBarRight = 3,    // Docked at right.
  .
 
But i want to set the position at the bottom right by default.

      I know we can drag the bar to the right but i don't want to do that, i want the command bar to be placed at bottom right whenever the application is opened. Is there any way to do that?


Sorry I meant Tool Bar of course, please read Tool bar wherever Command bar is mentioned. Really sorry for that.
-Joshua
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 02 May 2007 at 9:15am
Hello,
 
You can place toolbar manually to call GetCommandBars()->DockCommandBar.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Josh233 View Drop Down
Newbie
Newbie
Avatar

Joined: 02 May 2007
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote Josh233 Quote  Post ReplyReply Direct Link To This Post Posted: 03 May 2007 at 4:43am
Hi Oleg,

Thank you very much for the reply. I have tried to place the tool bar to the right by using the following code, but it remains in the same place

    .
    .
   CRect rectBar, rectWnd;
    pStandardBar->GetWindowRect(&rectBar);
    this->GetWindowRect(&rectWnd);
    rectBar.left   += rectWnd.left - rectBar.left;
    rectBar.bottom += rectWnd.bottom - rectBar.bottom;
    rectBar.right   = rectWnd.right;
    rectBar.bottom  = rectWnd.bottom;
    pCommandBars->DockCommandBar(pStandardBar, rectBar,    pStandardBar->GetDockBar());
    .
    .

but this line     pStandardBar->GetWindowRect(&rectBar); returns the rect of the whole window.

Can you please tell me how can i get the rect of the tool bar alone ?
Also is my above coding looks correct? or Am i missing something here?
-Joshua
Back to Top
Josh233 View Drop Down
Newbie
Newbie
Avatar

Joined: 02 May 2007
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote Josh233 Quote  Post ReplyReply Direct Link To This Post Posted: 03 May 2007 at 8:57am
Hurray !! Solved...

These lines solved the problem....

    RecalcLayout(TRUE);
    CXTPWindowRect rectBar(pStandardBar);
    rectBar.OffsetRect(rectBar.Width() * 15, 0);
    pCommandBars->DockCommandBar(pStandardBar, rectBar, pStandardBar->GetDockBar());


Even though not sure putting 15 in the line

    rectBar.OffsetRect(rectBar.Width() * 15, 0); 

is right, this works OK. I tried putting different numbers but putting 15 makes it to work OK. I even tried it with resizing it works OK.

Thanks Oleg for your help
-Joshua
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.156 seconds.