[Pharo-project] Desktop application with Pharo

laurent laffont laurent.laffont at gmail.com
Sat Apr 16 11:55:10 CEST 2011


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 at 0 corner: 1 at 0.5)).
panel
 addMorph: (UITheme builder newButtonFor: counter action: #increment label:
'+' help: nil)
fullFrame:   (LayoutFrame fractions: (0 at 0.5 corner: 0.5 at 1)).
 panel
addMorph: (UITheme builder newButtonFor: counter action: #decrement label:
'-' help: nil)
 fullFrame:   (LayoutFrame fractions: (0.5 at 0.5 corner: 1 at 1)).

World submorphs do: [:aMorph| aMorph delete].

World
layoutPolicy: ProportionalLayout new;
addMorph: panel fullFrame:  (LayoutFrame fractions: (0 at 0 corner: 1 at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gforge.inria.fr/pipermail/pharo-project/attachments/20110416/435f9680/attachment.htm>


More information about the Pharo-project mailing list