Link to home
Start Free TrialLog in
Avatar of robear7nt
robear7ntFlag for United States of America

asked on

Updating an application's main frame's status bar text

I'm building a C++ SDI application using document/view. In the program I need the document to change the application's main frame's status bar text from "Ready" to a specified text.

I have searched the web for a solution, but they discuss adding a new status pane and how to modify it. I have tried several different modifications on these to have it apply to ID_SEPARATOR but they didn't work, it stays "Ready".

Can someone show me a simple code sniplet on how to do this properly.

Thanks,
Robert
Avatar of Zoppo
Zoppo
Flag of Germany image

Hi robear7nt,

could you please tell what you want to display there? Usually in a SDI application the status bar shows text-info about menu items and toolbar buttons selected with the mouse, Ready is only shown when no such item is beneath the mouse.

So, do you want to keep this default behavior but just want to show another text than Ready. Or do you want to implement a completeley different behavior, i.e. as simple sample a text which dynamically displays the current date/time no matter where the mouse is?

ZOPPO
Avatar of robear7nt

ASKER

When there is no text-info about menu items or toolbar buttons selected with the mouse, I would like to have the ability to show a dynamic text instead of Ready. That dynamic text would be shown anytime Ready would normally be shown.

The client area is showing a graphic representations of items that the user can manipulate by selecting the appropriate image and perform an action on it. When the user has an item selected, I would like the status bar to show dynamic information about that item. When an item is not selected, it might be "Select an item to perform an action on." or something more appropriate. I really do not want to waste status bar real estate with the Ready.

Is there pointer to the "Ready" string that be changed to point to another string? Seems to me it would be that simple ... lol

Robert
ASKER CERTIFIED SOLUTION
Avatar of Zoppo
Zoppo
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Awesome solution ZOOPO! Using the mouse movement to keep the status bar's text current is ingenious, and was the missing piece to the puzzle.

I modified your solution to fit my application. In the CMainFrame class, I created a CString to store the current text to show in the status bar and a public method, SetStatusBarText, to set the CString's value & immediately call SetPaneText. OnMouseMove simply calls SetPaneText. The application, frame, view, or document can call SetStatusBarText as needed. It works exactly as I needed it to :-)

Thank you so much, ZOOPO!

Robert
Greate, you're welcome, I'm glad I could help ...

Have a nice day,

best regards,

ZOPPO