How to do a blocking, in-line refresh of shell in RAP [message #1001395] |
Wed, 16 January 2013 16:22 |
|
In a situation where I have a long-running piece of logic, but would like to refresh aspects of a Shell to indicate progress somehow, is there a simple way to do this in RAP (without separate threads) which will block until the refresh of the display is complete?
In SWT I can simply do this:
...
myShell.redraw();
myShell.update();
...
This works great, but in RAP it has no effect. Is there an easy way to achieve the same thing in RAP?
Thanks, John
---
Just because you can doesn't mean you should
|
|
|
|
Re: How to do a blocking, in-line refresh of shell in RAP [message #1001777 is a reply to message #1001532] |
Thu, 17 January 2013 11:01 |
|
Hi Chris,
Thanks for the reply.
Yes, I agree, that in principle the UI thread should never block, and designing any new application this should be adhered to.
My problem is that I'm writing a runtime intended to support a wide range of existing Windows/GUI applications (automatic transformation to RAP), which I do not wish to enforce my customers to recode this behaviour just to get it running the same under RAP. The most common example would be a progress indicator or some sort showing percentage complete, or similar.
Therefore, I'd like to be able to achieve an 'in-line' (in UI thread) 'refresh' of the display part-way through my logic. Yes, I understand the implications, that no user input event handling will be possible throughout the long-running process, but that's accepted in the design of these apps in the first place.
So, with that in mind... 'is' there a way to achieve a refresh within the UI thread?
(sorry, not meaning to be dog-brained about it - just trying to make transition for my customers as easy as possible).
Is RAP's new 'ServerPush' of any use here perhaps? (I haven't looked into this yet, so could be totally the wrong tree for my dog to bark up!)
Thanks, John
---
Just because you can doesn't mean you should
[Updated on: Thu, 17 January 2013 14:07] Report message to a moderator
|
|
|
|
|
|
Re: How to do a blocking, in-line refresh of shell in RAP [message #1004106 is a reply to message #1003690] |
Tue, 22 January 2013 15:29 |
|
Hi Chris,
No, I'm not using jface or workbench.
However, I have recoded my event mechanism and pretty much got it working the way I need it to now.
My only outstanding issue is that I need to block any user interaction with the RAP windows/controls while my long running background thread is still going. I can do this successfully one of 2 ways so far, but they cause undesired effects...
Solution1) before kicking off the background thread I do a shell.setEnabled(false) on all the open shells, then shell.setEnabled(true) when the background thread finishes
Solution2) alternative is to create a new 'busy' shell (perhaps could contain a small animated graphic) which has SWT.APPLICATION_MODAL defined, then remove the shell when the background thread is done
Both techniques have the same issue in that all the other shells gain a 'disabled' look in RAP i.e. grey, pale colours etc. Functionally this works very well, but causes an unpleasant flashing when you are navigating around the application. I'd like the other shells' appearance to remain 'normal' during that period but still stop them from accepting any kind of user input... a bit like the 'hourglass' mouse cursor you get in Windows which indicates the application is busy, but the appearance of the windows remains the same.
Hope that makes some sense?
The above techniques work ok in SWT, since the shells don't get the 'greyed' appeared when disabled.
Ideally what I need would be to have a mechanism that stops/ignores all user input, until I tell it to accept it again... is that possible in RAP?
Thanks for your thoughts and time on this, by the way, it is most appreciated!
John
---
Just because you can doesn't mean you should
|
|
|
|
|
Re: How to do a blocking, in-line refresh of shell in RAP [message #1005035 is a reply to message #1004505] |
Thu, 24 January 2013 11:07 |
|
Just for completeness, here is the section of my CSS that sorts this out:
Shell-DisplayOverlay {
background-image: none;
background-color: #FFFFFF;
opacity: 0.01;
}
Note that you cannot set opacity to 0 as this causes some internal problem in RAP (presumably a divide by 0!), but I can live with that.
---
Just because you can doesn't mean you should
|
|
|
Powered by
FUDForum. Page generated in 0.03808 seconds