I'm searching for a way to create desktop applications with Pharo (no
multiple window).
Here's the current snippet that do what I want. Improvements / better code
is really really welcome.
How I can change the title of the window ?
The snippet to evaluate in Workspace:
counter := Class new
superclass: Object;
addInstVarNamed: 'counter';
compile: 'initialize
counter := 0';
compile: 'counterString
^ counter asString';
compile: 'increment
counter := counter + 1.
self changed:#counterString';
compile: 'decrement
counter := counter - 1.
self changed:#counterString';
new.
panel := UITheme builder newPanel.
panel layoutPolicy: ProportionalLayout new.
panel
addMorph: (UITheme builder newLabelFor: counter getLabel: #counterString
getEnabled: nil)
fullFrame: (LayoutFrame fractions: (0@0 corner: [email protected])).
panel
addMorph: (UITheme builder newButtonFor: counter action: #increment label:
'+' help: nil)
fullFrame: (LayoutFrame fractions: ([email protected] corner: 0.5@1)).
panel
addMorph: (UITheme builder newButtonFor: counter action: #decrement label:
'-' help: nil)
fullFrame: (LayoutFrame fractions: ([email protected] corner: 1@1)).
World submorphs do: [:aMorph| aMorph delete].
World
layoutPolicy: ProportionalLayout new;
addMorph: panel fullFrame: (LayoutFrame fractions: (0@0 corner: 1@1)).
Laurent Laffont - @lolgzs <http://twitter.com/#!/lolgzs>
Pharo Smalltalk Screencasts: http://www.pharocasts.com/
Blog: http://magaloma.blogspot.com/
Developer group: http://cara74.seasidehosting.st