DialogBox.st
changeset 1843 b868964a554e
parent 1780 bfc30a82aae3
child 1877 a46bf520f9c6
equal deleted inserted replaced
1842:b5069ac92167 1843:b868964a554e
  3037     ].
  3037     ].
  3038 
  3038 
  3039     "Modified: 31.5.1996 / 21:22:13 / cg"
  3039     "Modified: 31.5.1996 / 21:22:13 / cg"
  3040 !
  3040 !
  3041 
  3041 
       
  3042 makeTabable:aComponentOrSubcomponent after:anotherComponent
       
  3043     "add a component (usually a subcomponent, of which the dialog
       
  3044      does not know) to the list of tabable ones (i.e. those, that can be
       
  3045      stepped through via FocusNext/FocusPrevious).
       
  3046      Toplevel tabable components are usually added with #addComponent:tabable:"
       
  3047 
       
  3048     tabableElements isNil ifTrue:[
       
  3049         tabableElements := OrderedCollection new
       
  3050     ].
       
  3051     tabableElements removeIdentical:aComponentOrSubcomponent ifAbsent:nil.
       
  3052 
       
  3053     anotherComponent isNil ifTrue:[
       
  3054         tabableElements addLast:aComponentOrSubcomponent
       
  3055     ] ifFalse:[
       
  3056         tabableElements add:aComponentOrSubcomponent after:anotherComponent.
       
  3057     ].
       
  3058 
       
  3059     (aComponentOrSubcomponent isInputField) ifTrue:[
       
  3060         self addToInputFieldGroup:aComponentOrSubcomponent after:anotherComponent
       
  3061     ].
       
  3062 
       
  3063     "Modified: 18.10.1997 / 03:08:20 / cg"
       
  3064 !
       
  3065 
  3042 makeTabable:aComponentOrSubcomponent before:anotherComponent
  3066 makeTabable:aComponentOrSubcomponent before:anotherComponent
  3043     "add a component (usually a subcomponent, of which the dialog
  3067     "add a component (usually a subcomponent, of which the dialog
  3044      does not know) to the list of tabable ones (i.e. those, that can be
  3068      does not know) to the list of tabable ones (i.e. those, that can be
  3045      stepped through via FocusNext/FocusPrevious).
  3069      stepped through via FocusNext/FocusPrevious).
  3046      Toplevel tabable components are usually added with #addComponent:tabable:"
  3070      Toplevel tabable components are usually added with #addComponent:tabable:"
  3047 
  3071 
  3048     tabableElements isNil ifTrue:[
  3072     tabableElements isNil ifTrue:[
  3049 	tabableElements := OrderedCollection new
  3073         tabableElements := OrderedCollection new
  3050     ].
  3074     ].
  3051     tabableElements removeIdentical:aComponentOrSubcomponent ifAbsent:nil.
  3075     tabableElements removeIdentical:aComponentOrSubcomponent ifAbsent:nil.
  3052 
  3076 
  3053     anotherComponent isNil ifTrue:[
  3077     anotherComponent isNil ifTrue:[
  3054 	tabableElements addFirst:aComponentOrSubcomponent
  3078         tabableElements addFirst:aComponentOrSubcomponent
  3055     ] ifFalse:[
  3079     ] ifFalse:[
  3056 	tabableElements add:aComponentOrSubcomponent before:anotherComponent.
  3080         tabableElements add:aComponentOrSubcomponent before:anotherComponent.
  3057     ].
  3081     ].
  3058 
  3082 
  3059     (aComponentOrSubcomponent isInputField) ifTrue:[
  3083     (aComponentOrSubcomponent isInputField) ifTrue:[
  3060 	self addToInputFieldGroup:aComponentOrSubcomponent before:anotherComponent
  3084         self addToInputFieldGroup:aComponentOrSubcomponent before:anotherComponent
  3061     ].
  3085     ].
  3062 
  3086 
  3063     "Modified: 18.10.1997 / 03:08:20 / cg"
  3087     "Modified: 18.10.1997 / 03:08:20 / cg"
  3064 !
  3088 !
  3065 
  3089 
  3832 
  3856 
  3833     |h|
  3857     |h|
  3834 
  3858 
  3835     buttonPanel addSubView:aButton after:someOtherButtonOrNil.
  3859     buttonPanel addSubView:aButton after:someOtherButtonOrNil.
  3836     buttonPanel subViews size > 1 ifTrue:[
  3860     buttonPanel subViews size > 1 ifTrue:[
  3837 	buttonPanel horizontalLayout:#fitSpace.
  3861         buttonPanel horizontalLayout:#fitSpace.
  3838     ].
  3862     ].
  3839     (h := (aButton heightIncludingBorder + (ViewSpacing * 2))) > buttonPanel topInset ifTrue:[
  3863     (h := (aButton heightIncludingBorder + (ViewSpacing * 2))) > buttonPanel topInset ifTrue:[
  3840 	 buttonPanel topInset:h negated
  3864          buttonPanel topInset:h negated
  3841     ].
  3865     ].
  3842     needResize := true.
  3866     needResize := true.
  3843     ^ aButton
  3867     ^ aButton
  3844 
  3868 
  3845     "
  3869     "
  3847 
  3871 
  3848      dialog := DialogBox new.
  3872      dialog := DialogBox new.
  3849      dialog addAbortButton.
  3873      dialog addAbortButton.
  3850      dialog addOkButton.
  3874      dialog addOkButton.
  3851      dialog addButton:(Button 
  3875      dialog addButton:(Button 
  3852 			label:'foo' 
  3876                         label:'foo' 
  3853 			action:[dialog hide. Transcript showCR:'foo'])
  3877                         action:[dialog hide. Transcript showCR:'foo'])
  3854 		after:(dialog okButton).
  3878                 after:(dialog okButton).
  3855      dialog open.
  3879      dialog open.
  3856      dialog accepted ifTrue:[Transcript showCR:'yes'].
  3880      dialog accepted ifTrue:[Transcript showCR:'yes'].
  3857     "
  3881     "
  3858     "
  3882     "
  3859      |dialog|
  3883      |dialog|
  3860 
  3884 
  3861      dialog := DialogBox new.
  3885      dialog := DialogBox new.
  3862      dialog addAbortButton.
  3886      dialog addAbortButton.
  3863      dialog addOkButton.
  3887      dialog addOkButton.
  3864      dialog addButton:(Button 
  3888      dialog addButton:(Button 
  3865 			label:'foo' 
  3889                         label:'foo' 
  3866 			action:[dialog hide. Transcript showCR:'foo'])
  3890                         action:[dialog hide. Transcript showCR:'foo'])
  3867 		after:(dialog abortButton).
  3891                 after:(dialog abortButton).
  3868      dialog open.
  3892      dialog open.
  3869      dialog accepted ifTrue:[Transcript showCR:'yes'].
  3893      dialog accepted ifTrue:[Transcript showCR:'yes'].
  3870     "
  3894     "
  3871     "
  3895     "
  3872      |dialog|
  3896      |dialog|
  3873 
  3897 
  3874      dialog := DialogBox new.
  3898      dialog := DialogBox new.
  3875      dialog addAbortButton.
  3899      dialog addAbortButton.
  3876      dialog addOkButton.
  3900      dialog addOkButton.
  3877      dialog addButton:(Button 
  3901      dialog addButton:(Button 
  3878 			label:'foo' 
  3902                         label:'foo' 
  3879 			action:[dialog hide. Transcript showCR:'foo'])
  3903                         action:[dialog hide. Transcript showCR:'foo'])
  3880 		after:nil.
  3904                 after:nil.
  3881      dialog open.
  3905      dialog open.
  3882      dialog accepted ifTrue:[Transcript showCR:'yes'].
  3906      dialog accepted ifTrue:[Transcript showCR:'yes'].
  3883     "
  3907     "
  3884 
  3908 
  3885     "Modified: 9.2.1996 / 22:13:51 / cg"
  3909     "Modified: 9.2.1996 / 22:13:51 / cg"
  3892 
  3916 
  3893     |h|
  3917     |h|
  3894 
  3918 
  3895     buttonPanel addSubView:aButton before:someOtherButtonOrNil.
  3919     buttonPanel addSubView:aButton before:someOtherButtonOrNil.
  3896     buttonPanel subViews size > 1 ifTrue:[
  3920     buttonPanel subViews size > 1 ifTrue:[
  3897 	buttonPanel horizontalLayout:#fitSpace.
  3921         buttonPanel horizontalLayout:#fitSpace.
  3898     ].
  3922     ].
  3899     (h := (aButton heightIncludingBorder + (ViewSpacing * 2))) > buttonPanel topInset ifTrue:[
  3923     (h := (aButton heightIncludingBorder + (ViewSpacing * 2))) > buttonPanel topInset ifTrue:[
  3900 	 buttonPanel topInset:h negated
  3924          buttonPanel topInset:h negated
  3901     ].
  3925     ].
  3902     needResize := true.
  3926     needResize := true.
  3903     ^ aButton
  3927     ^ aButton
  3904 
  3928 
  3905     "
  3929     "
  3907 
  3931 
  3908      dialog := DialogBox new.
  3932      dialog := DialogBox new.
  3909      dialog addAbortButton.
  3933      dialog addAbortButton.
  3910      dialog addOkButton.
  3934      dialog addOkButton.
  3911      dialog addButton:(Button 
  3935      dialog addButton:(Button 
  3912 			label:'foo' 
  3936                         label:'foo' 
  3913 			action:[dialog hide. Transcript showCR:'foo'])
  3937                         action:[dialog hide. Transcript showCR:'foo'])
  3914 		before:(dialog okButton).
  3938                 before:(dialog okButton).
  3915      dialog open.
  3939      dialog open.
  3916      dialog accepted ifTrue:[Transcript showCR:'yes'].
  3940      dialog accepted ifTrue:[Transcript showCR:'yes'].
  3917     "
  3941     "
  3918     "
  3942     "
  3919      |dialog|
  3943      |dialog|
  3920 
  3944 
  3921      dialog := DialogBox new.
  3945      dialog := DialogBox new.
  3922      dialog addAbortButton.
  3946      dialog addAbortButton.
  3923      dialog addOkButton.
  3947      dialog addOkButton.
  3924      dialog addButton:(Button 
  3948      dialog addButton:(Button 
  3925 			label:'foo' 
  3949                         label:'foo' 
  3926 			action:[dialog hide. Transcript showCR:'foo'])
  3950                         action:[dialog hide. Transcript showCR:'foo'])
  3927 		before:nil.
  3951                 before:nil.
  3928      dialog open.
  3952      dialog open.
  3929      dialog accepted ifTrue:[Transcript showCR:'yes'].
  3953      dialog accepted ifTrue:[Transcript showCR:'yes'].
  3930     "
  3954     "
  3931 
  3955 
  3932     "Modified: 9.2.1996 / 22:13:51 / cg"
  3956     "Modified: 9.2.1996 / 22:13:51 / cg"
  5592      the panel."
  5616      the panel."
  5593 
  5617 
  5594     |fields buttons|
  5618     |fields buttons|
  5595 
  5619 
  5596     tabableElements isNil ifTrue:[
  5620     tabableElements isNil ifTrue:[
  5597 	fields := #()
  5621         fields := #()
  5598     ] ifFalse:[
  5622     ] ifFalse:[
  5599 	fields := tabableElements
  5623         fields := tabableElements
  5600     ].
  5624     ].
  5601     buttonPanel notNil ifTrue:[
  5625     buttonPanel notNil ifTrue:[
  5602 	buttons := buttonPanel subViews.
  5626         buttons := buttonPanel subViews.
  5603 	buttons notNil ifTrue:[
  5627         buttons notNil ifTrue:[
  5604 	    fields := fields , buttonPanel subViews
  5628             fields := fields , buttonPanel subViews
  5605 	]
  5629         ]
  5606     ].
  5630     ].
  5607     ^ fields select:[:aField | aField realized].
  5631     ^ fields "/ select:[:aField | aField realized and:[aField enabled]].
  5608 
  5632 
  5609     "Modified: 31.5.1996 / 22:05:58 / cg"
  5633     "Modified: 31.5.1996 / 22:05:58 / cg"
  5610 !
  5634 !
  5611 
  5635 
  5612 initialize
  5636 initialize
  5922 ! !
  5946 ! !
  5923 
  5947 
  5924 !DialogBox class methodsFor:'documentation'!
  5948 !DialogBox class methodsFor:'documentation'!
  5925 
  5949 
  5926 version
  5950 version
  5927     ^ '$Header: /cvs/stx/stx/libwidg/DialogBox.st,v 1.132 1999-03-09 18:11:30 cg Exp $'
  5951     ^ '$Header: /cvs/stx/stx/libwidg/DialogBox.st,v 1.133 1999-04-15 12:33:52 cg Exp $'
  5928 ! !
  5952 ! !
  5929 DialogBox initialize!
  5953 DialogBox initialize!