How to dock the second and third toolbars to the right corner of the first toolbar using mfc or win32?

Hi,

I have created a main toolbar, and two more toolbars. All three are
aligned at TOP, one below the other. I use DockControlBar to dock
them.

  m_ToolBar1.EnableDocking(CBRS_ALIGN_TOP|CBRS_ALIGN_BOTTOM);
  m_ToolBar2.EnableDocking(CBRS_ALIGN_TOP|CBRS_ALIGN_BOTTOM);
  m_ToolBar3.EnableDocking(CBRS_ALIGN_TOP|CBRS_ALIGN_BOTTOM);

  	EnableDocking(CBRS_ALIGN_ANY);

  DockControlBar(&m_ToolBar1);
  DockControlBar(&m_ToolBar2);
  DockControlBar(&m_ToolBar3);

It was all fine till this point. The problem comes next.

Now, I need to have them all in a single line. It should look
something like this.

----------------------------------------------------------------------------------------------------------------------------------------------------
|
m_ToolBar1|
|m_ToolBar2|m_ToolBar3|
-----------------------------------------------------------------------------------------------------------------------------------------------------

I tried a lot to bring the toolbars in these positions, but in vain. I
googled a lot and found DockControlBarLeftOf ()sample present in MSDN.
But that too is not serving my purpose, as I need to dock the second
and third toolbars in the top right corner of the First toolbar and
most importantly, the second and third toolbars should be a dockable
ones. So, just cannot use DockControlBarLeftOf().

I would extremly appreciate it, if someone could shed some light on
it, as I tried many many possiblities and found nothing working.
0
rshoba (1)
5/22/2008 3:35:34 AM
vc.mfc 33608 articles. 0 followers. Follow

3 Replies
934 Views

Similar Articles

[PageSpeed] 35

Did you create each of the toolbars with the unique ID?

Victor


"rshoba@gmail.com" wrote:

> Hi,
> 
> I have created a main toolbar, and two more toolbars. All three are
> aligned at TOP, one below the other. I use DockControlBar to dock
> them.
> 
>   m_ToolBar1.EnableDocking(CBRS_ALIGN_TOP|CBRS_ALIGN_BOTTOM);
>   m_ToolBar2.EnableDocking(CBRS_ALIGN_TOP|CBRS_ALIGN_BOTTOM);
>   m_ToolBar3.EnableDocking(CBRS_ALIGN_TOP|CBRS_ALIGN_BOTTOM);
> 
>   	EnableDocking(CBRS_ALIGN_ANY);
> 
>   DockControlBar(&m_ToolBar1);
>   DockControlBar(&m_ToolBar2);
>   DockControlBar(&m_ToolBar3);
> 
> It was all fine till this point. The problem comes next.
> 
> Now, I need to have them all in a single line. It should look
> something like this.
> 
> ----------------------------------------------------------------------------------------------------------------------------------------------------
> |
> m_ToolBar1|
> |m_ToolBar2|m_ToolBar3|
> -----------------------------------------------------------------------------------------------------------------------------------------------------
> 
> I tried a lot to bring the toolbars in these positions, but in vain. I
> googled a lot and found DockControlBarLeftOf ()sample present in MSDN.
> But that too is not serving my purpose, as I need to dock the second
> and third toolbars in the top right corner of the First toolbar and
> most importantly, the second and third toolbars should be a dockable
> ones. So, just cannot use DockControlBarLeftOf().
> 
> I would extremly appreciate it, if someone could shed some light on
> it, as I tried many many possiblities and found nothing working.
> 
0
Victor (177)
5/22/2008 9:08:09 AM
On May 21, 11:35 pm, rsh...@gmail.com wrote:
> Hi,
>
> I have created a main toolbar, and two more toolbars. All three are
> aligned at TOP, one below the other. I use DockControlBar to dock
> them.
>
>   m_ToolBar1.EnableDocking(CBRS_ALIGN_TOP|CBRS_ALIGN_BOTTOM);
>   m_ToolBar2.EnableDocking(CBRS_ALIGN_TOP|CBRS_ALIGN_BOTTOM);
>   m_ToolBar3.EnableDocking(CBRS_ALIGN_TOP|CBRS_ALIGN_BOTTOM);
>
>         EnableDocking(CBRS_ALIGN_ANY);
>
>   DockControlBar(&m_ToolBar1);
>   DockControlBar(&m_ToolBar2);
>   DockControlBar(&m_ToolBar3);
>
> It was all fine till this point. The problem comes next.
>
> Now, I need to have them all in a single line. It should look
> something like this.
>
> ----------------------------------------------------------------------------------------------------------------------------------------------------
> |
> m_ToolBar1|
> |m_ToolBar2|m_ToolBar3|
> -----------------------------------------------------------------------------------------------------------------------------------------------------
>
> I tried a lot to bring the toolbars in these positions, but in vain. I
> googled a lot and found DockControlBarLeftOf ()sample present in MSDN.
> But that too is not serving my purpose, as I need to dock the second
> and third toolbars in the top right corner of the First toolbar and

Picture that you drew above does not match with what you have written.
DockControlBarlefOf should work for m_toolBar2. What you are writing
though is that you want to right justify two toolbars. If yes, MFC
doesnt have anything  like this for docking.

--
Ajay

0
ajaykalra (6842)
5/22/2008 2:02:29 PM
It worked just fine when I tried it like this:

int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
   if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
      return -1;

   if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | 
CBRS_TOP
      | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
      !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
   {
      TRACE0("Failed to create toolbar\n");
      return -1;      // fail to create
   }


   if (!m_wndToolBar2.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | 
CBRS_TOP
      | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
      !m_wndToolBar2.LoadToolBar(IDR_MAINFRAME2))
   {
      TRACE0("Failed to create toolbar\n");
      return -2;      // fail to create
   }

   if (!m_wndToolBar3.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | 
CBRS_TOP
      | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
      !m_wndToolBar3.LoadToolBar(IDR_TOOLBAR1))
   {
      TRACE0("Failed to create toolbar\n");
      return -2;      // fail to create
   }

   if (!m_wndStatusBar.Create(this) ||
      !m_wndStatusBar.SetIndicators(indicators,
      sizeof(indicators)/sizeof(UINT)))
   {
      TRACE0("Failed to create status bar\n");
      return -1;      // fail to create
   }

   m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
   m_wndToolBar2.EnableDocking(CBRS_ALIGN_ANY);
   m_wndToolBar3.EnableDocking(CBRS_ALIGN_ANY);
   EnableDocking(CBRS_ALIGN_ANY);
   DockControlBar(&m_wndToolBar);
   DockControlBar(&m_wndToolBar2);
   DockControlBarLeftOf(&m_wndToolBar3,&m_wndToolBar2);
   return 0;
}

void CMainFrame::DockControlBarLeftOf(CToolBar* Bar, CToolBar* LeftOf)
{
   CRect rect;
   DWORD dw;
   UINT n;

   // get MFC to adjust the dimensions of all docked ToolBars
   // so that GetWindowRect will be accurate
   RecalcLayout(TRUE);

   LeftOf->GetWindowRect(&rect);
   rect.OffsetRect(1,0);
   dw=LeftOf->GetBarStyle();
   n = 0;
   n = (dw&CBRS_ALIGN_TOP) ? AFX_IDW_DOCKBAR_TOP : n;
   n = (dw&CBRS_ALIGN_BOTTOM && n==0) ? AFX_IDW_DOCKBAR_BOTTOM : n;
   n = (dw&CBRS_ALIGN_LEFT && n==0) ? AFX_IDW_DOCKBAR_LEFT : n;
   n = (dw&CBRS_ALIGN_RIGHT && n==0) ? AFX_IDW_DOCKBAR_RIGHT : n;

   // When we take the default parameters on rect, DockControlBar will dock
   // each Toolbar on a seperate line. By calculating a rectangle, we
   // are simulating a Toolbar being dragged to that location and docked.
   DockControlBar(Bar,n,&rect);
}


Here is where got the DockControlBarLeftOf
http://www.codeproject.com/KB/toolbars/toolbar_docking.aspx

AliR.




<rshoba@gmail.com> wrote in message 
news:3939094e-87b9-4133-890d-78546dd45628@y22g2000prd.googlegroups.com...
> Hi,
>
> I have created a main toolbar, and two more toolbars. All three are
> aligned at TOP, one below the other. I use DockControlBar to dock
> them.
>
>  m_ToolBar1.EnableDocking(CBRS_ALIGN_TOP|CBRS_ALIGN_BOTTOM);
>  m_ToolBar2.EnableDocking(CBRS_ALIGN_TOP|CBRS_ALIGN_BOTTOM);
>  m_ToolBar3.EnableDocking(CBRS_ALIGN_TOP|CBRS_ALIGN_BOTTOM);
>
>  EnableDocking(CBRS_ALIGN_ANY);
>
>  DockControlBar(&m_ToolBar1);
>  DockControlBar(&m_ToolBar2);
>  DockControlBar(&m_ToolBar3);
>
> It was all fine till this point. The problem comes next.
>
> Now, I need to have them all in a single line. It should look
> something like this.
>
> ----------------------------------------------------------------------------------------------------------------------------------------------------
> |
> m_ToolBar1|
> |m_ToolBar2|m_ToolBar3|
> -----------------------------------------------------------------------------------------------------------------------------------------------------
>
> I tried a lot to bring the toolbars in these positions, but in vain. I
> googled a lot and found DockControlBarLeftOf ()sample present in MSDN.
> But that too is not serving my purpose, as I need to dock the second
> and third toolbars in the top right corner of the First toolbar and
> most importantly, the second and third toolbars should be a dockable
> ones. So, just cannot use DockControlBarLeftOf().
>
> I would extremly appreciate it, if someone could shed some light on
> it, as I tried many many possiblities and found nothing working. 


0
AliR3470 (3236)
5/22/2008 2:14:34 PM
Reply:

Similar Artilces:

Can't use calculated field for row or column area in Beta 2007
When a new calculated field 'calcfield' is created, a 'SIGMA values' is added to the column-labels-area, and a 'sum of 'calcfield' is added to the values-area. But I want to use the new field in the row-labels-area, and it is impossible to move the new field to that destination. When I read books about Pivot tables for Excel 2003, it looks like the calculated fields should behave like other fields in this respect. Do I see over some checkmark? When you create a calculated field in Excel 2003, it can only be placed in the data area. If there are multiple...

Using Outlook 2002/Word 2002 - Mail Merge
Hi....we need to regularly send non-spam emails to 1000 ormore customers. We use Outlook 2002 and Word 2002. I understand that I can use mail merge with HTML format. I tested a pretty message using both HTML Format and Rich Text Format. HTML Format - after testing message with bold text, color text and underlined text the message is received lacking these pretty features and we see plain text only Rich Text Format - HTML Format - after testing message with bold text, color text and underlined text (to make it pretty), the message is received lacking these pretty features and we see plain tex...

refer to second column of listbox
Hi, I have a multi selected listbox. How can I refer to the second column of the listbox? Me.lstContract.ItemData(varItem).column(1) ??? Dim varItem As Variant For Each varItem In Me.lstContract.ItemsSelected gstrReportFilter = "[Ck_ContractID]='" & Me.lstContract.ItemData(varItem) & "'" ''DoCmd.OpenReport "rptCoFundActivity_k" '', , , gstrReportFilter DoCmd.OpenReport "rptCostShareContribution_k", acViewPreview '', , gstrReportFilter Next varItem SF ...

Toolbar with different icon sizes
I am developing an Internet Explorer toolbar. Most of the buttons have icon sizes of 16x16, but one of them has larger width (80 pixels). Since a toolbar expects all icons to have the same size I have to do something special if I want to add this button. The solution that I am currently experimenting with is to make a second toolbar which is a child window of the first toolbar. This second toolbar contains only one button. This seems to work a little. I can position it correctly, but the problem is that the second toolbar is entirely black. If I move the mouse cursor of it, it highlights a g...

Make (save) a file by using macro recorder.
Hi all, I am new to macro and using macro recoder to create macro. On one file which I recieve every week from material department. I need to reformat and create pivot table. I use macro recorder and everything is working good. However I need that when my recorded macro end it create a file with the same name with the date and time it was create. I need every week a new file and I dont want to replace the one. Please let me know how I can create a new file with the date and time everyweek when I run my macro. Thanks -- Farhan Hi Farhan This should do it, just insert you...

Which one first?Install Windows Server 2003 SP1 or Exchange SP2 ? #2
Hi, We are running Exchange 2003 on Windows Server 2003. We planned to update the software in terms of patches, so which one should I do first, the OS patches (SP1 and onwards) or the Exchange patches ? By the way, any issue with Exchange SP2 ? Rgrds, Zul See http://go.microsoft.com/fwlink/?linkid=37488 and http://support.microsoft.com/?kbid=896742. I would recomment upgrading Exchange first. -- Regards, Roland "Zul J" wrote: > Hi, > > We are running Exchange 2003 on Windows Server 2003. We planned to update > the software in terms of patches, so which one...

RICHEDIT 2 in MFC
I'm trying to create a Richedit 2 window in MFC, instead of Richedit 1, via a CRichEditCtrl, not a resource. Looking in the MFC source, CRichEditCtrl::Create() would need to be replaced at a minimum because it's creating a window with a class of "RICHEDIT" and explicitly loading "RICHED32.DLL". CRichEditCtrl::Create() is not virtual so that would be a problem. Is there a good solution? Thanks Mark Bellamy Mark, You might want to investigate AfxInitRichEdit2 on MSDN, and check www.codeguru.com and www.codeproject.com, which both has articles on using the ve...

Problem with data using IF and Nested IF statements possibly???
Afternoon All I am attempting to analyse data from multiple worksheets from numerous people the incoming data all has one thing in common column A this is a certain frequency a job is done. The problem is that there are many ways of entering the data ie 12 months or 52 weeks or 365 days all essentially meaning the same thing. My idea is to collate the data in col A and then using the Helper column as the standard frequencies ie if cell A1 = 12 months, closes frequency in helper is 52 weeks therefore value in C1 = 52 weeks. By using an IF statement I can change the value of one frequen...

Compound Lookup Field Only Showing First Field
Hello, I am using a lookup field for name and the name is broken into two fields - FirstName and LastName. When selecting the name from the drop down, I see both first and last names, but after selecting, I only see the first name. For visual reasons, I would like to see the first and last names in the form. I am using Access 2007, but believe this issue is in previous versions as well. I am open to suggestions and appreciate your help, Chris Hello Chris. "Chris" wrote: > I am using a lookup field for name and the name is broken into two > fields - FirstName and LastNa...

Admin Rights
We had a administrator who is no longer with us, he was able to open every mailbox on our Exchange Server 2003 and I notice that on all global security groups tab his name was on it everywhere, How do I clean this?, can I just delete his account and will that take care of this problem, or do I have to do this manually. Thanks. Are you seeing this in Exchange System Manger or Active Directory Users and Computers? (It is possible to grant rights thru either.) /neo ps - definitely delete/disable the account. with the above someone can give you tips on where to look to make sure the S...

Formatting toolbar disappeared: Reposted, no answer
This issue still has not been resolved. The thread seems to have dropped, so I am reposting it. Below are the previous answers: Thanks, -- df ------------------------------------------------------------- Can't use Word as editor, still using Office 2000. Waiting for next version. HTML is the default mail format. New message | Right click on toolbar | No "Formatting" toolbar is listed. "Standard" and "Customize" are the only choices. That is the problem. Why does it not appear on the list? Thanks, -- df "Mary" <Mary@discussions.microsoft.com&...

Wrong colors keep printing when I use publisher. Why?
Can't seem to figure this out. Green prints out as purple, blue prints out as green...why? How can I correct it? It is probably your printer driver. What version Publisher? Are other applications printing okay? -- Mary Sauer MSFT MVP http://office.microsoft.com/ http://msauer.mvps.org/ news://msnews.microsoft.com "BA1976" <BA1976@discussions.microsoft.com> wrote in message news:F3DEE307-6C6C-4FF7-BAC4-CF816DB47C8B@microsoft.com... > Can't seem to figure this out. Green prints out as purple, blue prints out as > green...why? How can I correct it? Thanks!...

when sending e-mail using word says interface not recgonised!!
when sending new e-mails using word as editor. on sending e-mail get error message saying interface not recgonised can any one help as i'm a new outlook user. Your Word version must match your Outlook version or you cannot use Word as editor. You can't use Word 2000 or XP with Outlook 2003. "matt clarke" wrote: > when sending new e-mails using word as editor. on sending e-mail get error > message saying interface not recgonised can any one help as i'm a new outlook > user. matt clarke <mattclarke@discussions.microsoft.com> wrote: > when sendi...

Using a listbox selection to limit records in a form and report
I am trying to use a listbox of names to limit the results of a form to just those names. On a similar track, I want to use the selected names to limit a report. I have the listbox created and have added a button next to it to initiate the next step, but cannot figure out how to do it. Also, would like to (if possible) use multiple listboxs in the same way (ie, name and/or department). "dascooper" <dascooper@discussions.microsoft.com> wrote in message news:1227B7CC-3345-4FDC-8EB0-94BEF46660FD@microsoft.com... >I am trying to use a listbox of names to limit the resu...

File in Use
Here's a bit of an odd one. We have a report from one group of users about an issue they are having with opening files in a particular directory on one of our file servers (Windows Server 2003 SP1 in 2003 Domain). When the user (client is Windows xP SP2, Office 2003) attempts to open an excel file in this directory that is opened by another user, they get the usual "File in Use" prompt (with - Read Only, Notify and Cancel as options). Usually in such a situation it will say "Filename.xls is locked for editing by 'username'." but for some reaon the usernam...

UNC Path using DNS alias (CNAME) on local server doesn't work
I have many windows server 2003 servers. On all of our file shares/SQL servers we use CNAMES for easy DR changes and testing. Primarily we only use DNS aliases from clients to the servers We installed a new app that has a database of UNC locations. The app uses these locations to do some file copies. The problem seems to be that the server itself cannot access the \\myalias\myshare from itself. Extremely strange. When i try to go to run and type this UNC path using the alias on the server itself i get prompted with a username/password dialog. Any credentials i enter here fail. we a...

Exchange 5.5 Service Account Domain Rights
Silly question... Does an Exchange 5.5 service account need to be a domain admin? It seems like it does not need to be domain admin, just local admin on the exchange server. If possible, please provide a M$ link. thanks, FastEddie On Tue, 13 Sep 2005 13:43:05 -0500, "FastEddie" <fasteddie@therockwells.net.no.spam> wrote: >Silly question... > >Does an Exchange 5.5 service account need to be a domain admin? It seems >like it does not need to be domain admin, just local admin on the exchange >server. Nope. In fact, it is recommended that it not be a d...

Use this corrective pack
--yakqhoalwsgfqy Content-Type: multipart/related; boundary="gncfpnkvjebqahyk"; type="multipart/alternative" --gncfpnkvjebqahyk Content-Type: multipart/alternative; boundary="fsjbiivoclajvlz" --fsjbiivoclajvlz Content-Type: text/plain Content-Transfer-Encoding: quoted-printable MS Client this is the latest version of security update, the "November 2003, Cumulative Patch" update which fixes all known security vulnerabilities affecting MS Internet Explorer, MS Outlook and MS Outlook Express as well as three newly discovered vulnerabilities. Install now...

Need a ZERO as the first character in a cell
How do you make the first number in a string of numbers a zero and keep it there? Depends on if you want a *true* number, or a text number. For Text, precede the entry with an apostrophe ( ' ), OR, pre-format the cell as text. For true numbers, custom format the cell with the number of digits you're using: 00000 -- HTH, RD ===================================================== Please keep all correspondence within the Group, so all may benefit! ===================================================== "Mr_Jim" <MrJim@discussions.microsoft.com> wrote in message news...

Mailbox rights #5
I am trying to transport to a text file all the accounts listed in the mailbox rights of a mailbox. Can someone help? Thanks in advance. ...

Using custom fonts
Hi, I've been playing with this now for a while and it is starting to anoy me. I create my own font file (*.fnt win3.00 format), but no matter what i try, i cannot get the following font character codes to show... They always show as the "replace char with this char if not found in font set" character, no matter what control i try to use this font with! 0xHEX ( ASCII ) 0x80 (128) 0x82 -> 0x8C (130 -> 140) 0x8E (142) 0x91 -> 0x9C (145 -> 156) 0x9E -> 0x9F (158 ->159) All other font characters show up correctly without problems... Is there somthing i am mis...

Mail validation using rules.
I have some questions for Outlook 2000: - - - - - 1) I prefer to validate incoming mails using rules checking the sender against a whitelist of addresses and domains. To my knowledge this is rather unhandy to implement in Outlook 2000 because the addresses must be in my addressbook/contact which can not contain domains only addresses. Hereby I have to maintain a long list of rules just for this validation purpose. I wonder if there is a possibility somehow for using simple textfiles (1 or 2) containg valid addresses and domains handled by 1 or 2 rules. Or maybe there is another way around i...

Slow Outlook connectivity using a VLAN
Hi, we are using a HP switch configure with 2 vlans. 192.168.254.x and 10.10.10.x Our exchange server is on the 10.10.10.x subnet and we are using exchange 2003 with outlook 2003. The outlook client can connect with no problem while on the 10.10.10.x subnet but it will timeout while on the 192.168.254.x subnet. It will say that it cannot connect to the exchange server and you have to hit retry about 3 or 4 times and it will finally connect. Once connect everything runs fine. All other network programs work find except for outlook. Any suggestions? .. Change rpc binding order, ...

Can't use Outlook
How can I cancel my account with Outlook? Because I can't use this software anymore we have installed Lotus Notes as a source of email and etc. Please notify me and let me know how to cancel this account. Please I counld go to far with it because I never knew the server to finish my account. Thanks Chuck OL only has accounts you set up Tools/Options/Accounts simply delete unwanted accounts. If you no longer use OL, uninstall. I'm assuming yr refering to OL not OLExpress Remember to set yr Internet Options to point to yr new email app David "chuck" <anonymous@dis...

Can use Quickscan when doing physical inventory?
I am getting prepared to start the first physical inventory using RMS. My plan was to use a laptop and a barcode scanner connected wirelessly to RMS. Folowing the instructions for setting up a physical inventory, I clicked 'new' and saw the options of add, delete and import but no option for "quick scan" as the instructions say. Does the option of scanning directly into RMS exist? Does anyone have any experience in scanning into a different file and then importing into RMS? Would this be easier? If it is easier, any thoughts on what program to scan into? I'm eagerl...