How to exit from Alertwindow with ProgressBar


#1

Hi,

I have a Alertwindow with ProgressBar and no other components.
I invoke this by using “runModalLoop()”.
Alertwindow is displaying properly .But I am not able to exit from the alertwindow.

Are there any API’s like “runModalLoop” which displays the alert window and exits based on some condition.

Thanks,
Manjunath M


#2

At any point you can just call exitModalState() or even just setVisible (false) to stop a component being modal.


#3

Thanks Jules for the reply.

Here is the sample which I am trying.

double m_PercentageValue;
AlertWindow* m_AlertWindow;
ProgressBar* m_ptrPrgBar ;

void StopProgressBar()
{
m_AlertWindow->exitModalState(10);
delete m_ptrPrgBar;
delete m_AlertWindow;
}

void StartProgressBar()
{
m_PercentageValue = 1.0;
m_AlertWindow = new AlertWindow(“Test”,“Progress Bar”,AlertWindow::NoIcon);
m_ptrPrgBar = new ProgressBar(m_PercentageValue);
m_ptrPrgBar->setPercentageDisplay(false);
m_ptrPrgBar->setSize(400, 30);
m_AlertWindow->addCustomComponent(m_ptrPrgBar);
m_AlertWindow->setVisible(true);
m_AlertWindow->runModalLoop();
}

First I want to invoke the “StartProgressBar()” and after some delay invoke StopProgressBar().

but it is not get exited from the alert window.


#4

Are you getting confused because runModalLoop() won’t return until something cancels the modal loop? If you don’t want it to actually block, then use enterModalState() rather than runModalLoop()


#5

If I use enterModalState() AlertWindows is getting displayed on backto the main window.
I mean I cant see the Alertwindow.


#6

Make it visible?


#7

I used m_AlertWindow->setVisible(true);
even though it is not getting displayed.


#8

What the use of adding progess bar to alert window. U should use thread to increase the progress. When thread finishes its execution u can sat exit moal state