Developer forum
cancel
Showing results for 
Search instead for 
Did you mean: 

[SOLVED] Is there a way to make a loading progress bar

Anonymous
Not applicable
Hi

I would like to know is there a way to make a loading progress bar by AC API.
I'm getting information from web service and somethimes it's take 10 second or more so I want to show loading process.
If there is not a solution by AC API then is it right to do it by third party library, for example by BOOST ?

Please give me an advice.
2 REPLIES 2

Tibor Lorantfy
Graphisoft Alumni
Graphisoft Alumni
Hi,

yes, AC API provides two options to make progressbar:

1) You can use DG::ProgressBar class (defined in DGBarControl.hpp).
- first define the progressbar in your GRC resource file:
'GDLG'  32500  Modal | noGrow      0    0  312  195  "Dialog with ProgressBar" { 
//... 
/* [  6] */ ProgressBar			   13  140  286   15	/*minValue:*/ 0  /*maxValue:*/ 100  ClientEdge 
//... 
}

- add DG::ProgressBar to your dialog class:
class MyDialog : public DG::ModalDialog 
{ 
private: 
		// friend classes 
	friend class	MyObserver; 
 
private: 
	//... 
	DG::ProgressBar		m_progressBar; 
	//... 
 
public: 
	MyDialog (GSResModule dialResModule, short resId, GSResModule dialIconResModule); 
   ~MyDialog (); 
};

- in the constructor of your dialog don't forget to initialize the progressbar:
MyDialog::MyDialog (GSResModule dialResModule, short resId, GSResModule dialIconResModule): 
	DG::ModalDialog		(dialResModule, resId, dialIconResModule), 
	m_progressBar	(GetReference (), 6), 
	//... 
{ 
}

- now you can use the initialized progressbar in you code the following way:
m_progressBar.SetValue (<new value between minValue and maxValue>);


2) You can use the ACAPI_Interface ProcessWindow methodgroup to show a processwindow with a progressbar.
// Init processwindow: 
	short nPhase	= 1; 
	Int32 maxValue	= 100; 
	ACAPI_Interface (APIIo_InitProcessWindowID, "<progressTitle>", &nPhase); // you can define more phases also 
// Start progressbar: 
	ACAPI_Interface (APIIo_SetNextProcessPhaseID, "<progressSubtitle>", &maxValue); 
// Update progressbar with new value: 
	Int32 progress = 0; 
	ACAPI_Interface (APIIo_SetProcessValueID, &progress, NULL); 
	progress++; 
	ACAPI_Interface (APIIo_SetProcessValueID, &progress, NULL); 
// Processwindow contains a Cancel button also: 
	if (ACAPI_Interface (APIIo_IsProcessCanceledID, NULL, NULL)) { 
		// user cancelled the process! 
	}

- This is much more easier.

Regards,
Tibor

Anonymous
Not applicable
Thank you for the help. I use second one!

Still looking?

Browse more topics

Back to forum

See latest solutions

Accepted solutions

Start a new discussion!