Matt,

Sure thing. Here you go:

Sub GetScriptsForCategory(category)
    Dim scripts, script, myRating
Set scripts = xmlObj.selectNodes("//script[category = """ & category.Text & """]")
    For Each script In scripts
        If Not canceled Then
            Dim app : Set app = NewApp(script)
            If Not app Is Nothing Then
                Dim categoryid : categoryid = category.getAttribute("id")
                If Not appCategories Is Nothing Then
                    If appCategories.Exists(categoryid) Then
If Not appCategories(categoryid).Apps.Exists(app.ID) Then Set appCategories(categoryid).Apps(app.ID) = app
                        End If
                    End If
                End If
            End if
            If Not progressDialog Is Nothing Then
                progressDialog.Control("progress").Increase(1)
            End If
            Set app = Nothing
            DoEvents
        End If
    Next
End Sub

You'll notice the DoEvents call happens inside the For Each loop. Without it, the progress bar (progressDialog.Control("progress")) wouldn't visually (and audibly) increment.

Aaron

On 6/24/2012 10:34 AM, MJ Williams wrote:
Thanks Aaron. I wonder, would it be possible to see the code frag which you're refering to? I downloaded and installed appGet, however, it would seem the app is actually incrypted and the code is therefore not open to scrutiny.
Regards
Matt
At 13:03 19/06/2012, you wrote:
Matt,

AppGet is one of several GW Micro apps that uses DoEvents. Specifically, App Get uses a foreach loop to parse XML data about available apps while updating a progress bar. DoEvents is used inside that loop to allow the message queue to be processed so that the progress bar updates. If DoEvents was not used, the message queue would be tied up so that the progress bar wouldn't update until the loop was complete.

Aaron


On 6/18/2012 9:07 PM, MJ Williams wrote:
Hi
I understand the
idea
behind
doEvents,
but haven't yet really succeed in replicating a situation in code for which it was designed. I would be grateful if anyone could point me to a code fragment or something that illustrates the proper and effective use of doEvents.
Thanks guys.
Regards
Matt

--
Aaron Smith
Web Development * App Development * Product Support Specialist
GW Micro, Inc. * 725 Airport North Office Park, Fort Wayne, IN 46825
260-489-3671 * gwmicro.com

To insure that you receive proper support, please include all past
correspondence (where applicable), and any relevant information
pertinent to your situation when submitting a problem report to the GW
Micro Technical Support Team.



--
Aaron Smith
Web Development * App Development * Product Support Specialist
GW Micro, Inc. * 725 Airport North Office Park, Fort Wayne, IN 46825
260-489-3671 * gwmicro.com

To insure that you receive proper support, please include all past
correspondence (where applicable), and any relevant information
pertinent to your situation when submitting a problem report to the GW
Micro Technical Support Team.



Reply via email to