*** empty log message ***
authorClaus Gittinger <cg@exept.de>
Tue, 28 Jun 2005 18:49:56 +0200
changeset 3181 d9113406d88b
parent 3180 609f340fd96c
child 3182 e43b25ae000f
*** empty log message ***
DialogBox.st
--- a/DialogBox.st	Mon Jun 13 18:27:59 2005 +0200
+++ b/DialogBox.st	Tue Jun 28 18:49:56 2005 +0200
@@ -4588,6 +4588,57 @@
 
 !DialogBox class methodsFor:'smalltalk dialogs'!
 
+requestClass:aString okLabel:okLabel initialAnswer:initial
+    "launch a Dialog, which allows user to enter a class name.
+     Return the entered string (may be empty string) or nil (if cancel was pressed).
+     The entryField does classNameCompletion on TAB."
+
+     |className|
+
+     className := self requestClassName:aString okLabel:okLabel initialAnswer:initial.
+     ^ Smalltalk classNamed:className
+
+    "
+     Dialog 
+         requestClass:'enter a class:'
+         okLabel:'OK'
+         initialAnswer:'Arr'        
+    "
+!
+
+requestClassName:aString okLabel:okLabel initialAnswer:initial
+    "launch a Dialog, which allows user to enter a class name.
+     Return the entered string (may be empty string) or nil (if cancel was pressed).
+     The entryField does classNameCompletion on TAB."
+
+     ^ self
+        request:aString 
+        displayAt:nil 
+        centered:nil 
+        action:nil 
+        initialAnswer:initial 
+        okLabel:okLabel 
+        cancelLabel:nil 
+        title:nil 
+        onCancel:nil
+        list:nil
+        initialSelection:nil
+        entryCompletionBlock:[:s :field| 
+                                |completion|
+
+                                completion := Smalltalk classnameCompletion:s.
+                                completion second size > 1 ifTrue:[ Screen current beep].
+                                field contents:(completion first)
+                              ]
+
+    "
+     Dialog 
+         requestClassName:'enter a class:'
+         okLabel:'OK'
+         initialAnswer:'Arr'        
+    "
+!
+
 requestNameSpace:title initialAnswer:initialTextOrNil
     "Ask for a namespaces name"
 
@@ -7997,7 +8048,7 @@
 !DialogBox class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/DialogBox.st,v 1.236 2005-04-13 09:42:22 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/DialogBox.st,v 1.237 2005-06-28 16:49:56 cg Exp $'
 ! !
 
 DialogBox initialize!