Disable Window?

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

Disable Window?

Steffen Märcker
Hi,

is there a preferably easy way to disable (and enable again) all of a  
windows controls/widgets? I want to disable a window during some  
computation in order to prevent any user input in that window.

Regards, Steffen
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: Disable Window?

Dave Stevenson-3
I've created an InactiveController that doesn't respond to any events and manually assigned it to all widgets in a window at postBuild to create a read-only version of some editor. It makes the widgets inoperable without giving them a disabled look.

However, you're asking about doing this temporarily, not for the life of the window.

I would suggest you ensure that when you create the window, ensure you are using MakeNewWindowManagerUsagePolicy instead of UseParentWindowManagerUsagePolicy. Then maybe you can do something at the window manager level without affecting other windows. I use this code:

SomeApp>>openAnotherApp
    self newWindowManagerWhile: [AnotherApp open]

ApplicationModel>>newWindowManagerWhile: aBlock
    self setWindowManagerPolicy: MakeNewWindowManagerUsagePolicy while: aBlock

ApplicationModel>>setWindowManagerPolicy: aWindowManagerUsagePolicySubclass while: aBlock
    | process oldPolicy |
    process := Processor activeProcess.
    oldPolicy := process environmentAt: #WindowManagerUsagePolicy.
    [process
        environmentAt: #WindowManagerUsagePolicy
        put: aWindowManagerUsagePolicySubclass new.
    aBlock value]
        ensure: [process environmentAt: #WindowManagerUsagePolicy put: oldPolicy]
 
Dave Stevenson
[hidden email]



From: Steffen Märcker <[hidden email]>
To: vwnc <[hidden email]>
Sent: Fri, June 17, 2011 7:56:22 AM
Subject: [vwnc] Disable Window?

Hi,

is there a preferably easy way to disable (and enable again) all of a 
windows controls/widgets? I want to disable a window during some 
computation in order to prevent any user input in that window.

Regards, Steffen
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: Disable Window?

Ladislav Lenart
Hello.

Just one remark. If SomeApp works on the same domain model
as other windows, all of them should be managed by the same
WindowManager instance. Otherwise you effectively allow end
users to modify your domain model from several UI processes
(one per a WindowManager) at the same time (=> race condition).

Also, if you wish to use different WindowManagerPolicy for a
particular window, the following works quite well (in VW 7.7
at least):

     [SomeApp open]
         on: GetWindowManagerUsagePolicy
         do: [:ex | ex resume: MakeNewWindowManagerUsagePolicy new].


Ladislav Lenart


On 17.6.2011 15:55, Dave Stevenson wrote:

> I've created an InactiveController that doesn't respond to any events and manually assigned it to all widgets in a window at postBuild to create a read-only version of some editor. It makes the
> widgets inoperable without giving them a disabled look.
>
> However, you're asking about doing this temporarily, not for the life of the window.
>
> I would suggest you ensure that when you create the window, ensure you are using MakeNewWindowManagerUsagePolicy instead of UseParentWindowManagerUsagePolicy. Then maybe you can do something at the
> window manager level without affecting other windows. I use this code:
>
> SomeApp>>openAnotherApp
> self newWindowManagerWhile: [AnotherApp open]
>
> ApplicationModel>>newWindowManagerWhile: aBlock
> self setWindowManagerPolicy: MakeNewWindowManagerUsagePolicy while: aBlock
>
> ApplicationModel>>setWindowManagerPolicy: aWindowManagerUsagePolicySubclass while: aBlock
> | process oldPolicy |
> process := Processor activeProcess.
> oldPolicy := process environmentAt: #WindowManagerUsagePolicy.
> [process
> environmentAt: #WindowManagerUsagePolicy
> put: aWindowManagerUsagePolicySubclass new.
> aBlock value]
> ensure: [process environmentAt: #WindowManagerUsagePolicy put: oldPolicy]
> Dave Stevenson
> [hidden email]
>
>
> --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> *From:* Steffen Märcker <[hidden email]>
> *To:* vwnc <[hidden email]>
> *Sent:* Fri, June 17, 2011 7:56:22 AM
> *Subject:* [vwnc] Disable Window?
>
> Hi,
>
> is there a preferably easy way to disable (and enable again) all of a
> windows controls/widgets? I want to disable a window during some
> computation in order to prevent any user input in that window.
>
> Regards, Steffen
> _______________________________________________
> vwnc mailing list
> [hidden email] <mailto:[hidden email]>
> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>
>
>
> _______________________________________________
> vwnc mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: Disable Window?

Terry Raymond
In reply to this post by Steffen Märcker
Steffen

Why not use a progress dialog? Instead of a progress bar
you can use some other animation. This also provides the
user with some feedback that things have not simply hung.

Terry
 
===========================================================
Terry Raymond
Crafted Smalltalk
80 Lazywood Ln.
Tiverton, RI  02878
(401) 624-4517      [hidden email]
<http://www.craftedsmalltalk.com>
===========================================================

> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]] On Behalf Of Steffen Märcker
> Sent: Friday, June 17, 2011 8:56 AM
> To: vwnc
> Subject: [vwnc] Disable Window?
>
> Hi,
>
> is there a preferably easy way to disable (and enable again) all of a
> windows controls/widgets? I want to disable a window during some
> computation in order to prevent any user input in that window.
>
> Regards, Steffen
> _______________________________________________
> vwnc mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc



_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: Disable Window?

Niall Ross
In reply to this post by Dave Stevenson-3
Dear Dave,
    trivial thoughts

1) Might

ApplicationModel>>setWindowManagerPolicy:
aWindowManagerUsagePolicySubclass while: aBlock
    ^Processor activeProcess scopeEnvironmentWhile:
        [:newProcessEnvironment |
       newProcessEnvironment
            environmentAt: #WindowManagerUsagePolicy
            put: aWindowManagerUsagePolicySubclass new.
            aBlock value]

be marginally less intrusive in cases where an environmentAt: call is
getting a default environment's value, the Process' environment being
nil.  Its environment will not be nil afterwards in either case, but
IIUC your code will allocate the default environment's value for
#WindowManagerUsagePolicy to its environment in such a case.  (But
arguably that makes no difference worth mentioning.)

2) Why do you not return the value of the block in your code?

3) I take it you wrote this code for cases where forking

    SomeApp>>openAnotherApp
        [AnotherApp open] fork.

is not convenient and you encounter such cases.  So should we provide
something these methods in the base?

             Yours faithfully
                   Niall Ross

>I've created an InactiveController that doesn't respond to any events and
>manually assigned it to all widgets in a window at postBuild to create a
>read-only version of some editor. It makes the widgets inoperable without giving
>them a disabled look.
>
>However, you're asking about doing this temporarily, not for the life of the
>window.
>
>I would suggest you ensure that when you create the window, ensure you are using
>MakeNewWindowManagerUsagePolicy instead of UseParentWindowManagerUsagePolicy.
>Then maybe you can do something at the window manager level without affecting
>other windows. I use this code:
>
>SomeApp>>openAnotherApp
>    self newWindowManagerWhile: [AnotherApp open]
>
>ApplicationModel>>newWindowManagerWhile: aBlock
>    self setWindowManagerPolicy: MakeNewWindowManagerUsagePolicy while: aBlock
>
>ApplicationModel>>setWindowManagerPolicy: aWindowManagerUsagePolicySubclass
>while: aBlock
>    | process oldPolicy |
>    process := Processor activeProcess.
>    oldPolicy := process environmentAt: #WindowManagerUsagePolicy.
>    [process
>        environmentAt: #WindowManagerUsagePolicy
>        put: aWindowManagerUsagePolicySubclass new.
>    aBlock value]
>        ensure: [process environmentAt: #WindowManagerUsagePolicy put:
>oldPolicy]
>
> Dave Stevenson
>[hidden email]
>
>
>
>
>________________________________
>From: Steffen Märcker <[hidden email]>
>To: vwnc <[hidden email]>
>Sent: Fri, June 17, 2011 7:56:22 AM
>Subject: [vwnc] Disable Window?
>
>Hi,
>
>is there a preferably easy way to disable (and enable again) all of a  
>windows controls/widgets? I want to disable a window during some  
>computation in order to prevent any user input in that window.
>
>Regards, Steffen
>_______________________________________________
>vwnc mailing list
>[hidden email]
>http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>
>  
>
>------------------------------------------------------------------------
>
>_______________________________________________
>vwnc mailing list
>[hidden email]
>http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>  
>


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc