EnterBox2.st
changeset 197 00927189c882
parent 174 d80a6cc3f9b2
child 355 a55f62047156
--- a/EnterBox2.st	Thu Nov 23 02:43:52 1995 +0100
+++ b/EnterBox2.st	Thu Nov 23 03:26:58 1995 +0100
@@ -11,12 +11,25 @@
 "
 
 EnterBox subclass:#EnterBox2
-       instanceVariableNames:'okButton2 okAction2'
-       classVariableNames:''
-       poolDictionaries:''
-       category:'Views-DialogBoxes'
+	 instanceVariableNames:'okButton2 okAction2'
+	 classVariableNames:''
+	 poolDictionaries:''
+	 category:'Views-DialogBoxes'
 !
 
+!EnterBox2 class methodsFor:'instance creation'!
+
+title:titleString okText1:text1 okText2:text2 abortText:abortText
+		  action1:block1 action2:block2
+    "create and return a new EnterBox-with-2 buttons
+     and define its text, button-labels and actions"
+
+    ^ (super title:titleString 
+	    okText:text1 
+	 abortText:abortText
+	    action:block1) okText2:text2 action2:block2
+! !
+
 !EnterBox2 class methodsFor:'documentation '!
 
 copyright
@@ -33,10 +46,6 @@
 "
 !
 
-version
-    ^ '$Header: /cvs/stx/stx/libwidg/EnterBox2.st,v 1.12 1995-11-11 16:20:13 cg Exp $'
-!
-
 documentation
 "
     An EnterBox2 is like an EnterBox but with 2 action buttons.
@@ -45,23 +54,45 @@
     The protocol is like that of EnterBox, the additional buttons label
     can be set with 'okText2:aString' and its action with 'action2:aBlock'.
 "
+!
+
+version
+    ^ '$Header: /cvs/stx/stx/libwidg/EnterBox2.st,v 1.13 1995-11-23 02:25:05 cg Exp $'
 ! !
 
-!EnterBox2 class methodsFor:'instance creation'!
+!EnterBox2 methodsFor:'accessing'!
+
+action2:aBlock
+    "set the action to be performed when user presses the 2nd ok-button;
+     aBlock must be nil or a block with one argument "
+
+    okAction2 := aBlock
+!
+
+okText2:aString
+    "set the text to be displayed in the 2nd ok-button"
 
-title:titleString okText1:text1 okText2:text2 abortText:abortText
-		  action1:block1 action2:block2
-    "create and return a new EnterBox-with-2 buttons
-     and define its text, button-labels and actions"
+    aString ~= okButton2 label ifTrue:[
+	okButton2 label:aString.
+	okButton2 resize.
+	shown ifTrue:[self resize]
+    ]
+!
 
-    ^ (super title:titleString 
-	    okText:text1 
-	 abortText:abortText
-	    action:block1) okText2:text2 action2:block2
+okText2:aString action2:aBlock
+    "set the text to be displayed in the 2nd ok-button,
+     and its action"
+
+    self okText2:aString.
+    okAction2 := aBlock
 ! !
 
 !EnterBox2 methodsFor:'initialization'!
 
+focusSequence
+    ^ Array with:enterField with:abortButton with:okButton with:okButton2 
+!
+
 initialize
     super initialize.
 
@@ -77,10 +108,6 @@
     okButton isReturnButton:false.
 
     enterField leaveAction:[:key | self ok2Pressed]
-!
-
-focusSequence
-    ^ Array with:enterField with:abortButton with:okButton with:okButton2 
 ! !
 
 !EnterBox2 methodsFor:'realization'!
@@ -94,42 +121,8 @@
     ^ (okButton2 originRelativeTo:self) + (okButton2 extent // 2)
 ! !
 
-!EnterBox2 methodsFor:'accessing'!
-
-okText2:aString action2:aBlock
-    "set the text to be displayed in the 2nd ok-button,
-     and its action"
-
-    self okText2:aString.
-    okAction2 := aBlock
-!
-
-okText2:aString
-    "set the text to be displayed in the 2nd ok-button"
-
-    aString ~= okButton2 label ifTrue:[
-	okButton2 label:aString.
-	okButton2 resize.
-	shown ifTrue:[self resize]
-    ]
-!
-
-action2:aBlock
-    "set the action to be performed when user presses the 2nd ok-button;
-     aBlock must be nil or a block with one argument "
-
-    okAction2 := aBlock
-! !
-
 !EnterBox2 methodsFor:'user interaction'!
 
-ok2Pressed
-    "user pressed 2nd ok button - evaluate action"
-
-    okButton2 turnOffWithoutRedraw.
-    self hideAndEvaluate:okAction2
-!
-
 keyPress:aKey x:x y:y
     "return-key dublicates ok-function if acceptReturnAsOK is true"
 
@@ -137,4 +130,12 @@
 	(aKey == #Return) ifTrue:[^ self ok2Pressed]
     ].
     super keyPress:aKey x:x y:y
+!
+
+ok2Pressed
+    "user pressed 2nd ok button - evaluate action"
+
+    okButton2 turnOffWithoutRedraw.
+    self hideAndEvaluate:okAction2
 ! !
+