DialogBox.st
changeset 5011 a8c0c89fadca
parent 4887 8799bcbe7ecb
child 5017 3e5feb8b83da
equal deleted inserted replaced
5010:ad4a10879e16 5011:a8c0c89fadca
  1190 !
  1190 !
  1191 
  1191 
  1192 information:aString
  1192 information:aString
  1193     "launch a Dialog to tell user something"
  1193     "launch a Dialog to tell user something"
  1194 
  1194 
  1195     |currentScreen|
  1195     self information:aString title:aString
  1196 
       
  1197     ((currentScreen := Screen current) notNil and:[currentScreen nativeDialogs]) ifTrue:[
       
  1198         ^ currentScreen 
       
  1199             nativeInformationOK:aString
       
  1200             title:aString
       
  1201     ].
       
  1202     self showAndThenDestroyBox:(InfoBox title:aString)
       
  1203 
  1196 
  1204     "
  1197     "
  1205      Dialog information:'help'
  1198      Dialog information:'help'
  1206     "
  1199     "
  1207 
  1200 
  1223     "
  1216     "
  1224      Dialog information:'help' title:'Attention'
  1217      Dialog information:'help' title:'Attention'
  1225     "
  1218     "
  1226 
  1219 
  1227     "Created: / 22-12-2010 / 19:33:23 / cg"
  1220     "Created: / 22-12-2010 / 19:33:23 / cg"
       
  1221 !
       
  1222 
       
  1223 informationText:aString title:windowTitle
       
  1224     "launch a Dialog to tell user something.
       
  1225      The argument aString is shown as multiline, scrollable text"
       
  1226 
       
  1227     |dialog textHolder|
       
  1228 
       
  1229     textHolder := ValueHolder new.
       
  1230     dialog := Dialog 
       
  1231                 forRequestText:'' editViewClass:TextView
       
  1232                 lines:15 columns:60 
       
  1233                 initialAnswer:aString initialSelection:nil 
       
  1234                 model:textHolder.
       
  1235     dialog window label:windowTitle.
       
  1236     dialog open.
       
  1237 
       
  1238     "
       
  1239      Dialog 
       
  1240         informationText:(DialogBox class compiledMethodAt:#information:title:) source
       
  1241         title:'Hello'
       
  1242     "
       
  1243 !
       
  1244 
       
  1245 informationText:aString title:title windowTitle:windowTitle
       
  1246     "launch a Dialog to tell user something.
       
  1247      The argument aString is shown as multiline, scrollable text"
       
  1248 
       
  1249     |dialog textHolder|
       
  1250 
       
  1251     textHolder := ValueHolder new.
       
  1252     dialog := Dialog 
       
  1253                 forRequestText:title editViewClass:TextView
       
  1254                 lines:15 columns:60 
       
  1255                 initialAnswer:aString initialSelection:nil 
       
  1256                 model:textHolder.
       
  1257     dialog removeAbortButton.
       
  1258     dialog okButton beReturnButton.
       
  1259     dialog window label:windowTitle.
       
  1260     dialog open.
       
  1261 
       
  1262     "
       
  1263      Dialog 
       
  1264         informationText:(DialogBox class compiledMethodAt:#information:title:) source
       
  1265         title:'Hello - the text is:'
       
  1266         windowTitle:'Hello'
       
  1267     "
  1228 !
  1268 !
  1229 
  1269 
  1230 warn:aString
  1270 warn:aString
  1231     "launch a Dialog to warn user"
  1271     "launch a Dialog to warn user"
  1232 
  1272 
  3441         setupWith:
  3481         setupWith:
  3442             [:textView :dialog|
  3482             [:textView :dialog|
  3443                 initialText notEmptyOrNil ifTrue:[
  3483                 initialText notEmptyOrNil ifTrue:[
  3444                     textModel value:initialText
  3484                     textModel value:initialText
  3445                 ].
  3485                 ].
  3446                 textView scrolledView
  3486                 textView scrolledView model:textModel.
  3447                     model:textModel;
  3487                 textView scrolledView 
  3448                     acceptChannel:(dialog acceptChannel).
  3488                     perform:#acceptChannel: 
       
  3489                     with:(dialog acceptChannel)
       
  3490                     ifNotUnderstood:[].
       
  3491 
  3449                 anIntervalOrNil notNil ifTrue:[
  3492                 anIntervalOrNil notNil ifTrue:[
  3450                     textView scrolledView selectFromCharacterPosition:anIntervalOrNil start to:anIntervalOrNil stop.
  3493                     textView scrolledView selectFromCharacterPosition:anIntervalOrNil start to:anIntervalOrNil stop.
  3451                 ].
  3494                 ].
  3452             ]
  3495             ]
  3453 
  3496 
  7921      dialog open.
  7964      dialog open.
  7922      dialog accepted ifTrue:[Transcript showCR:'yes'].
  7965      dialog accepted ifTrue:[Transcript showCR:'yes'].
  7923     "
  7966     "
  7924 
  7967 
  7925     "Modified: 9.2.1996 / 21:39:34 / cg"
  7968     "Modified: 9.2.1996 / 21:39:34 / cg"
       
  7969 !
       
  7970 
       
  7971 removeAbortButton 
       
  7972     "remove an already added okButton - only useful to change some already created
       
  7973      dialog afterwards"
       
  7974 
       
  7975     abortButton destroy
       
  7976 !
       
  7977 
       
  7978 removeOkButton 
       
  7979     "remove an already added okButton - only useful to change some already created
       
  7980      dialog afterwards"
       
  7981 
       
  7982     okButton destroy
  7926 ! !
  7983 ! !
  7927 
  7984 
  7928 !DialogBox methodsFor:'construction-check & comboboxes'!
  7985 !DialogBox methodsFor:'construction-check & comboboxes'!
  7929 
  7986 
  7930 addCheckBox:label on:aModel
  7987 addCheckBox:label on:aModel
 10065 ! !
 10122 ! !
 10066 
 10123 
 10067 !DialogBox class methodsFor:'documentation'!
 10124 !DialogBox class methodsFor:'documentation'!
 10068 
 10125 
 10069 version
 10126 version
 10070     ^ '$Header: /cvs/stx/stx/libwidg/DialogBox.st,v 1.352 2014-02-13 18:33:34 stefan Exp $'
 10127     ^ '$Header: /cvs/stx/stx/libwidg/DialogBox.st,v 1.353 2014-04-30 22:36:23 cg Exp $'
 10071 !
 10128 !
 10072 
 10129 
 10073 version_CVS
 10130 version_CVS
 10074     ^ '$Header: /cvs/stx/stx/libwidg/DialogBox.st,v 1.352 2014-02-13 18:33:34 stefan Exp $'
 10131     ^ '$Header: /cvs/stx/stx/libwidg/DialogBox.st,v 1.353 2014-04-30 22:36:23 cg Exp $'
 10075 ! !
 10132 ! !
 10076 
 10133 
 10077 
 10134 
 10078 DialogBox initialize!
 10135 DialogBox initialize!