DialogWindow with Progressbar issue in my class


The Below class is for DialogWindow with Progressbar .

1). Progressbar is not getting closed automatically when the Thread stops.
2). I want to disable the Close box or When I click the close it should not exit from the window.(I wrote the closeButtonPressed() but not executing this definition)

Please help to solve above issues.

//class member function calls

class MyDialog: public DialogWindow,public Thread
	String strDlgName;
 	double dval ;
	ProgressBar* m_ptrPrgBar ;
	MyDialog(String strDlgName):DialogWindow(strDlgName,Colours::white,false),Thread("Test")
		 dval = -1.0;
		 m_ptrPrgBar = new  ProgressBar(dval); 
	void run()
 	    while (! threadShouldExit())
		//findParentComponentOfClass ((DialogWindow*) 0)->exitModalState(10); 
void closeButtonPressed(){               // wrote this for handling close from DocumentWindow-DialogWindow
		return;//do nothing
		delete m_ptrPrgBar;

Please use the bbcode ‘code’ tag to make your listings readable!

And why are you calling exitModalState on your progress bar? Presumably that’s not the modal component.

I am new to JUCE so I do’t know what I am supposed to call exit from dialog window.
So I tried the exitModalState on both DialogWindow and/or progressbar for exiting from the dialogwindow.
It did not exit.

Well, there’s no point calling exitModalState on anything that isn’t modal. Somewhere you must be calling runModalLoop on a component, so that’s the component that you need to tell to stop being modal!

But exitModalState won’t make the component magically disappear, it just stops it being modal. You probably also want to delete the dialog box or make it invisible.

Thanks for the explanation .
Yes. I want to delete the Dialog Box.what do I need to do?

After doing some analysis I got the solution. just need to replace the above run with below code

void run()
	while (! threadShouldExit())
			const MessageManagerLock mml (Thread::getCurrentThread());
                         Thread::Sleep(5000);  // for testing 
			if (! mml.lockWasGained())  // if something is trying to kill this job, the lock
			if(m_ptrPrgBar->getParentComponent() != NULL)