| |

VerySource

 Forgot password?
 Register
Search
View: 779|Reply: 3

How to load multiple toolbars in a dialog box

[Copy link]

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-3-4 02:30:01
| Show all posts |Read mode
I added a toolbar to the dialog box to display it, but I could n’t display it when I added more than one, still only the first
if (! m_wndToolBar1.CreateEx (this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_ALIGN_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) CR1 (Bar1) Toolbar! TO1
{
TRACE0 ("failed to create toolbar\n");
return FALSE;
}
m_wndToolBar1.SetBarStyle (m_wndToolBar1.GetBarStyle () | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
m_wndToolBar1.ShowWindow (SW_SHOW);
RepositionBars (AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0);



if (! m_wndToolBar2.CreateEx (this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_ALIGN_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) CR2 (Bar2) Toolbar! Toolbar! 2
{
TRACE0 ("failed to create toolbar\n");
return FALSE;
}
m_wndToolBar2.SetBarStyle (m_wndToolBar2.GetBarStyle () | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
m_wndToolBar2.ShowWindow (SW_SHOW);
RepositionBars (AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0);
Q: How can I make the second toolbar appear?
Reply

Use magic Report

0

Threads

59

Posts

43.00

Credits

Newbie

Rank: 1

Credits
43.00

 China

Post time: 2020-5-17 00:30:01
| Show all posts
Because the Rect position of your second toolbar is the same as the first one, of course, only one can be displayed because they overlap.

Adjust the position of the second toolbar

if (! m_wndToolBar2.CreateEx (this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_ALIGN_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC, CRect (4,34,0,0)) | OL2
{
TRACE0 ("failed to create toolbar\n");
return FALSE;
}
Reply

Use magic Report

0

Threads

8

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

Post time: 2020-5-18 10:45:01
| Show all posts
Yes, lz got it wrong, I tried
Reply

Use magic Report

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

 Author| Post time: 2020-5-19 14:45:01
| Show all posts
Thank you, everyone
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list