DialogBox.st
changeset 5011 a8c0c89fadca
parent 4887 8799bcbe7ecb
child 5017 3e5feb8b83da
--- a/DialogBox.st	Wed Apr 30 15:57:55 2014 +0200
+++ b/DialogBox.st	Thu May 01 00:36:23 2014 +0200
@@ -1192,14 +1192,7 @@
 information:aString
     "launch a Dialog to tell user something"
 
-    |currentScreen|
-
-    ((currentScreen := Screen current) notNil and:[currentScreen nativeDialogs]) ifTrue:[
-        ^ currentScreen 
-            nativeInformationOK:aString
-            title:aString
-    ].
-    self showAndThenDestroyBox:(InfoBox title:aString)
+    self information:aString title:aString
 
     "
      Dialog information:'help'
@@ -1227,6 +1220,53 @@
     "Created: / 22-12-2010 / 19:33:23 / cg"
 !
 
+informationText:aString title:windowTitle
+    "launch a Dialog to tell user something.
+     The argument aString is shown as multiline, scrollable text"
+
+    |dialog textHolder|
+
+    textHolder := ValueHolder new.
+    dialog := Dialog 
+                forRequestText:'' editViewClass:TextView
+                lines:15 columns:60 
+                initialAnswer:aString initialSelection:nil 
+                model:textHolder.
+    dialog window label:windowTitle.
+    dialog open.
+
+    "
+     Dialog 
+        informationText:(DialogBox class compiledMethodAt:#information:title:) source
+        title:'Hello'
+    "
+!
+
+informationText:aString title:title windowTitle:windowTitle
+    "launch a Dialog to tell user something.
+     The argument aString is shown as multiline, scrollable text"
+
+    |dialog textHolder|
+
+    textHolder := ValueHolder new.
+    dialog := Dialog 
+                forRequestText:title editViewClass:TextView
+                lines:15 columns:60 
+                initialAnswer:aString initialSelection:nil 
+                model:textHolder.
+    dialog removeAbortButton.
+    dialog okButton beReturnButton.
+    dialog window label:windowTitle.
+    dialog open.
+
+    "
+     Dialog 
+        informationText:(DialogBox class compiledMethodAt:#information:title:) source
+        title:'Hello - the text is:'
+        windowTitle:'Hello'
+    "
+!
+
 warn:aString
     "launch a Dialog to warn user"
 
@@ -3443,9 +3483,12 @@
                 initialText notEmptyOrNil ifTrue:[
                     textModel value:initialText
                 ].
-                textView scrolledView
-                    model:textModel;
-                    acceptChannel:(dialog acceptChannel).
+                textView scrolledView model:textModel.
+                textView scrolledView 
+                    perform:#acceptChannel: 
+                    with:(dialog acceptChannel)
+                    ifNotUnderstood:[].
+
                 anIntervalOrNil notNil ifTrue:[
                     textView scrolledView selectFromCharacterPosition:anIntervalOrNil start to:anIntervalOrNil stop.
                 ].
@@ -7923,6 +7966,20 @@
     "
 
     "Modified: 9.2.1996 / 21:39:34 / cg"
+!
+
+removeAbortButton 
+    "remove an already added okButton - only useful to change some already created
+     dialog afterwards"
+
+    abortButton destroy
+!
+
+removeOkButton 
+    "remove an already added okButton - only useful to change some already created
+     dialog afterwards"
+
+    okButton destroy
 ! !
 
 !DialogBox methodsFor:'construction-check & comboboxes'!
@@ -10067,11 +10124,11 @@
 !DialogBox class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/DialogBox.st,v 1.352 2014-02-13 18:33:34 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/DialogBox.st,v 1.353 2014-04-30 22:36:23 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libwidg/DialogBox.st,v 1.352 2014-02-13 18:33:34 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/DialogBox.st,v 1.353 2014-04-30 22:36:23 cg Exp $'
 ! !