Please Help me !!
-
Hi all, In my application ,on fromview i m using a List, to fill the list i m using number of function on OnInitialUpdate() Function. when list fill than the mouse cursor is in wait mode and application looks like hang. i want to add any dilog box/message box without any button it inform the status or message like Please wait, and other processing continue in background. when list is filled the dilog box/message box closed automatically. please can anybody help me for this. thank in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
-
Hi all, In my application ,on fromview i m using a List, to fill the list i m using number of function on OnInitialUpdate() Function. when list fill than the mouse cursor is in wait mode and application looks like hang. i want to add any dilog box/message box without any button it inform the status or message like Please wait, and other processing continue in background. when list is filled the dilog box/message box closed automatically. please can anybody help me for this. thank in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
"_$h@nky_" wrote:
when list fill than the mouse cursor is in wait mode and application looks like hang.
Gather the information supposed to be displayed in the list box in a secondary thread while you have one item in the list saying something like "Updating..." or similar. When the thread has finished building a e.g.
std::list
with the elements for the list box, you walk through the list and add the elements to it. This way the application becomes responsive right away, but you inform the user that there is more data to be displayed in a while."It's supposed to be hard, otherwise anybody could do it!" - selfquote
"High speed never compensates for wrong direction!" - unknown -
"_$h@nky_" wrote:
when list fill than the mouse cursor is in wait mode and application looks like hang.
Gather the information supposed to be displayed in the list box in a secondary thread while you have one item in the list saying something like "Updating..." or similar. When the thread has finished building a e.g.
std::list
with the elements for the list box, you walk through the list and add the elements to it. This way the application becomes responsive right away, but you inform the user that there is more data to be displayed in a while."It's supposed to be hard, otherwise anybody could do it!" - selfquote
"High speed never compensates for wrong direction!" - unknown -
But i m using a ListCtrl,because i need a type of ReportView List.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
"_$h@nky_" wrote:
But i m using a ListCtrl,because i need a type of ReportView List.
The same mind set applies: prepare and format the data in a secondary thread before updating the UI element to make the UI updating process as fast as possible in order to have the application remain responsive.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote
"High speed never compensates for wrong direction!" - unknown -
"_$h@nky_" wrote:
But i m using a ListCtrl,because i need a type of ReportView List.
The same mind set applies: prepare and format the data in a secondary thread before updating the UI element to make the UI updating process as fast as possible in order to have the application remain responsive.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote
"High speed never compensates for wrong direction!" - unknown -
Can you please explain me with any example. thnks alot.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
"_$h@nky_" wrote:
Can you please explain me with any example.
No. This is mainly a design issue, for which I have suggested a solution. How to implement this design is for you to figure out, which shouldn't be too hard. If you have more specific questions in the nature of "how do I tell my main thread when the computation has finished", I'll be glad to answer them. But serving it on a silver plate would prevent you from learning and besides I don't have the time to do it. To give you an idea I suggest you read this article[^] regarding worker threads. It's the best in my opinion.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote
"High speed never compensates for wrong direction!" - unknown -
"_$h@nky_" wrote:
Can you please explain me with any example.
No. This is mainly a design issue, for which I have suggested a solution. How to implement this design is for you to figure out, which shouldn't be too hard. If you have more specific questions in the nature of "how do I tell my main thread when the computation has finished", I'll be glad to answer them. But serving it on a silver plate would prevent you from learning and besides I don't have the time to do it. To give you an idea I suggest you read this article[^] regarding worker threads. It's the best in my opinion.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote
"High speed never compensates for wrong direction!" - unknownhi , maybe you might not be conversant with threads or multithreading, which simply means, having many threads running at the same time, in one program, so am going to easily illustrate how you can overcome your problem using just one thread. i advice you place your code for filling the list in a function then you call the function in the Oninitupdate or since you want the list loaded at progream start. this is better and clearer than filling so much code in the oninitUpdate() fiuntion. so this is what we shall do, i hope you can tell the number of items you are putting in the list, Put a progress control , Add a control variable to it, call it "m_ctlProgress" using the wizard. ////////////////////// int nCounter = 0; int nNumberOfRecords = ctlProgress.SetRange(0,nNumberOfRecords ); for { ////////////////////////// Your filling code here ///////////////////////// nCounter++; m_ctlProgress.SetPos(nCounter); } then call the function from wherever, from the Oninit.. or when a certain button is clicked, etc
-
hi , maybe you might not be conversant with threads or multithreading, which simply means, having many threads running at the same time, in one program, so am going to easily illustrate how you can overcome your problem using just one thread. i advice you place your code for filling the list in a function then you call the function in the Oninitupdate or since you want the list loaded at progream start. this is better and clearer than filling so much code in the oninitUpdate() fiuntion. so this is what we shall do, i hope you can tell the number of items you are putting in the list, Put a progress control , Add a control variable to it, call it "m_ctlProgress" using the wizard. ////////////////////// int nCounter = 0; int nNumberOfRecords = ctlProgress.SetRange(0,nNumberOfRecords ); for { ////////////////////////// Your filling code here ///////////////////////// nCounter++; m_ctlProgress.SetPos(nCounter); } then call the function from wherever, from the Oninit.. or when a certain button is clicked, etc
:zzz: Some hints...:
- You replied to the wrong person.
- The function you're referring to is
OnInitialUpdate()
, nothing else. OnInitialUpdate()
is called before the view is displayed, which means that your progress bar probably won't even show if your code is called fromOnInitialUpdate()
.- You have not formatted your code using <pre></pre> tags, which makes it hard to read.
- At best, the user will still experience a non-responsive application even if your advice is followed.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote
"High speed never compensates for wrong direction!" - unknown