ExtendedComboBox.st
changeset 2462 8eaa99008134
parent 2461 208fed751e87
child 2463 b20596470048
--- a/ExtendedComboBox.st	Thu Mar 20 11:08:56 2003 +0100
+++ b/ExtendedComboBox.st	Thu Mar 20 11:10:32 2003 +0100
@@ -642,6 +642,26 @@
     ^ menuButton enabled
 
 
+!
+
+readOnly
+    "returns true if the menuField is readonly, a label
+    "
+    ^ isReadOnly
+!
+
+readOnly:aBoolean
+    "set the menuField to readonly or writable
+    "
+    isReadOnly == aBoolean ifTrue:[ ^ self ].
+
+    isReadOnly := aBoolean.
+
+    menuField isNil ifTrue:[
+        self createEditField.
+    ].
+
+    menuField readOnly:aBoolean.
 ! !
 
 !ExtendedComboBox methodsFor:'accessing-channels'!
@@ -872,57 +892,6 @@
     "
     menuField foregroundColor:aColor
 
-!
-
-readOnly
-    "returns true if the menuField is readonly, a label
-    "
-    ^ isReadOnly
-!
-
-readOnly:aBoolean
-    "set the menuField to readonly or writable
-    "
-    | nm|
-
-    isReadOnly == aBoolean ifTrue:[ ^ self ].
-    isReadOnly := aBoolean.
-
-"/    aState ifTrue:[
-"/        newField := Label in:self.
-"/        newField level:-1.
-"/        newField adjust:#left.
-"/        newField labelMessage:#value.
-"/    ] ifFalse:[
-"/        newField := EditField in:self
-"/    ].
-    menuField isNil ifTrue:[
-        menuField := EditField in:self.
-
-        menuField origin:0.0 @ 0.0 corner:1.0 @ 1.0.
-
-        styleSheet is3D ifTrue:[
-            (styleSheet at:'comboViewLevel' default:nil) notNil ifTrue:[
-                menuField level:0.
-            ] ifFalse:[
-                menuField leftInset:(ViewSpacing // 2).
-            ]
-        ].
-        nm := styleSheet name.
-        (nm = #win95 or:[nm = #win98 or:[nm = #st80]]) ifTrue:[
-            menuField level:0.
-            menuField leftInset:0.
-        ].
-        menuField rightInset:(menuButton leftInset negated).
-
-        menuField menuHolder:(self menuHolder).
-
-        menuField model:model.
-        menuField  font:font.
-        self shown ifTrue:[ menuField realize ].
-    ].
-
-    menuField readOnly:aBoolean.
 ! !
 
 !ExtendedComboBox methodsFor:'accessing-scrollbars'!
@@ -1056,6 +1025,34 @@
 
 !ExtendedComboBox methodsFor:'initialization'!
 
+createEditField
+    | nm|
+
+    menuField := EditField in:self.
+
+    menuField origin:0.0 @ 0.0 corner:1.0 @ 1.0.
+
+    styleSheet is3D ifTrue:[
+        (styleSheet at:'comboViewLevel' default:nil) notNil ifTrue:[
+            menuField level:0.
+        ] ifFalse:[
+            menuField leftInset:(ViewSpacing // 2).
+        ]
+    ].
+    nm := styleSheet name.
+    (nm = #win95 or:[nm = #win98 or:[nm = #st80]]) ifTrue:[
+        menuField level:0.
+        menuField leftInset:0.
+    ].
+    menuField rightInset:(menuButton leftInset negated).
+
+    menuField menuHolder:(self menuHolder).
+
+    menuField model:model.
+    menuField  font:font.
+    self shown ifTrue:[ menuField realize ].
+!
+
 initialize
     "setup defaults
     "
@@ -1500,5 +1497,5 @@
 !ExtendedComboBox class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/ExtendedComboBox.st,v 1.37 2003-03-20 10:08:56 tm Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/ExtendedComboBox.st,v 1.38 2003-03-20 10:10:32 tm Exp $'
 ! !