DialogBox.st
changeset 498 1c4fbbcc9362
parent 490 08e8adfb783c
child 528 3ed1f0b5a0bb
equal deleted inserted replaced
497:072d3b8507fd 498:1c4fbbcc9362
   763             ]
   763             ]
   764         ]
   764         ]
   765 "
   765 "
   766 ! !
   766 ! !
   767 
   767 
       
   768 !DialogBox class methodsFor:'class initialization'!
       
   769 
       
   770 initialize
       
   771     Dialog := self
       
   772 
       
   773     "Created: 8.3.1996 / 21:18:54 / cg"
       
   774 ! !
       
   775 
   768 !DialogBox class methodsFor:'common dialogs'!
   776 !DialogBox class methodsFor:'common dialogs'!
   769 
   777 
   770 information:aString
   778 information:aString
   771     "launch a Dialog to tell user something"
   779     "launch a Dialog to tell user something"
   772 
   780 
   791 
   799 
   792 confirm:aString
   800 confirm:aString
   793     "launch a Dialog, which allows user to enter yes or no.
   801     "launch a Dialog, which allows user to enter yes or no.
   794      return true for yes, false for no"
   802      return true for yes, false for no"
   795 
   803 
   796     |box answer|
   804     ^ self 
   797 
   805         confirm:aString
   798     box := YesNoBox title:aString.
   806         title:nil
   799     box label:(self classResources string:'Confirm').
   807         yesLabel:nil
   800     box yesAction:[answer := true] noAction:[answer := false].
   808         noLabel:nil
   801     box showAtPointer.
   809 
   802     box yesAction:nil noAction:nil.
   810 "/    |box answer|
   803     ^ answer
   811 "/
       
   812 "/    box := YesNoBox title:aString.
       
   813 "/    box label:(self classResources string:'Confirm').
       
   814 "/    box yesAction:[answer := true] noAction:[answer := false].
       
   815 "/    box showAtPointer.
       
   816 "/    box yesAction:nil noAction:nil.
       
   817 "/    ^ answer
   804 
   818 
   805     " 
   819     " 
   806      Dialog confirm:'really ?' 
   820      Dialog confirm:'really ?' 
   807 
   821 
   808      Transcript showCr:(
   822      Transcript showCr:(
   809         Dialog confirm:'are you certain ?'
   823         Dialog confirm:'are you certain ?'
   810      )
   824      )
   811     "
   825     "
   812 
   826 
   813     "Modified: 27.2.1996 / 01:17:54 / cg"
   827     "Modified: 8.3.1996 / 21:16:54 / cg"
   814 !
   828 !
   815 
   829 
   816 confirm:aString initialAnswer:what
   830 confirm:aString initialAnswer:what
   817     "launch a Dialog, which allows user to enter yes or no.
   831     "launch a Dialog, which allows user to enter yes or no.
   818      return true for yes, false for no.
   832      return true for yes, false for no.
   845     "
   859     "
   846 
   860 
   847     "Modified: 27.1.1996 / 14:24:39 / cg"
   861     "Modified: 27.1.1996 / 14:24:39 / cg"
   848 !
   862 !
   849 
   863 
       
   864 confirm:aString title:title yesLabel:yesText noLabel:noText
       
   865     "launch a Dialog, which allows user to enter yes or no.
       
   866      return true for yes, false for no.
       
   867      The yes/no buttons labels are defined by yesText/noText."
       
   868 
       
   869     |box answer|
       
   870 
       
   871     box := YesNoBox title:aString.
       
   872     yesText notNil ifTrue:[
       
   873         box yesLabel:yesText.
       
   874     ].
       
   875     noText notNil ifTrue:[
       
   876         box noLabel:noText.
       
   877     ].
       
   878     box yesAction:[answer := true] noAction:[answer := false].
       
   879     title notNil ifTrue:[
       
   880         box label:title
       
   881     ].
       
   882     box showAtPointer.
       
   883     box yesAction:nil noAction:nil.
       
   884     ^ answer
       
   885 
       
   886     " 
       
   887      Dialog 
       
   888         confirm:'really ?' 
       
   889         title:'fooBar'
       
   890         yesLabel:'oh well' 
       
   891         noLabel:'nope'
       
   892     "
       
   893 
       
   894     "Created: 21.2.1996 / 01:10:14 / cg"
       
   895     "Modified: 8.3.1996 / 21:15:56 / cg"
       
   896 !
       
   897 
   850 confirm:aString yesLabel:yesText noLabel:noText
   898 confirm:aString yesLabel:yesText noLabel:noText
   851     "launch a Dialog, which allows user to enter yes or no.
   899     "launch a Dialog, which allows user to enter yes or no.
   852      return true for yes, false for no.
   900      return true for yes, false for no.
   853      The yes/no buttons labels are defined by yesText/noText."
   901      The yes/no buttons labels are defined by yesText/noText."
   854 
   902 
   855     |box answer|
   903     ^ self confirm:aString title:nil yesLabel:yesText noLabel:noText
   856 
       
   857     box := YesNoBox title:aString.
       
   858     box yesLabel:yesText; noLabel:noText.
       
   859     box yesAction:[answer := true] noAction:[answer := false].
       
   860     box showAtPointer.
       
   861     box yesAction:nil noAction:nil.
       
   862     ^ answer
       
   863 
   904 
   864     " 
   905     " 
   865      Dialog confirm:'really ?' yesLabel:'oh well' noLabel:'nope'
   906      Dialog confirm:'really ?' yesLabel:'oh well' noLabel:'nope'
   866     "
   907     "
   867 
   908 
   868     "Created: 21.2.1996 / 01:10:14 / cg"
   909     "Created: 21.2.1996 / 01:10:14 / cg"
   869     "Modified: 21.2.1996 / 01:34:55 / cg"
   910     "Modified: 8.3.1996 / 21:15:06 / cg"
   870 !
   911 !
   871 
   912 
   872 confirmWithCancel:aString
   913 confirmWithCancel:aString
   873     "launch a Dialog, which allows user to enter yes, no and cancel.
   914     "launch a Dialog, which allows user to enter yes, no and cancel.
   874      return true for 'yes', false for 'no', nil for 'cancel'"
   915      return true for 'yes', false for 'no', nil for 'cancel'"
  3763 ! !
  3804 ! !
  3764 
  3805 
  3765 !DialogBox class methodsFor:'documentation'!
  3806 !DialogBox class methodsFor:'documentation'!
  3766 
  3807 
  3767 version
  3808 version
  3768     ^ '$Header: /cvs/stx/stx/libwidg/DialogBox.st,v 1.53 1996-03-07 12:35:23 cg Exp $'
  3809     ^ '$Header: /cvs/stx/stx/libwidg/DialogBox.st,v 1.54 1996-03-08 20:20:18 cg Exp $'
  3769 ! !
  3810 ! !
       
  3811 DialogBox initialize!