Logo-small

3.7.1.1 CreateWindow

Our application will be a Painter class, inherited from the Object class. We will have accessors to instantiate the different parts of our application:

  • window
  • menu
  • toolbar
  • statusbar

To create a simple window, we use the StandardWindow class.

window := StandardWindow labelled: 'Painter'.
window openInWorld.

System window

You can add widgets using addMorph:. Let's add a ColorChooserMorph:

window := StandardWindow labelled: 'Painter'.

chooser := ColorChooserMorph new.
window addMorph: chooser.

window openInWorld.

ColorChooserMorph on SystemWindow

As you see, you can click on the ColorChooserMorph button to open tho color wheel dialog. But the button is displayed on the title bar, not positioned. In the following section, we explain how to layout morphs into morph.

User Contributed Notes

boloomka (12 January 2012, 2:21 am)

But I thing that it's it. If you click that blue section, "Choose Color" dialog pops up.

mrbillrodgers (22 October 2011, 9:04 am)

This doesn't work with Pharo 1.3 on Windows 7 or on Mac OS X v10.6.8.

 

Copy the code into a workspace and execute it produces only the window with the blue section in the top left. I fiddled with the enable: message and this did not change the result.

Add a Note

Licensed under Creative Commons BY-NC-SA | Published using Pier |