Print Page | Close Window

Modeless Marquee Progress Bar Using CXTPTaskBarDlg

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Controls
Forum Description: Topics Related to Codejock Controls
URL: http://forum.codejock.com/forum_posts.asp?TID=13519
Printed Date: 15 May 2024 at 10:09am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Modeless Marquee Progress Bar Using CXTPTaskBarDlg
Posted By: Cheerios
Subject: Modeless Marquee Progress Bar Using CXTPTaskBarDlg
Date 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 < http://https//forum.codejock.com/forum_posts.asp?TID=7706&KW=marquee - 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!





Replies:
Posted By: Oleg
Date 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


Posted By: Cheerios
Date 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!



Posted By: znakeeye
Date 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/


Posted By: Cheerios
Date 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


Posted By: znakeeye
Date Posted: 25 March 2009 at 2:50pm

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

http://www.microsoft.com/msj/0798/c0798.aspx - http://www.microsoft.com/msj/0798/c0798.aspx


-------------
PokerMemento - http://www.pokermemento.com/


Posted By: lauralucas
Date 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.




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net