Morphic and windows

Ned Konz ned at bike-nomad.com
Wed Jul 28 18:15:53 UTC 2004


On Wednesday 28 July 2004 6:53 am, Marcin Tustin wrote:

> 1) Is it possible to get morphic to create a window outside of the squeak 
window 

Probably not the way you want to do it. At least, not easily. And not out of 
the box.

That is: if you want multiple active Morphic windows at once, each displaying 
something different, it's going to take a bit of work (I think).

You can get *Squeak* to create such a window (via FFI or via a plugin like the 
XDisplayControlPlugin), and to *draw* things on it.

However, you (probably) won't be able to use it (normally) with Morphic. To be 
able to use any display surface with Morphic, you need:

* a Canvas for drawing: you can change the kind of Canvas that is used by the 
WorldState (this is how, for instance, Nebraska works; see MultiCanvas).

* a HandMorph for input events: by changing the kind of Hand (or adding a 
different kind) you can get input events from somewhere else. (again, this is 
used in Nebraska).

It is conceivable that you could set Morphic up to allow for multiple worlds, 
each with their own rectangular display surface (each one of which could be 
connected to a separate window if you wanted), but they wouldn't be able to 
interact very well.

If all you want is to use native windows as an output surface for drawing, or 
to make native windows that are populated with native widgets, this wouldn't 
be a Morphic world. Göran Krampe and others have made connections between 
Squeak and native UI widgets.

Though you could tell a Morph to draw itself on a Canvas associated with one 
of these display surfaces, it wouldn't be 'live' in that environment unless 
there were also a corresponding Hand there. This is like how we can draw a 
Morph on (say) a Postscript canvas.

Morphic *does* assume a single, large rectangular display surface per World, 
so unless you somehow were able to stick together multiple rectangular window 
areas and make them look like a single surface, these would have to be in 
separate Worlds.

Having separate Worlds is probably not that difficult. But it's not supported 
by the stock code (directly). Specifically, we don't have the kinds of 
Hand/Canvas combinations you probably would need.

I don't know that it would be all that hard to have a multi-surface World 
either, but you'd have to manage to merge the UI event stream for each of the 
UI-level windows together (supplying appropriate coordinate transformation), 
and probably have a special damage recorder that also knows about the 
separate areas.

There would also be the challenge of mapping OS-level/window system 
coordinates to Squeak coordinates, especially if you can move, resize, or 
overlap the individual windows.

Right now, the VMs (at least the Unix and Win32 VMs) have a single global 
called something like 'stWindow' that maintains their idea of the single 
active Squeak window (more or less). They would have to be extended to allow 
the use of multiple windows.

> 2) Is there a tutorial more recent 
> than the one on the squeak swiki, which instructs one to start using
> classes that no longer come with squeak?

There are a number of Morphic tutorials. Which one are you referring to, and 
would someone like to update it?

Thanks,
-- 
Ned Konz
http://bike-nomad.com




More information about the Squeak-dev mailing list