Print Page | Close Window

StatusBar : align and click icon

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=11258
Printed Date: 11 May 2024 at 6:48am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: StatusBar : align and click icon
Posted By: Somberlord
Subject: StatusBar : align and click icon
Date 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



Replies:
Posted By: Somberlord
Date 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


Posted By: Oleg
Date 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


Posted By: Somberlord
Date 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!


Posted By: Oleg
Date 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


Posted By: Somberlord
Date 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


Posted By: Oleg
Date 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


Posted By: Somberlord
Date Posted: 03 July 2008 at 4:20am
It works !!

Thank you very much !!


Posted By: Somberlord
Date 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


Posted By: Oleg
Date 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


Posted By: Somberlord
Date 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 :(


Posted By: Somberlord
Date 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....


Posted By: Oleg
Date 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


Posted By: qarefi
Date 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.


Posted By: Oleg
Date Posted: 03 August 2008 at 4:25am
Hi,
 
Please check our sample first - Samples\CommandBars\StatusBar


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net