Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Controls
  New Posts New Posts RSS Feed - Modeless Marquee Progress Bar Using CXTPTaskBarDlg
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Modeless Marquee Progress Bar Using CXTPTaskBarDlg

 Post Reply Post Reply
Author
Message
Cheerios View Drop Down
Groupie
Groupie


Joined: 19 December 2006
Status: Offline
Points: 18
Post Options Post Options   Thanks (0) Thanks(0)   Quote Cheerios Quote  Post ReplyReply Direct Link To This Post Topic: Modeless Marquee Progress Bar Using CXTPTaskBarDlg
    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!


Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 02 March 2009 at 12:46am
Hi,
 
In "some stuff" block you have sometimes call AfxGetApp()->PumpMessage() to allow Windows process messages.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Cheerios View Drop Down
Groupie
Groupie


Joined: 19 December 2006
Status: Offline
Points: 18
Post Options Post Options   Thanks (0) Thanks(0)   Quote Cheerios Quote  Post ReplyReply Direct Link To This Post Posted: 02 March 2009 at 7:13am
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!

Back to Top
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Posted: 19 March 2009 at 12:29pm
What would be the proper way if you want a modal CXTPTaskDialog which does not block the main thread?
PokerMemento - http://www.pokermemento.com/
Back to Top
Cheerios View Drop Down
Groupie
Groupie


Joined: 19 December 2006
Status: Offline
Points: 18
Post Options Post Options   Thanks (0) Thanks(0)   Quote Cheerios Quote  Post ReplyReply Direct Link To This Post Posted: 19 March 2009 at 1:52pm
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
Back to Top
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Posted: 25 March 2009 at 2:50pm

It's a well-known problem. Read this:

PokerMemento - http://www.pokermemento.com/
Back to Top
lauralucas View Drop Down
Newbie
Newbie


Joined: 24 October 2006
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote lauralucas Quote  Post ReplyReply Direct Link To This Post Posted: 20 August 2009 at 3:54pm
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.

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.141 seconds.