refresh - from background processes?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

refresh - from background processes?

Stew MacLean

Hi Bruce et al,

 

I’m not sure it’s the same problem but, coincidentally, I’m having problems updating the UI from a background process.

 

I want the background process to open a dialog. However I don’t want the dialog to block the background process.

 

So I tried uiEventFor: (not uiEventNowFor: ). As a result I seem to be running into similar problems with the dialog processing events from subsequent background events. (the events are being processed by the dialog, as it’s a child window of the argument window of uiEventFor:).

 

I’m wondering if there’s an accepted pattern for updating the UI from a background process, without blocking the background process?

 

(I’m thinking of using a buffer and then using uiEventNowFor: later to avoid the problem…)

 

Cheers,

 

Stewart

 

 

Reply | Threaded
Open this post in threaded view
|

Re: refresh - from background processes?

Bruce Badger
Stewart,

Could you expand on why the window you are opening needs to be a dialog?

If you don't want to block the parent window, perhaps just opening a
regular window would be the thing in this case?

--
Make the most of your skills - with OpenSkills
http://www.openskills.org/

Reply | Threaded
Open this post in threaded view
|

RE: refresh - from background processes?

Stew MacLean
Hi Bruce,

I want to block user input, so that the background updates get applied
to reflect the new "global" state immediately, before the user attempts
to make any conflicting changes.

I also want the user to be aware that updates are being made by somebody
else. A system modal dialog seemed the best way!

Cheers,

Stewart

>-----Original Message-----
>From: Bruce Badger [mailto:[hidden email]]
>Sent: 15 February 2006 8:47
>To: Vwnc
>Subject: Re: refresh - from background processes?
>
>Stewart,
>
>Could you expand on why the window you are opening needs to be a
dialog?
>
>If you don't want to block the parent window, perhaps just opening a
>regular window would be the thing in this case?
>
>--
>Make the most of your skills - with OpenSkills
>http://www.openskills.org/



Reply | Threaded
Open this post in threaded view
|

Re: refresh - from background processes?

Bruce Badger
Well, I'm certainly not the expert on this, but I understand that if a
dialog is modal with respect the the parent window, it will get all
the input events. ... at least I think that the parent *won't* get
them.

I guess you could use the technique I described in the other thread
and have the parent reject input events while the child is open.  My
stuff is very experemental, though.  I would wait to see if anyone
points out any obvious blunders in it before trying it if I were you.

--
Make the most of your skills - with OpenSkills
http://www.openskills.org/

Reply | Threaded
Open this post in threaded view
|

RE: refresh - from background processes?

Steven Kelly
In reply to this post by Stew MacLean
Message
Using a dialog is also the way we ended up going. What we wanted was a progress window with a gauge and a little transcript. The progress window would be opened for long blocks, and while it was open the UI of other windows should repaint if obscured, but not accept any input (nor should they buffer the input and execute it at the end). The long block should be able to open other windows, e.g. dialogs, which would accept input. I've spent probably a couple of weeks in total on this problem, and it's been rather frustrating (I can see why Bruce ended up with method names like #openTheDialogNowDamnit!).
 
I got things working about 98% with a normal window, but there were still occasional problems like events being leaked in certain cases (various XP look widgets do horrid stuff with responding to mouse over, for instance, and sometimes dialogs opened during the long block would have their buttons invisible, or not respond to input). I also made it possible that a window could choose to be refreshed from a cached bitmap of its contents, rather than the normal redraw (e.g. if the long block was changing the model objects the window needed to display itself). The results are published as RefreshingDisplayPolicy 1.3.1 in the public Store.
 
Next I tried making the progress window a dialog, and that helped - now Windows handled a lot of the issues, and we were just left handling the VW problems while opening and closing the progress dialog, and while opening dialogs during the long block. The main changes were to WindowManager>>addEvent: (to not add unwanted input events to the queue) and ApplicationDialogController>>eventLoop (to process the next non-input event and remove it from the queue, whilst leaving the rest of the queue unchanged). There's also a bug correction for TextCollectorView>>update:, which leaks events, and WinXPTriggerButton, which UHEs when trying to process old ExitEvents.
 
The code for the dialog version references our progress dialog and global ProgressValueHolder, so I haven't published it to the public store. If anyone wants to take a look, I'd be happy to email it: it would be easy enough for you to substitute our dialog with your own. It would be good to get something like this working and available in VW, since it seems like functionality most non-trivial apps will need these days.
 
Cheers,
Steve
 
-----Original Message-----
From: Stewart MacLean [mailto:[hidden email]]
Sent: 15 February 2006 09:34
To: [hidden email]
Subject: refresh - from background processes?

Hi Bruce et al,

 

I’m not sure it’s the same problem but, coincidentally, I’m having problems updating the UI from a background process.

 

I want the background process to open a dialog. However I don’t want the dialog to block the background process.

 

So I tried uiEventFor: (not uiEventNowFor: ). As a result I seem to be running into similar problems with the dialog processing events from subsequent background events. (the events are being processed by the dialog, as it’s a child window of the argument window of uiEventFor:).

 

I’m wondering if there’s an accepted pattern for updating the UI from a background process, without blocking the background process?

 

(I’m thinking of using a buffer and then using uiEventNowFor: later to avoid the problem…)

 

Cheers,

 

Stewart

 

 

Reply | Threaded
Open this post in threaded view
|

Re: refresh - from background processes?

Mark Pirogovsky-3
Hello All,
It could be unrelated  to the discussion but...

I am using a variant (subclass) of the class Notice when I have to show
some progress for the long process and be able handle the user input on
the notice window, for example I have a <Cancel> . The  Notice, when it
open grabs the user input just like the Dialog. The only  other  thing I
have to do is to sprinkle a lot of things like

MessageNotification raiseSignal: 'a message ', count printString.
ResetIncrementNotification signalWith: count.


Though out the code of the long running process .

I hope it helps,
If anybody interested to see it, I can post the code somewhere.

--Mark



Steven Kelly wrote:

>
> Using a dialog is also the way we ended up going. What we wanted was a
> progress window with a gauge and a little transcript. The progress
> window would be opened for long blocks, and while it was open the UI of
> other windows should repaint if obscured, but not accept any input (nor
> should they buffer the input and execute it at the end). The long block
> should be able to open other windows, e.g. dialogs, which would accept
> input. I've spent probably a couple of weeks in total on this problem,
> and it's been rather frustrating (I can see why Bruce ended up with
> method names like # openTheDialogNowDamnit!).
>  
> I got things working about 98% with a normal window, but there were
> still occasional problems like events being leaked in certain cases
> (various XP look widgets do horrid stuff with responding to mouse over,
> for instance, and sometimes dialogs opened during the long block would
> have their buttons invisible, or not respond to input). I also made it
> possible that a window could choose to be refreshed from a cached bitmap
> of its contents, rather than the normal redraw (e.g. if the long block
> was changing the model objects the window needed to display itself). The
> results are published as RefreshingDisplayPolicy 1.3.1 in the public Store.
>  
> Next I tried making the progress window a dialog, and that helped - now
> Windows handled a lot of the issues, and we were just left handling the
> VW problems while opening and closing the progress dialog, and while
> opening dialogs during the long block. The main changes were to
> WindowManager>>addEvent: (to not add unwanted input events to the queue)
> and ApplicationDialogController>>eventLoop (to process the next
> non-input event and remove it from the queue, whilst leaving the rest of
> the queue unchanged). There's also a bug correction for
> TextCollectorView>>update:, which leaks events, and WinXPTriggerButton,
> which UHEs when trying to process old ExitEvents.
>  
> The code for the dialog version references our progress dialog and
> global ProgressValueHolder, so I haven't published it to the public
> store. If anyone wants to take a look, I'd be happy to email it: it
> would be easy enough for you to substitute our dialog with your own. It
> would be good to get something like this working and available in VW,
> since it seems like functionality most non-trivial apps will need these
> days.
>  
> Cheers,
> Steve
>  
>
>     -----Original Message-----
>     From: Stewart MacLean [mailto:[hidden email]]
>     Sent: 15 February 2006 09:34
>     To: [hidden email]
>     Subject: refresh - from background processes?
>
>     Hi Bruce et al,
>
>      
>
>     I’m not sure it’s the same problem but, coincidentally, I’m having
>     problems updating the UI from a background process.
>
>      
>
>     I want the background process to open a dialog. However I don’t want
>     the dialog to block the background process.
>
>      
>
>     So I tried uiEventFor: (not uiEventNowFor: ). As a result I seem to
>     be running into similar problems with the dialog processing events
>     from subsequent background events. (the events are being processed
>     by the dialog, as it’s a child window of the argument window of
>     uiEventFor:).
>
>      
>
>     I’m wondering if there’s an accepted pattern for updating the UI
>     from a background process, without blocking the background process?
>
>      
>
>     (I’m thinking of using a buffer and then using uiEventNowFor: later
>     to avoid the problem…)
>
>      
>
>     Cheers,
>
>      
>
>     Stewart
>
>      
>
>      
>