What is the best way to get webprogresswheel to show during a synchronis HTTPSocket get/post

I doing the get/post from a button doesn’t work because the wheel doesn’t show until after the button’s action event completes…

SiteHomePage.ProgressWheel1.Visible = true DIM socket1 As New HTTPSocket DIM data As string = socket1.Get("http://"+Host+"/chaos/regConfirmation?"+get, 30) SiteHomePage.ProgressWheel1.Visible = false

Removing SiteHomePage.ProgressWheel1.Visible = false, results in the wheel displaying after the action event handler has handled the data returned.

Is there an accepted way to get this done?

John

Is it possible to do it asynchronously since you’re pretending to anyway?
If not, perform the http request in a timer, and in the button action event start the animation and the timer.

All the html commands are sent to the browser after the event completes. You need to separate the Get command into its own event (usually done with a timer).

Maybe a SiteHomePage.ProgressWheel1.Refresh or a SiteHomePage.Invalidate?

@Tim Hare Unless I am misunerstanding what you mean by “after” the event completes, I don’t believe that is the case as I am handling the returned data during the event…

[code]SiteHomePage.ProgressWheel1.Visible = true
DIM socket1 As New HTTPSocket
DIM data As string = socket1.Get(“http://”+Host+"/chaos/regConfirmation?"+get, 30)
SiteHomePage.ProgressWheel1.Visible = false

Dim reader As New myXMLReader
Dim responseDictionary As New Dictionary
reader.Output = responseDictionary
reader.Parse(data)…etc.
[/code]

Works fine.

@Tim Parnell Not sure what you mean by pretending to do it asychronously, but I was intending to use a timer as you suggest.

I was wondering if there is an accepted methodoly. Guess I will just go the time route.

Thanks,

John

Moved the action script to a timer and it works fine there. I’ts a little funky in that you can’t remove the progressweel during the timer action event, so unless you use another timer and you need to throw a MsgBox up, the progressweel continues to spin until the user dismisses the MsgBox.

I can live with that.

Thanks,

Or do things asynchronously. A lot more flexibility to handle things however you want.

I meant the html that your app sends to display the progresswheel. It isn’t sent to the client’s browser until the event completes.

SiteHomePage.ProgressWheel1.Visible = true    // html/javascript is generated but not sent yet
DIM socket1 As New HTTPSocket
DIM data As string = socket1.Get("http://"+Host+"/chaos/regConfirmation?"+get, 30) 
SiteHomePage.ProgressWheel1.Visible = false   // more html/javascript is generated but not sent
// now all the html is sent to the browser, which will display the progresswheel and immediately hide it

Communication with the browser is not immediate as your code executes. It is queued up and sent all together.

@Tim Hare Not to beat a dead horse, but I would like to understand what you are trying to say.

If I understand you correctly any and all javascript generated during an event is not sent to the browser until after the event completes. So all the socket and XMLReader code is not generating any javascript/html and so runs within the event. When the event ends any javascript/html generated is sent to the browser.

Is that the gist of it? If so you just created an Ah Haa moment for me.

I am still getting the hang of how a web app works, and this helps a lot. Thanks.

John

[quote=207488:@John Baughman] So all the socket and XMLReader code is not generating any javascript/html and so runs within the event. When the event ends any javascript/html generated is sent to the browser.

Is that the gist of it?[/quote]
That is correct.