pharo-open-documentation / pharo-wiki

Wiki related to the Pharo programming language and environment.
https://twitter.com/PharoOpen
Creative Commons Attribution 4.0 International
247 stars 76 forks source link

How to deploy a Pharo application - out of date #329

Open StewMacLean opened 2 years ago

StewMacLean commented 2 years ago

In Pharo 10 I can't find the method to open a morph/presenter in full screen mode to ensure the user cannot access content behind it:

MyPresenter new openWorldWithSpec.

The guide makes not references to versions later than 7.

In spite of this, it is a very good starting point - thanks!

Update:

In Pharo 10 and later you can use:

MyPresenter asWorldWindow open.

Other points:

  1. To set you application to run implement startUp: on your class and execute before saving the deployment image:

SessionManager default registerUserClassNamed: 'MyApp'. Smalltalk snapshot: true andQuit: true

Your startUp: may need to fork a process to allow the UI to be installed first. e.g. MyApp>>startUp: isImageStarting

isImageStarting ifTrue: [[self startUpRuntime] fork]

  1. To smooth the display on opening hide the OS window before saving the deployment image:

self currentWorld worldState worldRenderer window hide.
OSWindowAttributes defaultVisible: false. "Otherwise opens shown - Note: you'll need to implement this method"
0.2 seconds wait. "Needs time to set before saving image." Smalltalk snapshot: true andQuit: true

In the start up of your app show the OS Window:

self currentWorld worldState worldRenderer window show.

  1. For some reason the regular mechanism for invalidating the window doesn't always work for a SpWorldPresenter. In particular, window refresh doesn't occur when resizing, until the mouse re enters the window. To replicate, drag the window to the right, being careful not to enter the window with the mouse. Once the mouse enters the window it refreshes to reflect the new size. Furthermore none of these seem to work:

A workaround is to append the following to the end of checkForNewScreenSize:

[self currentWorld simulateMiddleClick] fork

Happy runtime!

Bajger commented 1 year ago

Section about setting window title is outdated as well: Section with: https://github.com/pharo-open-documentation/pharo-wiki/blob/master/General/DeployYourPharoApplication.md#change-the-logo-and-window-title-of-the-application should be update with: World worldState worldRenderer windowTitle: 'My Application Icon setup: World worldState worldRenderer icon: anIcon. TODO: How to instantiate Icon from file.