-
January 27th, 2004, 03:26 PM
#1
How do I get rid of "Ready" in Status Bar
Where do I put this,
StatusBar->SetPaneText(0,"My Message");
(StatusBar is a pointer to a CStatusBar object),
to automatically overwrite "Ready" message that appears when a menu closes. Or, alternatively, how do I prevent that "Ready" message from overwriting "My Message?"
BTW, I could never figure out what that "Ready" message is for.
If the cursor isn't an hourglass, the program is ready.
-
January 27th, 2004, 03:41 PM
#2
In resource editor change string with AFX_IDS_IDLEMESSAGE ID from ready to whatever you need.
Ready (I think) is telling that app is ready to accept input.
There are only 10 types of people in the world:
Those who understand binary and those who do not.
-
January 27th, 2004, 06:10 PM
#3
Here is another approach.
Regards,
Hal
up·grade (up'gräd'),
to take out old bugs
and put in new ones.
-
January 27th, 2004, 09:15 PM
#4
For simple replacement of Ready with another string that is overkill.
There are only 10 types of people in the world:
Those who understand binary and those who do not.
-
January 27th, 2004, 10:23 PM
#5
Hi,
If you want to replace the default message replace the AFX_IDS_IDLEMESSAGE ID as JohnCz stated earlier. If you want to show text at runtime to indicate program functionality you can use the SetMessageText function. The text will be replaced again by the text specified by AFX_IDS_IDLEMESSAGE when the app re-enters the idle state.
Code:
((CFrameWnd*)AfxGetApp()->GetMainWnd())->SetMessageText("Saving graph data");
TDM
-
January 28th, 2004, 10:32 AM
#6
Thank you all, particularly HalD. I forgot to mention that I want to replace "Ready" with a variable string.
Your input has given me several ideas. If all else fails, I will try to replace "Ready" with "", make the first pane as small as possible, and move everything else one pane to the right.
-
January 28th, 2004, 05:10 PM
#7
See Microsoft Knowledge Base Article - 110505 (PRB: Setting First Pane of CStatusBar). Note that it does not list VC 6 as a product that it applies to, so there might be an easier way in VC 6. My guess is that the article does apply to VC 6 and they just have not revised the KB article.
-
January 28th, 2004, 05:50 PM
#8
When I want to set my own (variable) text in the status bar, I generally use the technique described by the MSDN article "Status Bars: Updating the Text of a Status-Bar Pane" at http://msdn.microsoft.com/library/de...d.bar_pane.asp
Frankly, it's a giant P.I.T.A., and every time I do it, I can't believe that there's not a simpler way.
-Mike
-
January 28th, 2004, 05:57 PM
#9
That MFC documentation page about status bars does not say much about the first pane but hopefully it does not need to. Hopefully they have fixed MFC so that the first pain is as easy as the other pains.
-
January 28th, 2004, 07:27 PM
#10
groan
Best regards,
Mike
-
January 28th, 2004, 07:57 PM
#11
When creating the status bar you could use a resource ID other than AFX_IDW_STATUS_BAR and the text is not updated. When used with SetPaneText you might be able to get the functionality you want. However, you lose other default functionality like tooltip text on the status bar.
TDM
Last edited by TDM; January 29th, 2004 at 04:50 PM.
-
January 28th, 2004, 08:15 PM
#12
A nice alternative to tooltip text in the status bar is pop-up tooltip text adjacent the menu, as described in Paul DiLascia's article entitled "Menu Tips in an MFC App" from the November 2003 MSDN magazine: http://msdn.microsoft.com/msdnmag/is...A/default.aspx
-Mike
-
October 26th, 2021, 03:20 AM
#13
Re: How do I get rid of "Ready" in Status Bar
I know this is an ancient thread, but I had some similar issues in an old MFC application and solved it this way.
Window class private members and method defined in header file:
Code:
void setStatusBarText(const std::string& sbT); // call this to set the statusbar text
bool timerRunning; // is the timer running
std::string statusBarText; // the status bar text that needs to be set
Implementation in the cpp file:
Code:
#define IDT_STATUSBAR_UPDATE_TIMER 0
.
.
.
CChildView::CChildView()
{
timerRunning = false; // initially the timer is not running
.
.
.
}
// See comments on setStatusBarText method
void CChildView::OnTimer(UINT_PTR nIDEvent)
{
CWnd::OnTimer(nIDEvent);
// Try getting the status bar control and update the text
CStatusBar* p = (CStatusBar*)AfxGetApp()->m_pMainWnd->GetDescendantWindow(AFX_IDW_STATUS_BAR);
if (p == NULL)
return;
p->SetPaneText(0, statusBarText.c_str());
timerRunning = false; // signal that the timer is no longer running
KillTimer(nIDEvent); // kill the timer
}
// Due to some strange behaviour of the statusbar text, a timer is fired, when
// the status bar text needs to be update. The timer is killed, when the status
// bar text has actually been updated.
void CChildView::setStatusBarText(const std::string& sbT)
{
statusBarText = sbT;
if (timerRunning)
return; // the timer is already running, bail out
timerRunning = true;
SetTimer(IDT_STATUSBAR_UPDATE_TIMER, 333, NULL);
}
With the above implementation, one can set the statusbar text anywhere in the code, simply by calling setStatusBarText method.
Code:
setStatusBarText("This is a new message for the statusbar");
Calling setStatusBarText will start a timer, that eventually will set the StatusBar text.
-
October 26th, 2021, 06:47 AM
#14
Re: How do I get rid of "Ready" in Status Bar
Originally Posted by rudibr
I know this is an ancient thread, but I had some similar issues in an old MFC application and solved it this way.
Window class private members and method defined in header file:
Code:
void setStatusBarText(const std::string& sbT); // call this to set the statusbar text
bool timerRunning; // is the timer running
std::string statusBarText; // the status bar text that needs to be set
Implementation in the cpp file:
Code:
#define IDT_STATUSBAR_UPDATE_TIMER 0
.
.
.
CChildView::CChildView()
{
timerRunning = false; // initially the timer is not running
.
.
.
}
// See comments on setStatusBarText method
void CChildView::OnTimer(UINT_PTR nIDEvent)
{
CWnd::OnTimer(nIDEvent);
// Try getting the status bar control and update the text
CStatusBar* p = (CStatusBar*)AfxGetApp()->m_pMainWnd->GetDescendantWindow(AFX_IDW_STATUS_BAR);
if (p == NULL)
return;
p->SetPaneText(0, statusBarText.c_str());
timerRunning = false; // signal that the timer is no longer running
KillTimer(nIDEvent); // kill the timer
}
// Due to some strange behaviour of the statusbar text, a timer is fired, when
// the status bar text needs to be update. The timer is killed, when the status
// bar text has actually been updated.
void CChildView::setStatusBarText(const std::string& sbT)
{
statusBarText = sbT;
if (timerRunning)
return; // the timer is already running, bail out
timerRunning = true;
SetTimer(IDT_STATUSBAR_UPDATE_TIMER, 333, NULL);
}
With the above implementation, one can set the statusbar text anywhere in the code, simply by calling setStatusBarText method.
Code:
setStatusBarText("This is a new message for the statusbar");
Calling setStatusBarText will start a timer, that eventually will set the StatusBar text.
Well, why reinvent the wheel?
Why not just use the WM_SETMESSAGESTRING?
Victor Nijegorodov
-
October 26th, 2021, 07:09 AM
#15
Re: How do I get rid of "Ready" in Status Bar
Originally Posted by VictorN
Well, in my specific case, I am already setting the status bar text before the status bar is even created ;-)
That's why I need the timer to wait for the status bar to be ready.
Once the application is fully up and running, I could simply use the build in SetPaneText, but since the statusbar isn't instantiated, it doesn't work in my case.
Code:
CStatusBar* p = (CStatusBar*)AfxGetApp()->m_pMainWnd->GetDescendantWindow(AFX_IDW_STATUS_BAR);
if (p != NULL)
p->SetPaneText(0, "What ever text needs to be set");
So my implementation is a kind of delayed mechanism. Would WM_SETMESSAGESTRING also be able to handle this? Will the message stay in the queue untill the statusbar is created?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|