FileSaveBox.st
changeset 197 00927189c882
parent 174 d80a6cc3f9b2
child 243 5c411425097d
equal deleted inserted replaced
196:7e3c25063173 197:00927189c882
    31  other person.  No title to or ownership of the software is
    31  other person.  No title to or ownership of the software is
    32  hereby transferred.
    32  hereby transferred.
    33 "
    33 "
    34 !
    34 !
    35 
    35 
    36 version
       
    37     ^ '$Header: /cvs/stx/stx/libwidg/FileSaveBox.st,v 1.6 1995-11-11 16:20:14 cg Exp $'
       
    38 !
       
    39 
       
    40 documentation
    36 documentation
    41 "
    37 "
    42     Instances of FileSaveBox add an 'append'-button. The other
    38     Instances of FileSaveBox add an 'append'-button. The other
    43     behavior is that of a FileSelectionBox.
    39     behavior is that of a FileSelectionBox.
    44 
    40 
    45     Instance variables:
    41     Instance variables:
    46 	appendAction            action to be performed when append is pressed
    42 	appendAction            action to be performed when append is pressed
    47 "
    43 "
       
    44 !
       
    45 
       
    46 version
       
    47     ^ '$Header: /cvs/stx/stx/libwidg/FileSaveBox.st,v 1.7 1995-11-23 02:25:15 cg Exp $'
    48 ! !
    48 ! !
    49 
    49 
    50 !FileSaveBox methodsFor:'user interaction'!
    50 !FileSaveBox methodsFor:'accessing'!
    51 
    51 
    52 appendPressed
    52 appendAction:aBlock
    53     self hideAndEvaluate:[:string |
    53     "set the action to be performed when append is pressed"
    54 	appendAction notNil ifTrue:[
    54 
    55 	    appendAction value:string 
    55     appendAction := aBlock
    56 	]
       
    57     ]
       
    58 ! !
    56 ! !
    59 
    57 
    60 !FileSaveBox methodsFor:'initialization'!
    58 !FileSaveBox methodsFor:'initialization'!
    61 
       
    62 initialize
       
    63     super initialize.
       
    64 
       
    65     label := resources string:'Save file dialog'.
       
    66 
       
    67     okButton label:(resources string:'save').
       
    68 
       
    69     "
       
    70      insert an append-button between abort- and save-buttons
       
    71     "
       
    72     appendButton := Button okButton.
       
    73     appendButton isReturnButton:false.
       
    74     appendButton label:(resources string:'append').
       
    75     appendButton action:[appendButton turnOffWithoutRedraw. self appendPressed].
       
    76     buttonPanel addSubView:appendButton after:abortButton
       
    77 !
       
    78 
    59 
    79 focusSequence
    60 focusSequence
    80     |a|
    61     |a|
    81 
    62 
    82     patternField shown ifTrue:[
    63     patternField shown ifTrue:[
    92     ^ Array with:enterField 
    73     ^ Array with:enterField 
    93 	    with:selectionList
    74 	    with:selectionList
    94 	    with:abortButton 
    75 	    with:abortButton 
    95 	    with:appendButton 
    76 	    with:appendButton 
    96 	    with:okButton 
    77 	    with:okButton 
       
    78 !
       
    79 
       
    80 initialize
       
    81     super initialize.
       
    82 
       
    83     label := resources string:'Save file dialog'.
       
    84 
       
    85     okButton label:(resources string:'save').
       
    86 
       
    87     "
       
    88      insert an append-button between abort- and save-buttons
       
    89     "
       
    90     appendButton := Button okButton.
       
    91     appendButton isReturnButton:false.
       
    92     appendButton label:(resources string:'append').
       
    93     appendButton action:[appendButton turnOffWithoutRedraw. self appendPressed].
       
    94     buttonPanel addSubView:appendButton after:abortButton
    97 ! !
    95 ! !
    98 
    96 
    99 !FileSaveBox methodsFor:'accessing'!
    97 !FileSaveBox methodsFor:'user interaction'!
   100 
    98 
   101 appendAction:aBlock
    99 appendPressed
   102     "set the action to be performed when append is pressed"
   100     self hideAndEvaluate:[:string |
       
   101 	appendAction notNil ifTrue:[
       
   102 	    appendAction value:string 
       
   103 	]
       
   104     ]
       
   105 ! !
   103 
   106 
   104     appendAction := aBlock
       
   105 ! !