|
Log in | ||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|
Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
Hi,
Not quite a NexusDB-problem, but still related... I want to inform my users about the progress of 'doing something' with my tables. Something like this progressbar1.visible := true; progressbar1.max := nxtable1.recordcount; progressbar1.position := 0; while not nxtable1.eof do begin // do something with all kinds of records... progressbar1.position := progressbar.position + 1; // the progressbar is not on screen until the complete loop has finished. // so I add: progressbar1.repaint; // still no effect. The square where the progressbar should come is 'blanked', and after the complete loop has finished, it is on screen. But: too late.... nxtable1.next; end; How can I show the complete process in the progressbar? Hans |
|
#2
|
|||
|
|||
|
On Mon, 14 Apr 2008 17:19:37 +0200, "Hans" <hans at zze dot nl> wrote:
>Hi, > >Not quite a NexusDB-problem, but still related... > >I want to inform my users about the progress of 'doing something' with my >tables. > >Something like this > >progressbar1.visible := true; >progressbar1.max := nxtable1.recordcount; >progressbar1.position := 0; >while not nxtable1.eof do > begin > // do something with all kinds of records... > progressbar1.position := progressbar.position + 1; > // the progressbar is not on screen until the complete loop has finished. > // so I add: > progressbar1.repaint; > // still no effect. The square where the progressbar should come is >'blanked', and after the complete loop > has finished, it is on screen. But: too late.... > nxtable1.next; > end; > >How can I show the complete process in the progressbar? Repaint triggers an Invalidate message, which triggers the real Paint message. Thus in any case the application has to process more than one message to generate a full repaint option. So you need a safeguarded message processor if Application.ProcessMessages might have unwanted side effects. Regards from Germany Franz-Leo Chomse [NexusDB Expert] franz.leo.chomse@ndx.nexusdb_x.com (please remove "_x" to reply) |
|
#3
|
|||
|
|||
|
Ehh,
What, and how, do you mean?? Hans "Franz-Leo Chomse [NDX]" <franz.leo.chomse@ndx.nexusdb.com> schreef in bericht news:bdu604hnrnl4b71ev9o5glooctab9iq506@4ax.com... > On Mon, 14 Apr 2008 17:19:37 +0200, "Hans" <hans at zze dot nl> wrote: > >>Hi, >> >>Not quite a NexusDB-problem, but still related... >> >>I want to inform my users about the progress of 'doing something' with my >>tables. >> >>Something like this >> >>progressbar1.visible := true; >>progressbar1.max := nxtable1.recordcount; >>progressbar1.position := 0; >>while not nxtable1.eof do >> begin >> // do something with all kinds of records... >> progressbar1.position := progressbar.position + 1; >> // the progressbar is not on screen until the complete loop has >> finished. >> // so I add: >> progressbar1.repaint; >> // still no effect. The square where the progressbar should come is >>'blanked', and after the complete loop >> has finished, it is on screen. But: too late.... >> nxtable1.next; >> end; >> >>How can I show the complete process in the progressbar? > > Repaint triggers an Invalidate message, which triggers the real Paint > message. Thus in any case the application has to process more than one > message to generate a full repaint option. So you need a safeguarded > message processor if Application.ProcessMessages might have unwanted > side effects. > > Regards from Germany > > Franz-Leo Chomse [NexusDB Expert] > franz.leo.chomse@ndx.nexusdb_x.com (please remove "_x" to reply) |
|
#4
|
|||
|
|||
|
On Mon, 14 Apr 2008 19:04:48 +0200, "Hans" <hans at zze dot nl> wrote:
>Ehh, >What, and how, do you mean?? put an application.processmessages call after the repaint call. If this has side effects like unwanted triggering of events you either have to implement your own message loop filtering the processed messages or prevent the calling of the problematic event handlers during the time your loop is executing. Regards from Germany Franz-Leo Chomse [NexusDB Expert] franz.leo.chomse@ndx.nexusdb_x.com (please remove "_x" to reply) |
|
#5
|
|||
|
|||
|
Hans wrote:
> Hi, > > Not quite a NexusDB-problem, but still related... > > I want to inform my users about the progress of 'doing something' with my > tables. > > Something like this > > progressbar1.visible := true; > progressbar1.max := nxtable1.recordcount; > progressbar1.position := 0; > while not nxtable1.eof do > begin > // do something with all kinds of records... > progressbar1.position := progressbar.position + 1; > // the progressbar is not on screen until the complete loop has finished. > // so I add: > progressbar1.repaint; > // still no effect. The square where the progressbar should come is > 'blanked', and after the complete loop > has finished, it is on screen. But: too late.... > nxtable1.next; > end; > > How can I show the complete process in the progressbar? > > Hans > > I wrote a TSSProgessDialog component about 10 years ago that I have modified as needed over the years and it acts as follows: 1) Drop a TSSProgessDialog component on your form (or datamodule). 2) Create an OnSSProgressDialogExecute method within parent component. 3) Set TSSProgressDialog instance properties. 4) Execute TSSProgressDialog Execute() method which shows a progress dialog (on main VCL thread), creates a worker thread, and calls the OnSSProgressDialogExecute event method. This method assumes: That the OnSSProgessDialogExecute method is thread safe (i.e. all DisableControls() / control .BeginUpdate(), etc. were called before progress dialog started. Benefits include: 1) Component allows the progress to be aborted if a flag is set from within the Execute event... 2) An elapsed progress is being displayed allowing user to know that application hasn't locked up. 3) The dialog has an optinal progress bar which can be updated via the OnSSProgressDialogExecute. 4) During a lengthly process, if the user switches applications and then switches back, your application will draw the screen immediately as the main VCL thread isn't locked down. My component is in C++ and I do use a component from TMS for the progress bar. If anyone is interested, please drop me an email at ShaneATStumpWare.com (replace AT with @) and I will put the bar basics together for you. Best Regards, Shane |
|
#6
|
|||
|
|||
|
I mean you can just use the .update method of the component. I use on other
visuel components and this does not fire other events or need the application.processmessages loop. Bo Nielsen "Hans" <hans at zze dot nl> skrev i en meddelelse news:48037351$1@nexus-vkpb9bih5.Nexus.local... > Hi, > > Not quite a NexusDB-problem, but still related... > > I want to inform my users about the progress of 'doing something' with my > tables. > > Something like this > > progressbar1.visible := true; > progressbar1.max := nxtable1.recordcount; > progressbar1.position := 0; > while not nxtable1.eof do > begin > // do something with all kinds of records... > progressbar1.position := progressbar.position + 1; > // the progressbar is not on screen until the complete loop has finished. > // so I add: > progressbar1.repaint; > // still no effect. The square where the progressbar should come is > 'blanked', and after the complete loop > has finished, it is on screen. But: too late.... > nxtable1.next; > end; > > How can I show the complete process in the progressbar? > > Hans > |
|
#7
|
|||
|
|||
|
Hi Hans,
the only thing you have to do is calling "Application.Processmessages" in your loop... > progressbar1.visible := true; > progressbar1.max := nxtable1.recordcount; > progressbar1.position := 0; > while not nxtable1.eof do > begin > // do something with all kinds of records... > progressbar1.position := progressbar.position + 1; ---- // update screen every 10th action if ProgressBar1.Position mod 10 = 0 then Application.ProcessMessages; ---- > // the progressbar is not on screen until the complete loop has finished. > // so I add: > progressbar1.repaint; > // still no effect. The square where the progressbar should come is > 'blanked', and after the complete loop > has finished, it is on screen. But: too late.... > nxtable1.next; > end; Kind Regards Otto |
|
#8
|
|||
|
|||
|
Hans wrote:
> Hi, > > Not quite a NexusDB-problem, but still related... > > I want to inform my users about the progress of 'doing something' > with my tables. > > How can I show the complete process in the progressbar? Use the StepIt method. -- |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Batch Processing | Bruce Nich | nexusdb.public.support | 12 | 12th November 2007 01:34 PM |
| OT Credit Card Processing | David Guest | nexusdb.public.discussions | 6 | 22nd November 2003 03:53 PM |
| Transaction Processing | William E. Mahaffey | nexusdb.public.support.sql | 2 | 23rd October 2003 01:51 AM |
| Script processing | Ole Willy Tuv | nexusdb.public.support.sql | 8 | 10th October 2003 02:03 AM |
| A simple way of checking and restructing nxTables | Richard Wilson | nexusdb.public.support.thirdparty | 0 | 8th October 2003 02:04 PM |