Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
Open a Workspace with content
Last updated at 9:47 am UTC on 30 October 2018
To programmatically open a workspace with some text already in it, execute this Squeak code:

StringHolder 
  new textContents: ('Hello  World!! This is a test.') 
  withSqueakLineEndings; 
  openLabel: 'Workspace test'




 | st ws |
 st := WriteStream  on: String new.
 
 0 to: 30 do: [:i | st nextPutAll: (Date today addDays: i) printString.
	             st nextPutAll: ': '.
	             st cr].

 ws := Workspace new.
 ws contents: st contents.
 ws openLabel: 'Next 31 days'.

Workspace_with_next_31_days.png

To include the weekday
 | st ws |
 st := WriteStream  on: String new.
 
 0 to: 30 do: [:i | | d |
 	                      d := Date today addDays: i.
 	                      st nextPutAll: d dayOfWeekName.
 	                      st nextPutAll: ', '.
 	                      st nextPutAll: d printString.
 	                      st nextPutAll: ': '.
 	                      st cr].
 
 ws := Workspace new.
 ws contents: st contents.
 ws openLabel: 'Next 31 days'.

Open a Workspace with text content

See also

List the content of all workspaces of all projects an image.