Home All Groups Group Topic Archive Search About

Odd sequencin of window display

Author
19 Oct 2005 3:01 PM
Charles Krug
I have a form that I display whenever the user needs to wait for some
time called frmLongWait.

It has a ShowForm method that takes a string argument that is supposed
to splash up before the various progress screens display.

Instead what happens is this:

1. Empty frmLongWait displays
2. We wait . . . .
3. We wait . . . .
4. frmLongWait displays its text simultaneously with the first progress
bar.

What I'd LIKE to see happen is:

1. frmLongWait displays with the proper text
2. We wait
3. We wait
4. We wait
5. First progress bar appears.

sub timeConsumingMethod()

    frmLongWait.ShowForm "Checking for Updates", _
        "Checking for Updates." & vbCrLf & vbCrLf _
        & "This may take a few minutes."

    ' setup stuff

    ' progressBar.Display()

    ' do until done
    '
    '    doStuff
    '    progressBar.Update()
    '
    ' loop

end sub

frmLongWait.ShowForm() just assigns a couple text properties then
invokes the .show method on the form.

Do I need a DoEvents after I invoke .ShowForm?  The function does a nice
big pile of network accesses over a WAN.

Author
19 Oct 2005 3:19 PM
Bob Butler
"Charles Krug" <cdk***@worldnet.att.net> wrote in message
news:_ct5f.461492$5N3.461484@bgtnsc05-news.ops.worldnet.att.net
>     frmLongWait.ShowForm "Checking for Updates", _
>         "Checking for Updates." & vbCrLf & vbCrLf _
>         & "This may take a few minutes."

frmLongWait.Refresh
(and maybe DoEvents)

>     ' progressBar.Display()
>     '    progressBar.Update()

This is VB6, right?

--
Reply to the group so all can participate
VB.Net: "Fool me once..."
Author
19 Oct 2005 3:28 PM
Charles Krug
On Wed, 19 Oct 2005 08:19:48 -0700, Bob Butler <tiredofit@nospam.com>
wrote:
Show quoteHide quote
> "Charles Krug" <cdk***@worldnet.att.net> wrote in message
> news:_ct5f.461492$5N3.461484@bgtnsc05-news.ops.worldnet.att.net
>>     frmLongWait.ShowForm "Checking for Updates", _
>>         "Checking for Updates." & vbCrLf & vbCrLf _
>>         & "This may take a few minutes."
>
> frmLongWait.Refresh
> (and maybe DoEvents)
>
>>     ' progressBar.Display()
>>     '    progressBar.Update()
>
> This is VB6, right?
>

VB6-SP5
Author
19 Oct 2005 3:32 PM
Bob Butler
Show quote Hide quote
"Charles Krug" <cdk***@worldnet.att.net> wrote in message
news:NCt5f.461611$5N3.240115@bgtnsc05-news.ops.worldnet.att.net
> On Wed, 19 Oct 2005 08:19:48 -0700, Bob Butler <tiredofit@nospam.com>
> wrote:
>> "Charles Krug" <cdk***@worldnet.att.net> wrote in message
>> news:_ct5f.461492$5N3.461484@bgtnsc05-news.ops.worldnet.att.net
>>>     frmLongWait.ShowForm "Checking for Updates", _
>>>         "Checking for Updates." & vbCrLf & vbCrLf _
>>>         & "This may take a few minutes."
>>
>> frmLongWait.Refresh
>> (and maybe DoEvents)
>>
>>>     ' progressBar.Display()
>>>     '    progressBar.Update()
>>
>> This is VB6, right?
>>
>
> VB6-SP5

OK, the trailing () and use of 'display' and 'update' instead of 'refresh'
makes it look .Nettish

I'd probably first trying incorporating Me.Refresh in the ShowForm method of
frmLongWait

--
Reply to the group so all can participate
VB.Net: "Fool me once..."
Author
19 Oct 2005 3:46 PM
Someone
>> frmLongWait.Refresh

Did this suggestion work?

Another:

Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal
hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As
Long
Public Const WM_PAINT = &HF

SendMessage frmLongWait.hWnd, WM_PAINT, 0 , ByVal 0&



Show quoteHide quote
"Charles Krug" <cdk***@worldnet.att.net> wrote in message
news:NCt5f.461611$5N3.240115@bgtnsc05-news.ops.worldnet.att.net...
> On Wed, 19 Oct 2005 08:19:48 -0700, Bob Butler <tiredofit@nospam.com>
> wrote:
>> "Charles Krug" <cdk***@worldnet.att.net> wrote in message
>> news:_ct5f.461492$5N3.461484@bgtnsc05-news.ops.worldnet.att.net
>>>     frmLongWait.ShowForm "Checking for Updates", _
>>>         "Checking for Updates." & vbCrLf & vbCrLf _
>>>         & "This may take a few minutes."
>>
>> frmLongWait.Refresh
>> (and maybe DoEvents)
>>
>>>     ' progressBar.Display()
>>>     '    progressBar.Update()
>>
>> This is VB6, right?
>>
>
> VB6-SP5
>
Author
19 Oct 2005 3:44 PM
Nospam
Show quote Hide quote
"Charles Krug" <cdk***@worldnet.att.net> wrote in message
news:_ct5f.461492$5N3.461484@bgtnsc05-news.ops.worldnet.att.net...
> I have a form that I display whenever the user needs to wait for some
> time called frmLongWait.
>
> It has a ShowForm method that takes a string argument that is supposed
> to splash up before the various progress screens display.
>
> Instead what happens is this:
>
> 1. Empty frmLongWait displays
> 2. We wait . . . .
> 3. We wait . . . .
> 4. frmLongWait displays its text simultaneously with the first progress
> bar.
>
> What I'd LIKE to see happen is:
>
> 1. frmLongWait displays with the proper text
> 2. We wait
> 3. We wait
> 4. We wait
> 5. First progress bar appears.
>
> sub timeConsumingMethod()
>
>     frmLongWait.ShowForm "Checking for Updates", _
>         "Checking for Updates." & vbCrLf & vbCrLf _
>         & "This may take a few minutes."
>
>     ' setup stuff
>
>     ' progressBar.Display()
>
>     ' do until done
>     '
>     '    doStuff
>     '    progressBar.Update()
>     '
>     ' loop
>
> end sub
>
> frmLongWait.ShowForm() just assigns a couple text properties then
> invokes the .show method on the form.
>
> Do I need a DoEvents after I invoke .ShowForm?  The function does a nice
> big pile of network accesses over a WAN.
>

You can sometimes use DoEvents, but it can be a little hit-or-miss I've
noticed.
The way I do it is to Refresh the Form with the ProgressBar on it i.e.
Form2.refresh after .ShowForm to force the form to display and then (if
necessary) Form2.ProgressBar.refresh after each update (assuming Form2 etc
and that ProgressBar supports Refresh!).
You might get away with just using Form2.ProgressBar.refresh after
..ShowForm.
I afraid it is trial-and-error to discover what works to create the best
display.

John..