[Cuis-dev] Instance of current world
Juan Vuletich
juan at jvuletich.org
Mon Nov 23 12:12:46 PST 2020
On 11/22/2020 12:46 PM, ken.dickey--- via Cuis-dev wrote:
> On 2020-11-22 00:56, Hilaire Fernandes via Cuis-dev wrote:
>
>> Is there a safe way to access the displayed world, beside "WorldMorph
>> allInstances first" of course?
>
> Object runningWorld
>
Doing `self runningWorld` will give you the current world for any object
(you can even do `7 runningWorld`), as long as run from the Morphic
process. This would work OK even if there were many active world at once.
The other way to do it is `UISupervisor ui`. UI is a small class that
handles the creation of Morphic world if needed, and could be expanded
to handle MVC or other alternative UIs. When asked #ui it will answer
the main object of whateve UI is active at the time. This can be called
from any process.
Cheers,
--
Juan Vuletich
www.cuis-smalltalk.org
https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev
https://github.com/jvuletich
https://www.linkedin.com/in/juan-vuletich-75611b3
@JuanVuletich
More information about the Cuis-dev
mailing list