Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - how to create toolbar like this in dialog
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

how to create toolbar like this in dialog

 Post Reply Post Reply
Author
Message
sunceenjoy View Drop Down
Groupie
Groupie


Joined: 16 April 2010
Location: China
Status: Offline
Points: 12
Post Options Post Options   Thanks (0) Thanks(0)   Quote sunceenjoy Quote  Post ReplyReply Direct Link To This Post Topic: how to create toolbar like this in dialog
    Posted: 16 April 2010 at 3:55am
there is no example about how to create a toolbar at any place in a  dialog .
here is a picture shows the toolbar i mean:
 
 
 
 
thanks!
Back to Top
sunceenjoy View Drop Down
Groupie
Groupie


Joined: 16 April 2010
Location: China
Status: Offline
Points: 12
Post Options Post Options   Thanks (0) Thanks(0)   Quote sunceenjoy Quote  Post ReplyReply Direct Link To This Post Posted: 18 April 2010 at 8:54pm

who can help me??

Back to Top
jimmy View Drop Down
Senior Member
Senior Member


Joined: 11 November 2003
Location: Austria
Status: Offline
Points: 515
Post Options Post Options   Thanks (0) Thanks(0)   Quote jimmy Quote  Post ReplyReply Direct Link To This Post Posted: 19 April 2010 at 10:32am
Hi,

I use follow.
Add CXTPToolBar    m_wndToolBar;
 to header file.

Add

VERIFY(m_wndToolBar.CreateToolBar(WS_DLGFRAME | WS_VISIBLE | WS_CHILD | CBRS_TOOLTIPS | CCS_NOPARENTALIGN | CCS_NOMOVEY | CCS_NORESIZE, this));
    VERIFY(m_wndToolBar.LoadToolBar(IDR_VST_TB_SPICONFIG));
    // m_wndToolBar.SetPaintManager(new CDialogToolbarTheme() );
    CSize sz = m_wndToolBar.CalcDockingLayout(rcChild.Width(), /*LM_HIDEWRAP|*/ LM_HORZDOCK | LM_HORZ | LM_COMMIT);
    m_wndToolBar.MoveWindow(rcChild.left, 10, rcChild.Width(), sz.cy);
    m_wndToolBar.Invalidate(FALSE);

ON_MESSAGE_VOID(WM_KICKIDLE, OnKickIdle)

void CDlgOwn::OnKickIdle()
{
    m_wndToolBar.OnUpdateCmdUI();
}
 

  Jimmy

Back to Top
sunceenjoy View Drop Down
Groupie
Groupie


Joined: 16 April 2010
Location: China
Status: Offline
Points: 12
Post Options Post Options   Thanks (0) Thanks(0)   Quote sunceenjoy Quote  Post ReplyReply Direct Link To This Post Posted: 19 April 2010 at 10:44pm
thanks,
but it doesn't work!
tool is disappear!
Back to Top
jimmy View Drop Down
Senior Member
Senior Member


Joined: 11 November 2003
Location: Austria
Status: Offline
Points: 515
Post Options Post Options   Thanks (0) Thanks(0)   Quote jimmy Quote  Post ReplyReply Direct Link To This Post Posted: 20 April 2010 at 9:04am
Hi,

Who is the parent of the toolbar.
Is the toolbar over other child ?
make toolbar as child from other child.

Have you ad ON_MESSAGE_VOID(WM_KICKIDLE,...) ?

  Jimmy

Back to Top
sunceenjoy View Drop Down
Groupie
Groupie


Joined: 16 April 2010
Location: China
Status: Offline
Points: 12
Post Options Post Options   Thanks (0) Thanks(0)   Quote sunceenjoy Quote  Post ReplyReply Direct Link To This Post Posted: 06 May 2010 at 11:48pm
thanks,i fix it!
Back to Top
elmue View Drop Down
Groupie
Groupie


Joined: 05 June 2010
Location: Germany
Status: Offline
Points: 24
Post Options Post Options   Thanks (0) Thanks(0)   Quote elmue Quote  Post ReplyReply Direct Link To This Post Posted: 05 June 2010 at 7:30pm
Hello

Your code is definitley wrong.
I tried it in the sample "GUI_VisualStudio".

First:
OnKickIdle() is never called.
(Please dont tell me that I did not add the entry to the AFX_MSG_MAP.  Yes I did !)

Second:
Setting the size of the bar does not help much.
When moving some views and docking them anew the toolbars get redrawn and resized to their original size.
Back to Top
SuperMario View Drop Down
Admin Group
Admin Group
Avatar

Joined: 14 February 2004
Status: Offline
Points: 18057
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperMario Quote  Post ReplyReply Direct Link To This Post Posted: 07 June 2010 at 2:57pm
OnKickIdle is only for DIALOG based applications.  GUI_VisualStudio is not Dialog based app.  See CommandBars DialogSample to see OnKickIdle.
Back to Top
elmue View Drop Down
Groupie
Groupie


Joined: 05 June 2010
Location: Germany
Status: Offline
Points: 24
Post Options Post Options   Thanks (0) Thanks(0)   Quote elmue Quote  Post ReplyReply Direct Link To This Post Posted: 08 June 2010 at 12:17am
OK
I didn't know that.

If someone needs a not moveable toolbar in a MDI application have a look here:
How to create a fixed toolbar
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.172 seconds.