|
-
July 13th, 1999, 08:10 AM
#1
CStatusBar
Hi,
I seem unable to update the statusbar in an MDI.
I have tried ON_COMMAND_UPDATE_UI, and SetTimer.
Each work, but only when a Document/View is not
open.
Any thoughts?
--
-
July 13th, 1999, 08:28 AM
#2
Re: CStatusBar
try m_wndStatusBar.UpdateWindow()
where m_wndStatusBar is your object.
-
July 13th, 1999, 08:38 AM
#3
Re: CStatusBar
Thanks... I'll try that now :-)
--
-
July 13th, 1999, 09:21 AM
#4
Re: CStatusBar
Nop...
What I am trying to do is place the time in the statusbar. The code works when a doc/view is not open (i.e. the mainframe only ). But when I create a new document (CFormView) time disappears.
As the app opens with a new document it the time is not displayed until the document is closed.
All the code for displaying the time is in the MainFrame - I wondered if it should go in the ChildFrame and then update the statusbar in from there?
kind regards,
--
Marc
-
July 13th, 1999, 10:48 AM
#5
Re: CStatusBar
are you calling UpdateWindow after a change is made?
miked
-
July 14th, 1999, 07:18 AM
#6
Re: CStatusBar
Aahh, I think now I got your problem. Of course, you have to update the status bar in your document or in its related view or even in the childframe, either way is possible, depending upon where your command handlers are situated.
try this:
place if (!m_wndStatusBar.Create(this) ||
!m_wndStatusBar.SetIndicators(indicators,...
and so on...
in OnCreate(...) of CChildFrame or its derivative in the same manner as this is done in CMainFrame.
Put static CStatusBar m_wndStatusBar;
in the header file of ChildFrame(i.e. in its class declaration)
Put CStatusBar CCameraWnd::m_wndStatusBar;
in the class definition of Childframe, that means, in the .cpp file. If now you want to update the status bar from the view, put include "ChildFrame.h"
in view.cpp (or however you called it). Now you can update it by
CChildFrame::m_wndStatusBar.UpdateWindow();
From the document it should also work, if you include here as well.
This was a solution, if the child window has its own status bar. But you can easily update the status bar of the MainFrame from whereever you want:
Place CMainFrame* pMain=(CMainFrame*)AfxGetMainWnd();
in the file, from where it shall be updated.
With pMain->m_wndStatusBar.UpdateWindow();
it should work.
Of course, this requires #include "MainFrm.h"
in the same file.
hope, that'll work!
-
July 14th, 1999, 07:54 AM
#7
Re: CStatusBar
Yep... no go.
If I do SetPaneText( 0, "testing" ) this works for the far left, but setting the index to 1 does nothing (there is one sunked pane)
--
Marc
-
July 14th, 1999, 07:58 AM
#8
Re: CStatusBar
Cheers!
I'll give this a go.
I've now got through the timers which I now have one in the App class and am updating the Child/MainFrames statusbars from there. This seems to work well, execept the updating :-(
Anyhow. Many thanks, I'll try the code.
Kind regards,
--
Marc
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
|