Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - StatusBar : align and click icon
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

StatusBar : align and click icon

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

Joined: 30 June 2008
Location: France
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote Somberlord Quote  Post ReplyReply Direct Link To This Post Topic: StatusBar : align and click icon
    Posted: 30 June 2008 at 9:48am
I would like to add an icon to a pane, align it to left and write text ont the right. And I would also like this icon to be clickable.

I didn't find anything to align the icon to left, and I can't get correct mouse position : I get correct y-position but x-position is between 0 and 20, when my pane is in center of the screen.

What can I do??

Thank you for your help
Back to Top
Somberlord View Drop Down
Newbie
Newbie
Avatar

Joined: 30 June 2008
Location: France
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote Somberlord Quote  Post ReplyReply Direct Link To This Post Posted: 01 July 2008 at 4:38am
I have finally make it clickable, but I still don't know how to align it to the left of my pane.

Thanks for help
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: 01 July 2008 at 1:17pm
Hi,
 
Not sure... Icon is always in the left and text on the right...
please attach screenshot.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Somberlord View Drop Down
Newbie
Newbie
Avatar

Joined: 30 June 2008
Location: France
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote Somberlord Quote  Post ReplyReply Direct Link To This Post Posted: 02 July 2008 at 4:31am
Here is screenshot :



And here is my code :

int iIndex = m_wndStatusBar.GetPaneCount();

    if (!m_wndIconPane.Create(NULL, &m_wndStatusBar))
    {
        TRACE0("Failed to create icon pane.\n");
        return;
    }

    // Initialize the pane info and add the control.
    int nIndex = m_wndStatusBar.CommandToIndex(ID_INDICATOR_ICON);
    ASSERT (nIndex != -1);

    m_wndIconPane.SetPaneIcon(MAKEINTRESOURCE(IDR_MAINFRAME));
    m_wndStatusBar.SetPaneWidth(nIndex, 120);
    m_wndStatusBar.AddControl(&m_wndIconPane, ID_INDICATOR_ICON, FALSE);

    m_iconPane = m_wndStatusBar.GetPane(iIndex-2);


And I can't write text in this pane after. Is there another way to do that?

Thank you!
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 July 2008 at 9:45am
Hi,
Replace this code to
 
 CXTPStatusBarPane* pPane = m_wndStatusBar.AddIndicator(ID_INDICATOR_ICON, 0);
 
pPane->SetText(_T("Text"));
pPane->SetIconIndex(IDR_MAINFRAME);
m_wndStatusBar.GetImageManager()->SetIcon(IDR_MAINFRAME, IDR_MAINFRAME);
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Somberlord View Drop Down
Newbie
Newbie
Avatar

Joined: 30 June 2008
Location: France
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote Somberlord Quote  Post ReplyReply Direct Link To This Post Posted: 02 July 2008 at 10:51am
I replaced my code, and it works better than before. But I still have a little problem : text is not in the pane

look :


Thanks for your help
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 July 2008 at 2:37pm

Hi,

Have to stretch automatically with last version.  In older you have manually call
 
pPane->SetWidth(...);
or
pPane->BestFit();
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Somberlord View Drop Down
Newbie
Newbie
Avatar

Joined: 30 June 2008
Location: France
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote Somberlord Quote  Post ReplyReply Direct Link To This Post Posted: 03 July 2008 at 4:20am
It works !!

Thank you very much !!
Back to Top
Somberlord View Drop Down
Newbie
Newbie
Avatar

Joined: 30 June 2008
Location: France
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote Somberlord Quote  Post ReplyReply Direct Link To This Post Posted: 03 July 2008 at 10:05am
I remember why I love programming. The code was working perfectly a fex hours ago, but BestFit() doesn't work properly anymore (pane is resized to icon width only)

Althought, SetWidth works...but I would prefere to use BestFit if possible...

Any idea?

Thanks
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: 03 July 2008 at 3:23pm
Hi,
 
maybe you call BestFit before you set Text. step into BestFit and check if Text has right value.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Somberlord View Drop Down
Newbie
Newbie
Avatar

Joined: 30 June 2008
Location: France
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote Somberlord Quote  Post ReplyReply Direct Link To This Post Posted: 04 July 2008 at 6:25am
When I step into BestFit, Text has right value. here is Two Screenshots :

First, when application executes normally :

(its in right-bottom corner of the screen)

And here is a screenshot after restore/maximize the window :


Seems like the other panes don't move to let enough place to my pane :(
Back to Top
Somberlord View Drop Down
Newbie
Newbie
Avatar

Joined: 30 June 2008
Location: France
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote Somberlord Quote  Post ReplyReply Direct Link To This Post Posted: 04 July 2008 at 8:54am
I resolved my problem by doing that :

m_iconPane->BestFit();
m_iconPane->SetWidth(m_iconPane->GetWidth()+1);


But there must be a better way to do....
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: 04 July 2008 at 12:12pm
Hi,
 
Best way is upgrade to 12.0.1 :-)  In last release we totally removed comctrl32 statusbar dependence and draw/calculate statusbar manually.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
qarefi View Drop Down
Newbie
Newbie


Joined: 01 August 2008
Status: Offline
Points: 1
Post Options Post Options   Thanks (0) Thanks(0)   Quote qarefi Quote  Post ReplyReply Direct Link To This Post Posted: 01 August 2008 at 11:00am
Hello, I am for Argentina.
 
Can you send me the code for make it clickable the statusbar ?
 
Thanks in advance.
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: 03 August 2008 at 4:25am
Hi,
 
Please check our sample first - Samples\CommandBars\StatusBar
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
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.