 |
|
 |
Great job! Thank you for sharing!
I created a custom control and derived it from CStatic. The control displays properly in the status bar, but the background of the entire rest of the status bar is now black (instead of the normal gray color). Do you know of a fix for this?
Thank you!
Mike
|
|
|
|
 |
|
 |
ExtStatusControlBar.h(131): error: CArray is not a template
I can compile the demo but when I simply include your files and compile
I get the error.
?
|
|
|
|
 |
|
|
 |
|
 |
mohammad reza\computer engineer\Mashhad\shahrivar88 tankyou
|
|
|
|
 |
|
 |
Thanks for the status bar control, Dmitriy!
What I missed in the article was how it works, I was curious how you display more than simple text in a status bar.
From looking into the source code the status bar itself stays "empty" and you attach child controls to it. When the status bar is resized child controls are re-aranged within the visible status bar area, done in RepositionControls(). In the main application these controls must be created with the status bar as parent, see CChildFormView::OnAddPane(). A small suggestion, the status bar could take care of setting the correct parent with CWnd::SetParent() and maybe takes ownership of created objects (calling DestroyWindow and delete in destructor).
As an alternative a simple status bar could override CStatusBar::DrawItem.
Cheers
/M
|
|
|
|
 |
|
 |
I've a prolem. I wish display color on statusbar, but i don't know how to do that.
Any suggestions would be of great help.
Thanks
|
|
|
|
 |
|
 |
In the CExtStatusControlBar implementation in this article you cannot directly change the panes background color. You need to either repaint the pane yourself or insert some control, i.e. CStatic with changed background color. But if this control is used as a part of the Prof-UIS library you should know that in version 2.64 we added GetPaneBkColor()/SetPaneBkColor(), GetPaneTextColor()/SetPaneTextColor(), and OnQueryPaneBackColor() methods to the CExtStatusControlBar, which allows you to get and set colors of the background and text of a pane in the status bar. You can download the latest free version of the Prof-UIS library from the corresponding web-site www.prof-uis.com
Best regards,
Dmitriy Yakovlev
|
|
|
|
 |
|
 |
I have quick question (sorry if it is stupid): Why I can only add 1 kind of control to ExtStatusControlBar??? For me it doesn't make sense at all.
|
|
|
|
 |
|
 |
Don't worry. It's just a sample application restriction. You can freely add several controls of any kind. Just try it.
Best regards,
Dmitriy Yakovlev
|
|
|
|
 |
|
 |
Hi,
As said in my previous post I am trying to set an image as background to my status bar.
I am painting the image by handling NCPAINT in the status bar class, but the status bar alternates between the image and the normal background whenever I move the window around.
Can somebody please suggest any other way by which I can achieve the image backgroun d for my status bar.
Thanks in advance.
Regards,
Hari
|
|
|
|
 |
|
 |
Did you handle the WM_ERASEBKGND message?
Best regards,
Dmitriy Yakovlev
|
|
|
|
 |
|
 |
Hi,
I'm using this source code to add a marquee progressbar which will only appear when my app is busy. However, when it is in hidden state, the progress bar will appear whenever I am resizing the window. As I implemented the ON_UPDATE_COMMAND_UI_RANGE for this control to force it to hide whenever it is not needed, it will disappear when I release the mouse to stop resizing the window. Does anyone have any idea not to make it appear at all?
I was thinking of removing the control entirely whenever it is not needed and replace it with a dummy blank control. However, I think this will make the app unstable because at the time when the control is being replaced, there will be a short moment of the control being removed. At that point of time, some other threads could be writing text on other status panes and this could crash the app is the update is on the highest index pane. This is unless, I add additional measures to protect this from happening by using mutex, etc. It will be a painful process just to hide the control.
Any advice would be appreciated.
Thanks
John
|
|
|
|
 |
|
 |
Why do not use RemovePane and AddPane methods?
The RemovePane method will not destroy your control if you will use the SetPaneControl method with bAutoDestroy parameter set to false.
Best regards,
Dmitriy Yakovlev
|
|
|
|
 |
|
 |
Thank you Dmitriy.
It worked. Also, in addition, I will always use CommandToID to always get the correct index even if it is misaligned.
|
|
|
|
 |
|
 |
Yes, this is right approach.
Best regards,
Dmitriy Yakovlev
|
|
|
|
 |
|
 |
Hi,
Has anyone tried setting a background image for a status bar?
I have tried various ways but not able to achieve that.
Any suggestions would be of great help.
Thanks in advance,
Narahari
|
|
|
|
 |
|
 |
Did you mean setting an icon for the status bar pane? If yes, then you can use the CStatusBarCtrl::SetIcon method.
Best regards,
Dmitriy Yakovlev
|
|
|
|
 |
|
 |
Thanks for the quick response.
I actually want to set a bitmap as the background image for the whole status bar, not an icon.
|
|
|
|
 |
|
 |
In this case you have to manually paint all the status bar background and panes. The class in this article doesn't do this. You can use original class CExtStatusControlBar from the Prof-UIS Freeware[^] library which allows you to overide painting of the whole background or background of particular pane. This is done in the OnPaintEntireBackground and OnErasePaneBackground virtual methods.
Best regards,
Dmitriy Yakovlev
|
|
|
|
 |
|
 |
Thanks for the suggestion.
Will try to use that class.
Regards,
narahari Upadhya
|
|
|
|
 |
|
 |
Hi Dimitri,
Can I use this class also in a DialogBox without inheritance and modification in the class?
Thank you.
We are an example of helping each other.
|
|
|
|
 |
|
 |
Using the status bar in the dialogs is extremely easy.
Please take a look at this project.
We just generated a simple dialog-based application, added CTestDlg::m_wndStatusBar property and created it in the CTestDlg::OnInitDialog() method. To stick the status bar to the bottom of the dialog window, we invoke the CWnd::RepositionBars() method in the OnInitDialog() and OnSize() methods. You can replace the the CStatusBar class with CExtStatusControlBar. The result will be the same. Of course, after creating the status bar in your dialog, you need to initialize its panes.
Best regards,
Dmitriy Yakovlev
|
|
|
|
 |
|
 |
Well Dimitry,
You are a great guy for helping me with you quick response.
I'll work it out later, but again thank you very much!
We are an example of helping each other.
|
|
|
|
 |
|
 |
I want to pop a dialog, when click on progress bar.
how to do with it ?
|
|
|
|
 |
|
 |
Just create the CExtStatusControlBar-derived class and handle the mouse click event inside the derived class.
Best regards,
Dmitriy Yakovlev
|
|
|
|
 |