Modeless Marquee Progress Bar Using CXTPTaskBarDlg |
Post Reply |
Author | |
Cheerios
Groupie Joined: 19 December 2006 Status: Offline Points: 18 |
Post Options
Thanks(0)
Posted: 27 February 2009 at 1:51pm |
Hi,
I am trying to create a modeless marquee progress bar that will remain up while a long process is taking place. I have created a derived class from the CXTPTaskBarDlg class. I can get the dialog to come up with a progress bar that shows a portion of the progress bar as having been initially incremented, but the progress bar doesn't continuously cycle like it should after that point. I would also like to remove all buttons from the dialog window, since this is a modeless dialog with no cancellation options. If anyone has any insight into how I can make the modeless marquee progress bar update correctly and create the CXTPTaskBarDlg without any buttons, I'd really appreciate it. I've based my code on the VistaTaskDialog example, as well as the post <https://forum.codejock.com/forum_posts.asp?TID=7706&KW=marquee>. Product: Xtreme Toolkit (MFC) version 13.0.0 Platform: Windows Vista (64bit) - SP 1 (running CodeJock and program in 32bit mode) Language: C++ The code I've been using is below: //------------------------------------------------------- // ProgressBarDlg.h : interface for the CProgressBarDlg class. #pragma once #include "stdafx.h" #include "resource.h" // CProgressBarDlg dialog class CProgressBarDlg : public CXTPTaskDialog public: CProgressBarDlg(CWnd* pParent = NULL); // standard constructor virtual ~CProgressBarDlg(); protected: void OnDialogConstructed(); }; //------------------------------------------------------- // ProgressBarDlg.cpp : implementation file #include "stdafx.h" #include "resource.h" #include "ProgressBarDlg.h" // CProgressBarDlg dialog CProgressBarDlg::CProgressBarDlg(CWnd* pParent /*=NULL*/) : CXTPTaskDialog(pParent) { //this->m_arrButtons.RemoveAll(); this->EnableCancellation(FALSE); this->AddButton("Default", IDC_BUTTON1); // Don't actually want this. m_config.dwFlags |= TDF_SHOW_PROGRESS_BAR; } CProgressBarDlg::~CProgressBarDlg() { } void CProgressBarDlg::OnDialogConstructed() { //this->m_arrButtons.RemoveAll(); this->EnableButton(IDC_BUTTON1,FALSE); this->SetMarqueeProgressBar(TRUE); this->StartProgressBarMarquee(TRUE, 10); } //------------------------------------------------------- // Code in program CProgressBarDlg dlg(this); dlg.Create(this); dlg.SetWindowTitle("Reading Data..."); // ...Do some stuff dlg.DestroyWindow(); //------------------------------------------------------- Thanks in advance for your help! |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hi,
In "some stuff" block you have sometimes call AfxGetApp()->PumpMessage() to allow Windows process messages.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
Cheerios
Groupie Joined: 19 December 2006 Status: Offline Points: 18 |
Post Options
Thanks(0)
|
Hi Oleg,
I tried the AfxGetApp->PumpMessage() command, but for some reason, I still couldn't get the marquee to start up. It works if I make it modal, but it just won't cycle if it's in the modeless state. I'm sure it's something that I'm doing wrong! About the buttons...Is there a way to eliminate ALL buttons from the task dialog, even the default OK? I tried both m_arrButtons.RemoveAll() and SetCommonButtons(0,0,0,0,0,0), but neither worked. Thanks for your help! |
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
What would be the proper way if you want a modal CXTPTaskDialog which does not block the main thread?
|
|
PokerMemento - http://www.pokermemento.com/
|
|
Cheerios
Groupie Joined: 19 December 2006 Status: Offline Points: 18 |
Post Options
Thanks(0)
|
Hi again znakeeye,
In my trials, I called the DoModal method in place of the Create method. That got the marquee going correctly, but I wasn't able to do any processing because the dialog tied everything up at that point. Could I have overridden the DoModal method in the progress bar class and performed the processing there or used some kind of callback method to access the processing code? I may not understand the proper way to use modal progress bars -- I couldn't find a good example that illustrated actually doing something while the modal progress bar was active. Thanks! |
|
Product: Xtreme ToolkitPro 2009 (13.0.0)
Platform: Windows Vista (64bit) - SP 1 (running CodeJock and program in 32bit mode) Language: Visual C++ 2008 |
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
It's a well-known problem. Read this: |
|
PokerMemento - http://www.pokermemento.com/
|
|
lauralucas
Newbie Joined: 24 October 2006 Status: Offline Points: 2 |
Post Options
Thanks(0)
|
I had the same problem, I solved it with this:
virtual void OnDialogConstructed() { SetMarqueeProgressBar(TRUE); StartProgressBarMarquee(TRUE, 10); GetDlgItem(IDOK)->ShowWindow(FALSE); } This way you have a dialog with no buttons and the marquee works. |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |