Desktop application with Pharo

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Desktop application with Pharo

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

Pharo Smalltalk Screencasts: http://www.pharocasts.com/
Blog: http://magaloma.blogspot.com/
Reply | Threaded
Open this post in threaded view
|

Re: Desktop application with Pharo

Schwab,Wilhelm K
Laurent,

I don't know that what I have done is better than anything else; the basic idea is adapted (aka shamelessly stolen<g> from a wiki entry.  Below is the class comment from something that I have successfully deployed as a "desktop app" using Pharo.  Using StandardWindow (thanks again to Pinesoft!!), it can #openInWorld (as part of the IDE) or #openFullScreen (when deployed), can be dragged only by the title bar, etc.

Is there a way to get an image to save a copy of itself and its change log in another folder?  Suppose the image is happily running in

   /home/me/Pharo-1.1.1/Pharo-dev-nnnn.image,changes
   /home/me/Pharo-1.1.1/Pharo-dev-nnnn.image,changes

and the goal is to do the steps below in

   /home/Software/CoolGizmo/programName.image
   /home/Software/CoolGizmo/programName.changes

Can the running image do that and continue to run in the Pharo-1.1.1 directory as though nothing happened?  That might make it possible to take the bumps out of the deployment process.  

Bill




"To test in the IDE"
Equalize new asMorph openInWorld.


"To deploy - copy the image somewhere, and then do all of the following."
Preferences disable:#showWorldTaskbar.

10-09 - one-shot do-it to deploy Equalize; copy the image somewhere first!!"
Preferences disable:#showWorldTaskbar.
SystemWindow allSubInstances do:[ :each | each delete. ].


"Then do this as one do-it"
SmalltalkImage current snapshot: true andQuit: false.
Equalize new asMorph openFullscreen.


________________________________________
From: [hidden email] [[hidden email]] On Behalf Of laurent laffont [[hidden email]]
Sent: Saturday, April 16, 2011 5:55 AM
To: An open mailing list to discuss any topics related to an open-source Smalltalk
Subject: [Pharo-project] Desktop application with Pharo

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


Reply | Threaded
Open this post in threaded view
|

Re: Desktop application with Pharo

Helene Bilbo
In reply to this post by laurent laffont
laurent laffont wrote
I'm searching for a way to create desktop applications with Pharo (no
multiple window).
Hi. While i can't contribute anything, i just wanted to tell you that i'm very interested in this. Please continue posting your findings :)
Best regards, Helene.