hide some menu items and cursor if readOnly
authorClaus Gittinger <cg@exept.de>
Tue, 28 Jul 1998 11:49:37 +0200
changeset 1616 92c7be73028f
parent 1615 7bb9ce880706
child 1617 9606db12cf1b
hide some menu items and cursor if readOnly
EditField.st
--- a/EditField.st	Mon Jul 27 20:19:03 1998 +0200
+++ b/EditField.st	Tue Jul 28 11:49:37 1998 +0200
@@ -1319,7 +1319,9 @@
     "make cursor visible if currently invisible - but only if this
      EditField is enabled"
 
-    enabled ifTrue:[super showCursor]
+    (enabled and:[readOnly ~~ true]) ifTrue:[super showCursor]
+
+    "Modified: / 28.7.1998 / 11:32:04 / cg"
 ! !
 
 !EditField methodsFor:'cursor movement'!
@@ -1691,19 +1693,24 @@
 
     |items m|
 
-    items := #(
+    readOnly == true ifTrue:[
+        items := #(
                 ('copy'   copySelection  Copy  )
-                ('cut'    cut            Cut   )
-                ('paste'  pasteOrReplace Paste )
-               ).
-
-    (acceptAction notNil 
-    or:[model notNil and:[changeMsg notNil]]) ifTrue:[
-        immediateAccept ifFalse:[
-            items := items , #(
-                                    ('-'                     )
-                                    ('accept'  accept  Accept)
-                                ).
+                )
+    ] ifFalse:[
+        items := #(
+                    ('copy'   copySelection  Copy  )
+                    ('cut'    cut            Cut   )
+                    ('paste'  pasteOrReplace Paste )
+                   ).
+        (acceptAction notNil 
+        or:[model notNil and:[changeMsg notNil]]) ifTrue:[
+            immediateAccept ifFalse:[
+                items := items , #(
+                                        ('-'                     )
+                                        ('accept'  accept  Accept)
+                                    ).
+            ].
         ].
     ].
 
@@ -1712,13 +1719,13 @@
     self hasSelection ifFalse:[
         m disableAll:#(copySelection cut)
     ].
-    enabled ifFalse:[
-        m disableAll:#(cut paste accept)
+    (enabled not or:[readOnly == true]) ifTrue:[
+        m disableAll:#(cut pasteOrReplace accept)
     ].
 
     ^ m
 
-    "Modified: / 21.5.1998 / 15:57:09 / cg"
+    "Modified: / 28.7.1998 / 11:35:41 / cg"
 !
 
 initStyle
@@ -1976,5 +1983,5 @@
 !EditField class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/EditField.st,v 1.109 1998-07-27 08:00:38 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/EditField.st,v 1.110 1998-07-28 09:49:37 cg Exp $'
 ! !