[RESOLVED] Statusbar-update while mouse in CDialogbar?
Hello,
I have the following problem:
my mainframe-window in a MDI-app has a CDialogbar.
Everytime the mouse moves over a control in this dialogbar the status bar is updated by a text.
The app craps the text from the ressource strings that has the same ID than the dialogbar-control, randomly.
I do not want this.
How can I avoid this?
thx.
Ralf
Re: Statusbar-update while mouse in CDialogbar?
Perhaps, you could handle yourself WM_SETMESSAGESTRING in the CMainFrame class rather the use default handler CFrameWnd::OnSetMessageString?
More info in http://msdn.microsoft.com/en-us/magazine/cc301407.aspx beginning with the question
Quote:
I have an app that has a dynamically changing menu item. I can use CCmdUI::SetText("Menu Text") to change the menu text, but how do I dynamically change the tooltip/status bar text?
Re: Statusbar-update while mouse in CDialogbar?
Hello Victor,
yes, I know that.
But the problem is: how do I know who sends the message?
I only do not want to show the MessageStrings from my CDialogbar; all other messages should be shown.
Re: Statusbar-update while mouse in CDialogbar?
Then try to override CControlBar::SetStatusText
Re: Statusbar-update while mouse in CDialogbar?
Quote:
Originally Posted by
VictorN
Then try to override CControlBar::SetStatusText
do you have a documentation of this function?
Re: Statusbar-update while mouse in CDialogbar?
No, but is not so complicated. Just look at this implementation in ..\src\mfc\barcore.cpp
Re: Statusbar-update while mouse in CDialogbar?
I defined SetStatusText in my Cdialogbar-class.
BUt it is not called.
BOOL SetStatusText(int n);
Any ideas?
Re: Statusbar-update while mouse in CDialogbar?
The signature you have used is wrong!
Why dod you invent your own signatures rather than look at the one MSFT had implemented? :confused:
Just have a look at the CControlBar declaration in the afxext.h:
Quote:
Code:
virtual BOOL SetStatusText(INT_PTR nHit);
#ifdef _WIN64
/*
Initial releases of 64 bit MFC had SetStatusText(int), same size as
32 bit MFC. Since this function is virtual, it could be overridden.
Future overriders of SetStatusText should do so by overriding the
INT_PTR version. But this extra function will allow 64 bit code ported
from MFC70 to continue to work correctly.
*/
virtual BOOL SetStatusText(int nHit);
#endif
Re: Statusbar-update while mouse in CDialogbar?
sorry, in vc6 it is defined like:
virtual BOOL SetStatusText(int nHit);
and it is also not called with
virtual BOOL SetStatusText(INT_PTR nHit);
Re: Statusbar-update while mouse in CDialogbar?
Quote:
Originally Posted by
Ralf Schneider
sorry, in vc6 it is defined like:
virtual BOOL SetStatusText(int nHit);
You had to mention in your OP that you still use a 17 years old IDE!
Quote:
Originally Posted by
Ralf Schneider
it is also not called with
virtual BOOL SetStatusText(INT_PTR nHit);
In the VC++6.0 it should be declared as
Code:
virtual BOOL SetStatusText(int nHit);
Re: Statusbar-update while mouse in CDialogbar?
Quote:
Originally Posted by
VictorN
In the VC++6.0 it should be declared as
Code:
virtual BOOL SetStatusText(int nHit);
yes, and I declared it the same way in my class as I told you before:
BOOL SetStatusText(int n);
Anyway, is there something wrong which I did not see?
Re: Statusbar-update while mouse in CDialogbar?
Yes it is. But I have no idea what since you do not show your code.
I just have tested with a simple MDI with CToolBar derived class in which I overridden this
Code:
BOOL SetStatusText(int n);
This override is called when I move mouse over the toolbar.
Re: Statusbar-update while mouse in CDialogbar?
this is the class declaration with the test-function:
it is never called.
Code:
class CGleisBar : public CDialogBar
{
// Construction
public:
CGleisBar(); // standard constructor
BOOL Create( CWnd* pParentWnd, UINT nIDTemplate, UINT nStyle,
UINT nID, BOOL = TRUE);
// Attributes
protected:
CSize m_sizeDocked;
CSize m_sizeFloating;
BOOL m_bChangeDockedSize; // Indicates whether to keep
...
public:
// Dialog Data
...
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CGleisBar)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
virtual BOOL SetStatusText(INT_PTR nHit)
{MessageBeep(-1);return FALSE;}
// Implementation
protected:
...
};
Re: Statusbar-update while mouse in CDialogbar?
1. Why do you declare it as
Code:
virtual BOOL SetStatusText(INT_PTR nHit)
rather than
Code:
virtual BOOL SetStatusText(int nHit)
in VC++6.0?
2. How did you test whether it was called? Did you set a breakpoint within SetStatusText() implementation?
Re: Statusbar-update while mouse in CDialogbar?
I tested it with both: "INT_PTR" and "int".
I tested it with a breakpoint and with the MessageBeep-Sound (see my code) which not appears!