Jump to content
  • Advertisement
Sign in to follow this  
Kryptus

Statusbar text

This topic is 4979 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

How do I make it so the text of a statusbar changes when I put my mouse on a menu? Eg. When I put the mouse over File > New the statusbar will say "Create a new document" and when i put the mouse over File > Exit it will say "Exit to Windows"?

Share this post


Link to post
Share on other sites
Advertisement
by default, if u're using MFC or .NET forms, u can assign a description to the menu items. That description is automatically displayed onto the statusbar of ur application if one exists.
but to do it manually, would be as simple as assigning a mouse enter/leave handler that sets something like:
statusbar->text = "Something" OR
statusbar->text = menuitem->description

ok, do NOT take the stuff above literally. it is just a sample and .NET seems to do is as simple as that. thats my 2cents worth.

Share this post


Link to post
Share on other sites
Since you haven't told us what language youre using...
In Delphi you put some text after the vertical-bar character in the hint property of the menu item.

e.g.
menuFileNew.Hint := 'New|Create a new document';
menuFileExit.Hint := 'Exit|Exit to Windows';

Please give more details in future.

Share this post


Link to post
Share on other sites
With just bare Win32API you'll have to do it manually...

Like this:


#define IDC_FILE_NEW 1000
#define IDC_FILE_EXIT 1001

//...

//your window procedure
LRESULT CALLBACK WndProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
static HWND statusBar; //handle of the status bar

switch (msg) {
//... init your window and create the statusBar

//
//menu selection message
//
case WM_MENUSELECT: {
switch (LOWORD (wParam)) { //loword of wParam is the identifier of the menu item
case WM_FILE_NEW:
//file->new selected
SetWindowText (statusBar, "Create new file");
return 0;

case WM_FILE_EXIT:
//file->exit selected
SetWindowText (statusBar, "Get the hell outta here!");
return 0;
}

break;
}
}

return DefWindowProc (hWnd, msg, wParam, lParam);
}



This should do it.

Oxyd

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!