GTPlayground status: open or close

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

GTPlayground status: open or close

Federico.Balaguer
Hello,

BotArena is a tool for teaching objects that we are using in my University. The tool allow students to enter Smalltalk expressions using an instance of GTPlayground.

There is a "reset" scenario where BotArena needs to know if there is a Playground open so it does refresh bindings to given objects.

So how can someone check whether a Playground is open or closed?

Thanks! Federico
 
Reply | Threaded
Open this post in threaded view
|

Re: GTPlayground status: open or close

Andrei Chis
Hi Frederico,

Do you want to verify that a particular instance of GTPlayground is opened or if there is just any GTPlayground opened in the current image?

For the first case a playground knows it's window. So you can check if there is a window and the window is in the world:

aPlayground window 
ifNotNil: [ :aWindow | aWindow isInWorld ] 
ifNil: [ false ] 

For the second case something like the following script should work:

(World submorphs select: [ :aMorph | aMorph isSystemWindow ])
detect: [ :aWindow | aWindow model class = GTPlayground ]
ifFound: [ true ]
ifNone: [ false ]


Cheers,
Andrei

On Tue, Aug 30, 2016 at 8:51 PM, Federico.Balaguer <[hidden email]> wrote:
Hello,

BotArena is a tool for teaching objects that we are using in my University.
The tool allow students to enter Smalltalk expressions using an instance of
GTPlayground.

There is a "reset" scenario where BotArena needs to know if there is a
Playground open so it does refresh bindings to given objects.

So how can someone check whether a Playground is open or closed?

Thanks! Federico




--
View this message in context: http://forum.world.st/GTPlayground-status-open-or-close-tp4913257.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.


Reply | Threaded
Open this post in threaded view
|

Re: GTPlayground status: open or close

Federico.Balaguer
Hello Andrei,

Thanks for your kind reply. What I needed was close to your first example code.

Thanks a lot! Federico