Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Progress Bar
Message
 
To
21/05/1998 01:30:41
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Miscellaneous
Thread ID:
00100675
Message ID:
00100754
Views:
30
>>Does someone have an example of how to use the ActiveX progress bar that comes with VFP 5.0? I would like to see how it works with SQL. Currently I use VFP's TALK ON/OFF method, but am interseted in seeing how this control will look for my users. Is this the best control to use for progress bar, or is there another ActiveX Control that works better?
>>
>>Thanks for any information!!
>>
>>John.
>John,
>Below is Steve's suggestion how to use it. I cut&pasted it from a previous thread we were discussing.
>>>>As you wish, here is an idea:
>>>>
>>>>thisform.progressbar.MaxValue = reccount()
>>>>thisform.progressbar.Value = 0
>>>>
>>>>select , updateprogress();
>>>> from table1;
>>>> blah blah blah
>>>> into cursor tmp
>>>>thisform.progressbar.Value = thisform.progressbar.Maxvalue
>>>>
>>>>function updateprogress
>>>> thisform.progressbar.value = _tally
>>>>return .t.
>You either set progressbar.max property to maximum (reccount() typically) and then reset value property as process goes on, or leave min, max properties in their default (0-100) and reset value property to calculated percent value. Here the real concern, how much overtiming would it need to use with an UDF in an SQL. I think "set talk on" before SQL and set it off after SQL and kick in default VFP progress bar is better. Here Steve pointed out a good point. This wouldn't work with SDI forms. On the other side I don't think using _tally would work. I haven't tested it but I think _tally would be zero until record set is ready (on first call). If I'm right there should be another way to use is increment progbar value by 1 as each call to UDF but unfortunately it would mean to kill SQL optimization and cause a top to bottom search with each SQL. With noncomplex SQL(s) recno() could be a solution and pose the smoothest view. ie:
* Updatebar.method
>lparameters nRecNo
>thisform.progbar.value = nRecNo
>* Method where SQL called
>thisform.progbar.max = reccount("mytable")  && This would require the table be open
>select *, thisform.updatebar(recno()) from mytable ...
>thisform.progbar.value = reccount("mytable")
>* Or a more generic one w/o touching max property
>select *, thisform.updatebar(recno()*100/reccount()) from mytable ...
>thisform.progbar.value = 100
Neverthless all would slow down the process with recno() method seeming better. And as a last note there are better progresbar controls in files\classes section.
>Cetin

Actually, that's Vladimir's solution that is posted here in the files section.
I replied to him asking if he had ever timed this solution as we all know that UDFs tend to slow down SQL, sometimes considerably. I can't let this time go so it's no progress bar for now. One day maybe. I have built my own using just VFP but once again, it'd require a UDF to update so it's not used either.

Steve
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform