1871 ! |
1871 ! |
1872 |
1872 |
1873 confirmWithCancel:aString labels:buttonLabels values:buttonValues default:default |
1873 confirmWithCancel:aString labels:buttonLabels values:buttonValues default:default |
1874 "launch a Dialog, which allows user to click on any button. |
1874 "launch a Dialog, which allows user to click on any button. |
1875 Return the corresponding value from the values array. |
1875 Return the corresponding value from the values array. |
1876 The labels for for the buttons are to be passed in |
1876 The labels for the buttons are to be passed in |
1877 buttonLabels; |
1877 buttonLabels; |
1878 The default argument (if non-nil) defines the index of the |
1878 The default argument (if non-nil) defines the index of the |
1879 return button (1 to n)" |
1879 return button (1 to n)" |
1880 |
1880 |
1881 ^ self |
1881 ^ self |
1913 ! |
1913 ! |
1914 |
1914 |
1915 confirmWithCancel:aString labels:buttonLabels values:buttonValues default:default check:checkLabelOrNil on:checkHolderOrNil title:boxLabelOrNil |
1915 confirmWithCancel:aString labels:buttonLabels values:buttonValues default:default check:checkLabelOrNil on:checkHolderOrNil title:boxLabelOrNil |
1916 "launch a Dialog, which allows user to click on any button. |
1916 "launch a Dialog, which allows user to click on any button. |
1917 Return the corresponding value from the values array. |
1917 Return the corresponding value from the values array. |
1918 The labels for for the buttons are to be passed in |
1918 The labels for the buttons are to be passed in |
1919 buttonLabels; |
1919 buttonLabels; |
1920 The default argument (if non-nil) defines the index of the return button (1 to n). |
1920 The default argument (if non-nil) defines the index of the return button (1 to n). |
1921 If checkLabel/checkHolder are not nil, and additional labelled checkBox is added to operate on |
1921 If checkLabel/checkHolder are not nil, and additional labelled checkBox is added to operate on |
1922 checkHolder. This can be used for 'do not show this box again' checkItems." |
1922 checkHolder. This can be used for 'do not show this box again' checkItems." |
1923 |
1923 |
1924 |box buttons answer i| |
1924 |box buttons answer i| |
1925 |
1925 |
1926 box := OptionBox title:aString numberOfOptions:buttonLabels size. |
1926 box := OptionBox title:aString numberOfOptions:buttonLabels size. |
1927 box buttonTitles:buttonLabels |
1927 box buttonTitles:buttonLabels |
1928 actions:(buttonValues collect:[:v | [answer := v]]). |
1928 actions:(buttonValues collect:[:v | [answer := v]]). |
1929 box image:(YesNoBox iconBitmap). |
1929 box image:(YesNoBox iconBitmap). |
1930 default notNil ifTrue:[ |
1930 default notNil ifTrue:[ |
1931 box defaultButtonIndex:(default isInteger |
1931 box defaultButtonIndex:(default isInteger |
1932 ifTrue:[default] |
1932 ifTrue:[default] |
1933 ifFalse:[ buttonValues indexOf:default]) |
1933 ifFalse:[ buttonValues indexOf:default]) |
1934 ]. |
1934 ]. |
1935 box label:(boxLabelOrNil ? (self classResources string:'Confirm')). |
1935 box label:(boxLabelOrNil ? (self classResources string:'Confirm')). |
1936 buttons := box buttons. |
1936 buttons := box buttons. |
1983 ! |
1983 ! |
1984 |
1984 |
1985 confirmWithCancel:aString labels:buttonLabels values:buttonValues default:default title:boxLabelOrNil |
1985 confirmWithCancel:aString labels:buttonLabels values:buttonValues default:default title:boxLabelOrNil |
1986 "launch a Dialog, which allows user to click on any button. |
1986 "launch a Dialog, which allows user to click on any button. |
1987 Return the corresponding value from the values array. |
1987 Return the corresponding value from the values array. |
1988 The labels for for the buttons are to be passed in |
1988 The labels for the buttons are to be passed in |
1989 buttonLabels; |
1989 buttonLabels; |
1990 The default argument (if non-nil) defines the index of the |
1990 The default argument (if non-nil) defines the index of the |
1991 return button (1 to n)" |
1991 return button (1 to n)" |
1992 |
1992 |
1993 ^ self |
1993 ^ self |
1994 confirmWithCancel:aString |
1994 confirmWithCancel:aString |
1995 labels:buttonLabels |
1995 labels:buttonLabels |
1996 values:buttonValues |
1996 values:buttonValues |
1997 default:default |
1997 default:default |
1998 check:nil on:nil |
1998 check:nil on:nil |
1999 title:boxLabelOrNil |
1999 title:boxLabelOrNil |
2000 |
2000 |
2001 " |
2001 " |
2002 Transcript showCR:( |
2002 Transcript showCR:( |
2003 Dialog |
2003 Dialog |
2004 confirmWithCancel:'really ?' |
2004 confirmWithCancel:'really ?' |
2005 labels:#('mhmh' 'maybe' 'definitely') |
2005 labels:#('mhmh' 'maybe' 'definitely') |
2006 values:#(1 2 3) |
2006 values:#(1 2 3) |
2007 default:3 |
2007 default:3 |
2008 title:'hello there' |
2008 title:'hello there' |