GraphicsMedium.st
branchjv
changeset 7715 925b859e1758
parent 7575 151c445c946c
parent 7671 465f33f58b2e
child 7723 620e91f9b082
--- a/GraphicsMedium.st	Fri Nov 18 20:50:35 2016 +0000
+++ b/GraphicsMedium.st	Fri Nov 18 21:26:33 2016 +0000
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 1989 by Claus Gittinger
 	      All Rights Reserved
@@ -39,16 +41,16 @@
 documentation
 "
     this is an abstract superclass for all kinds of drawables which
-    have a physical representation (i.e. have an extent). Dont use messages
-    from here - it will vanish soon.
+    have a physical representation (i.e. have an extent). 
+    Don't use messages from here - it will vanish soon.
 
     [Instance variables:]
 
-	width           <SmallInteger>  the width (device dependent, usually pixels or inches)
-	height          <SmallInteger>  the height (device dependent, usually pixels or inches)
+        width           <SmallInteger>  the width (device dependent, usually pixels or inches)
+        height          <SmallInteger>  the height (device dependent, usually pixels or inches)
 
     [author:]
-	Claus Gittinger
+        Claus Gittinger
 "
 ! !
 
@@ -62,7 +64,16 @@
 "
     'Warning: DeviceGraphicsContext (' print. self name print. ') should not be created with new' printNL.
 "
-    ^ self onDevice:Screen current.
+    |device|
+
+    device := Screen current.
+    device isNil ifTrue:[
+        "/ there seems to be no current screen; open one.
+        Smalltalk openDisplay.
+        device := Screen current.
+    ].
+    
+    ^ self onDevice:device.
 !
 
 on:aDevice