Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - How to add a string after ICON of toolbar
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

How to add a string after ICON of toolbar

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


Joined: 23 June 2008
Location: China
Status: Offline
Points: 23
Post Options Post Options   Thanks (0) Thanks(0)   Quote yanlv Quote  Post ReplyReply Direct Link To This Post Topic: How to add a string after ICON of toolbar
    Posted: 23 July 2008 at 3:26am
just like the CToolBar's member function: SetButtonText() in MFC.
Back to Top
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1201
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post Posted: 23 July 2008 at 4:53am
Hi;

If you're using CommandBars try this:

int CMainFrame::OnCreateControl(LPCREATECONTROLSTRUCT lpCreateControl)
{
    if (lpCreateControl->bToolBar)
    {
        CXTPToolBar* pToolBar = DYNAMIC_DOWNCAST(CXTPToolBar, lpCreateControl->pCommandBar);
        if (!pToolBar)
            return FALSE;

        if (lpCreateControl->nID==ID_FULLSCREEN) {
            lpCreateControl->buttonStyle=xtpButtonIconAndCaption;
            return TRUE;
        }
    }
    return FALSE;
}   
       
It then takes the text from your resource file.
Martin

Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0
Platform: Windows 10 v 22H2 (64bit)
Language: VC++ 2022
Back to Top
yanlv View Drop Down
Groupie
Groupie


Joined: 23 June 2008
Location: China
Status: Offline
Points: 23
Post Options Post Options   Thanks (0) Thanks(0)   Quote yanlv Quote  Post ReplyReply Direct Link To This Post Posted: 23 July 2008 at 11:10pm
Thanks. This way to add string after icon works for the lpCreateControl->controlType = xtpControlPopup;
i.e., there are some pull down items when you click the icon.
But if there are no pull down items, i.e., this icon is a common toolbar, e.g., click it will  open  a dialog,  I tried this way, in details:
Add Menu in the resource file, the menu ID = ID_FULLSCREEN, and add string on the caption. Then add the similar code you suggested in MainFrame.
But it turns out there's still no string after icon.
Anything wrong. If I'm not clear, please tell me. Thanks very much.
Back to Top
yanlv View Drop Down
Groupie
Groupie


Joined: 23 June 2008
Location: China
Status: Offline
Points: 23
Post Options Post Options   Thanks (0) Thanks(0)   Quote yanlv Quote  Post ReplyReply Direct Link To This Post Posted: 24 July 2008 at 7:53am
I know the answer, thanks any way.
Back to Top
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1201
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post Posted: 24 July 2008 at 9:17am
Hi;

Could you share your experiences?
Martin

Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0
Platform: Windows 10 v 22H2 (64bit)
Language: VC++ 2022
Back to Top
yanlv View Drop Down
Groupie
Groupie


Joined: 23 June 2008
Location: China
Status: Offline
Points: 23
Post Options Post Options   Thanks (0) Thanks(0)   Quote yanlv Quote  Post ReplyReply Direct Link To This Post Posted: 24 July 2008 at 10:07pm
needn't create a menu for ID=ID_FULLSCREEN. Add your string on the prompt of the Toolbar Button Properties: e.g. smile\nsmile. 
Back to Top
rapid View Drop Down
Groupie
Groupie


Joined: 11 March 2009
Status: Offline
Points: 10
Post Options Post Options   Thanks (0) Thanks(0)   Quote rapid Quote  Post ReplyReply Direct Link To This Post Posted: 06 June 2011 at 5:38pm
I would like to display the icon after the caption (toolbar button).. How to do that..?
Any idea would be much appreciated..

Thanks & Regards
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.047 seconds.