Set cursor problem during shell execute

Hello,

I want to change the cursor to “wait” (hourglass) before I start a shell and back to normal after the shell has finished.
So basically I want to set the cursor to “wait\hourglass” on the client side while an external command via shell is executed on the server side… is this possible ?

This is what I’ve tried:

[code] dim s as shell
s = New Shell

webpage1.Cursor = 4 'Wait\hourglass
'self.Cursor = System.WebCursors.Wait

s.Mode = 0 'synchron
s.TimeOut = 120000 '2 minutes
s.Execute(“external server command”) 'this runs about 1 minute. Cursor is not wait\hourglass but normal

webpage1.Cursor = 1 'normal ’ I think this is executed before the shell finishes and therefore I dont see a wait-cursor…[/code]

I use Windows2012 and Xojo 2015r2.4

Yeah, that’s not going to work. All of the commands that you execute are queued up and returned when the event finishes, so it’s not that the second one executes too fast, it’s that the first one hasn’t been sent to the browser yet.

To do what you want, you’ll need to use a Thread. Basically you set the cursor and then start the thread. When it’s done, you set the cursor back. Just make sure you subclass WebThread.

That said, you probably don’t want to be using a synchronous shell either. You’ll likely lock up the app for other sessions as well. Better to subclass he shell object and use the handle the events when the command completes.

thank your for your answer.
So you recommend a thread, I’ll try that.

But is it not possible to try a delay, something like :

[code]dim s as shell
s = New Shell
webpage1.Cursor = 4 'Wait\hourglass
s.Mode = 0 'synchron

'sleep/wait here to allow to send to browser:
'app.CurrentThread.Sleep(2000)
or

dim t as double = ticks
dim iSeconds as integer = 2
dim iWaitTicks as double = iSeconds*60

While ticks-t < iWaitTicks
app.DoEvents
wend

s.Execute(“external server command”) 'this runs about 1 minute. Cursor is not wait\hourglass but normal

webpage1.Cursor = 1 'normal[/code]

I have tried the above “wait” commands but it didn’t work.
So it’s not worth to experiment further with “wait” commands?

[quote=217301:@Heinz Wieczorek]thank your for your answer.
So you recommend a thread, I’ll try that.

But is it not possible to try a delay, something like :

[code]dim s as shell
s = New Shell
webpage1.Cursor = 4 'Wait\hourglass
s.Mode = 0 'synchron

'sleep/wait here to allow to send to browser:
'app.CurrentThread.Sleep(2000)
or

dim t as double = ticks
dim iSeconds as integer = 2
dim iWaitTicks as double = iSeconds*60

While ticks-t < iWaitTicks
app.DoEvents
wend

s.Execute(“external server command”) 'this runs about 1 minute. Cursor is not wait\hourglass but normal

webpage1.Cursor = 1 'normal[/code]

I have tried the above “wait” commands but it didn’t work.
So it’s not worth to experiment further with “wait” commands?[/quote]

You must keep in mind that the UI will not be updated until the event finishes. So what you are trying to do will not show.

You could try setting up the cursor in a 0 period timer.

[quote=217301:@Heinz Wieczorek]I have tried the above “wait” commands but it didn’t work.
So it’s not worth to experiment further with “wait” commands?[/quote]
No. As I said, the response is queued. Basically we gather all of the commands that need to be sent back to the browser in memory and then send them all as one big chunk. So all you’re doing is delaying the whole response…