Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
How to color a systemWindow and its panes
Last updated at 2:54 pm UTC on 16 January 2006
Imagine you have a class that represents the logic of a tool and you want this tool to have a system-like color scheme.

The trick is to send the message setWindowColor: after having set up an instance of your tool as model, as shown in the method createSystemWindow.

(Note: ">>" is used like this: "[sub]classname" >> "methodname in that [sub]class")

Model subclass: MyTool

MyTool>>createSystemWindow

| window |
window := (SystemWindow labelled: self windowLabelString).
window model: self.
window setWindowColor: Color blue.
^ window

MyTool>>createView

view := self createSystemWindow.
view addMorph: self createCategoryPane
frame: (0.0@0 extent: 0.5@0.2).
view addMorph: self createMethodPane
frame: (0.5@0 extent: 0.5@0.2).
view addMorph: self createCodePane
frame: (0.0@0.20 extent: 1@0.80).
^ view

MyTool>>createMethodPane

^ PluggableListMorph
on: self
list: #listOfMethods
selected: #selectedMethodIndex
changeSelected: #selectedMethodIndex:
menu: #methodMenu:
keystroke: #arrowKey:from:.