DialogBox.st
changeset 2116 c51b55fda393
parent 2112 46a837520f47
child 2126 a2e54b57e1af
equal deleted inserted replaced
2115:c994e244b8cf 2116:c51b55fda393
  3010         ] ifFalse:[
  3010         ] ifFalse:[
  3011             listView := SelectionInListView new.
  3011             listView := SelectionInListView new.
  3012             listView level:-1.
  3012             listView level:-1.
  3013         ].
  3013         ].
  3014         listView list:list.
  3014         listView list:list.
  3015         listView doubleClickAction:[:line | 
  3015         listView doubleClickAction:[:selectionIndex | 
  3016             |val|
  3016             |val|
  3017 
  3017 
  3018             val := listValues at:line.
  3018             multiple ifTrue:[
       
  3019                 val := selectionIndex collect:[:idx | listValues at:idx].
       
  3020             ] ifFalse:[
       
  3021                 val := listValues at:selectionIndex.
       
  3022             ].
  3019             box destroy. 
  3023             box destroy. 
  3020             multiple ifTrue:[
       
  3021                 ^ Array with:val
       
  3022             ].
       
  3023             ^ val
  3024             ^ val
  3024         ].
  3025         ].
  3025         listView multipleSelectOk:multiple.
  3026         listView multipleSelectOk:multiple.
  3026         box addComponent:listView indent:(ViewSpacing // 2) withHeight:(listView heightForLines:maxLines).
  3027         box addComponent:listView indent:(ViewSpacing // 2) withHeight:(listView heightForLines:maxLines).
  3027         box makeTabable:listView.
  3028         box makeTabable:listView.
  3098                 cancel:nil
  3099                 cancel:nil
  3099                 multiple:true
  3100                 multiple:true
  3100          )
  3101          )
  3101     "
  3102     "
  3102 
  3103 
  3103     "Modified: 29.5.1996 / 15:27:22 / cg"
  3104     "Modified: / 3.2.2000 / 23:41:09 / cg"
  3104 !
  3105 !
  3105 
  3106 
  3106 choose:aString fromList:list values:listValues lines:maxLines cancel:cancelBlock
  3107 choose:aString fromList:list values:listValues lines:maxLines cancel:cancelBlock
  3107     "launch a Dialog showing the message and list.
  3108     "launch a Dialog showing the message and list.
  3108      The user can select an item and click ok; in this case, the corresponding value
  3109      The user can select an item and click ok; in this case, the corresponding value
  3985 
  3986 
  3986     "Created: 13.4.1996 / 13:41:31 / cg"
  3987     "Created: 13.4.1996 / 13:41:31 / cg"
  3987     "Modified: 3.6.1996 / 18:48:49 / cg"
  3988     "Modified: 3.6.1996 / 18:48:49 / cg"
  3988 !
  3989 !
  3989 
  3990 
       
  3991 addMessage:aString centered:centered
       
  3992     ^ self addTextLabel:aString
       
  3993 
       
  3994     "Created: / 4.2.2000 / 00:03:24 / cg"
       
  3995 !
       
  3996 
  3990 addTextLabel:aString
  3997 addTextLabel:aString
  3991     "create a text label - the name has been choosen for ST-80 compatibility;
  3998     "create a text label - the name has been choosen for ST-80 compatibility;
  3992      however, ST/X labels allow image labels too.
  3999      however, ST/X labels allow image labels too.
  3993      Returns the label."
  4000      Returns the label."
  3994 
  4001 
  4354 
  4361 
  4355     "Modified: 20.5.1996 / 20:30:55 / cg"
  4362     "Modified: 20.5.1996 / 20:30:55 / cg"
  4356     "Modified: 9.9.1996 / 22:40:21 / stefan"
  4363     "Modified: 9.9.1996 / 22:40:21 / stefan"
  4357 !
  4364 !
  4358 
  4365 
       
  4366 addOK:checkBlock
       
  4367     |butt|
       
  4368 
       
  4369     butt := self addOkButton.
       
  4370     "/ what is checkBlock ?
       
  4371     ^ butt
       
  4372 
       
  4373     "Modified: / 4.2.2000 / 00:09:15 / cg"
       
  4374 !
       
  4375 
  4359 addOkButton
  4376 addOkButton
  4360     "create an okButton - to be sent from redefined initialize
  4377     "create an okButton - to be sent from redefined initialize
  4361      methods in subclasses or when creating a box programmatically.
  4378      methods in subclasses or when creating a box programmatically.
  4362      Returns the button."
  4379      Returns the button."
  4363 
  4380 
  4922     "Created: 13.4.1996 / 13:41:31 / cg"
  4939     "Created: 13.4.1996 / 13:41:31 / cg"
  4923     "Modified: 19.4.1996 / 17:39:46 / cg"
  4940     "Modified: 19.4.1996 / 17:39:46 / cg"
  4924 ! !
  4941 ! !
  4925 
  4942 
  4926 !DialogBox methodsFor:'construction-layout'!
  4943 !DialogBox methodsFor:'construction-layout'!
       
  4944 
       
  4945 addGap:pixels
       
  4946     "VW compatibility"
       
  4947 
       
  4948     self addVerticalSpace:pixels
       
  4949 
       
  4950     "Created: / 4.2.2000 / 00:03:58 / cg"
       
  4951     "Modified: / 5.2.2000 / 15:30:26 / cg"
       
  4952 !
  4927 
  4953 
  4928 addHorizontalLine
  4954 addHorizontalLine
  4929     "add a horizontal line as separator"
  4955     "add a horizontal line as separator"
  4930 
  4956 
  4931     ^ self addComponent:(Separator new extent:1.0 @ 5).
  4957     ^ self addComponent:(Separator new extent:1.0 @ 5).
  5002     "
  5028     "
  5003 
  5029 
  5004     "Modified: 9.2.1996 / 21:41:23 / cg"
  5030     "Modified: 9.2.1996 / 21:41:23 / cg"
  5005 !
  5031 !
  5006 
  5032 
       
  5033 bottomAlign:widgets
       
  5034     "mhmh - seems similar to out stickAtBottom functionality - to be checked"
       
  5035 
       
  5036     self halt:'unimplemented VW functionality'.
       
  5037 
       
  5038     "Created: / 4.2.2000 / 00:10:21 / cg"
       
  5039     "Modified: / 5.2.2000 / 15:31:23 / cg"
       
  5040 !
       
  5041 
       
  5042 bottomAlignLowerEdge:widget
       
  5043     "mhmh - seems similar to out stickAtBottom functionality - to be checked"
       
  5044 
       
  5045     self halt:'unimplemented VW functionality'.
       
  5046 
       
  5047     "Modified: / 5.2.2000 / 15:31:15 / cg"
       
  5048 !
       
  5049 
  5007 leftIndent
  5050 leftIndent
  5008     "return the current indent 
  5051     "return the current indent 
  5009      (current x position - thats where the next component will be located)."
  5052      (current x position - thats where the next component will be located)."
  5010 
  5053 
  5011     ^ leftIndent
  5054     ^ leftIndent
  5070     "
  5113     "
  5071 
  5114 
  5072     "Modified: 9.2.1996 / 21:42:46 / cg"
  5115     "Modified: 9.2.1996 / 21:42:46 / cg"
  5073 !
  5116 !
  5074 
  5117 
       
  5118 setInitialGap
       
  5119 
       
  5120     "Created: / 4.2.2000 / 00:01:44 / cg"
       
  5121 !
       
  5122 
  5075 stickAtBottomWithFixHeight:aComponent
  5123 stickAtBottomWithFixHeight:aComponent
  5076     "arrange for a component to be positioned at a constant offset
  5124     "arrange for a component to be positioned at a constant offset
  5077      from the bottom of the box and its height to remain the same.
  5125      from the bottom of the box and its height to remain the same.
  5078      This will keep the component at a constant distance from the bottom
  5126      This will keep the component at a constant distance from the bottom
  5079      (without this setup, it would stay at a constant offset from the top)"
  5127      (without this setup, it would stay at a constant offset from the top)"
  5231 
  5279 
  5232     "Modified: 9.2.1996 / 21:46:40 / cg"
  5280     "Modified: 9.2.1996 / 21:46:40 / cg"
  5233 ! !
  5281 ! !
  5234 
  5282 
  5235 !DialogBox methodsFor:'construction-lists'!
  5283 !DialogBox methodsFor:'construction-lists'!
       
  5284 
       
  5285 addList:listHolder lines:nLines validation:validateionBlock
       
  5286     ^ self 
       
  5287         addListBoxOn:listHolder
       
  5288         withNumberOfLines:nLines 
       
  5289         hScrollable:true
       
  5290         vScrollable:true
       
  5291 
       
  5292     "Created: / 4.2.2000 / 00:04:49 / cg"
       
  5293     "Modified: / 4.2.2000 / 00:06:06 / cg"
       
  5294 !
  5236 
  5295 
  5237 addListBoxOn:aModel
  5296 addListBoxOn:aModel
  5238     "add a selectionInListView to the box.
  5297     "add a selectionInListView to the box.
  5239      The listViews ScrollWrapper is returned"
  5298      The listViews ScrollWrapper is returned"
  5240 
  5299 
  6123     aBlock notNil ifTrue:[aBlock value]
  6182     aBlock notNil ifTrue:[aBlock value]
  6124 
  6183 
  6125     "Modified: 5.9.1995 / 19:06:33 / claus"
  6184     "Modified: 5.9.1995 / 19:06:33 / claus"
  6126 !
  6185 !
  6127 
  6186 
       
  6187 preOpen
       
  6188 
       
  6189     "Created: / 4.2.2000 / 00:10:48 / cg"
       
  6190 !
       
  6191 
  6128 realize
  6192 realize
  6129     "if any inputFields where added, activate the first one"
  6193     "if any inputFields where added, activate the first one"
  6130 
  6194 
  6131     super realize.
  6195     super realize.
  6132     inputFieldGroup notNil ifTrue:[
  6196     inputFieldGroup notNil ifTrue:[
  6151 accepted
  6215 accepted
  6152     "after the box has closed:
  6216     "after the box has closed:
  6153 	 return true if accepted, false if canceled"
  6217 	 return true if accepted, false if canceled"
  6154 
  6218 
  6155     ^ acceptValue value
  6219     ^ acceptValue value
       
  6220 !
       
  6221 
       
  6222 interfaceSpecFor:aSelector
       
  6223     "return an interface spec.
       
  6224      Notice - Dialog should be moved under AppModel so this becomes obsolete."
       
  6225 
       
  6226     ^ UISpecification from:(self perform:aSelector)
       
  6227 
       
  6228     "Modified: / 3.2.2000 / 23:59:16 / cg"
  6156 !
  6229 !
  6157 
  6230 
  6158 positionOffset
  6231 positionOffset
  6159     "return the delta, by which the box should be displayed
  6232     "return the delta, by which the box should be displayed
  6160      from the mouse pointer. Here, an offset is returned, which
  6233      from the mouse pointer. Here, an offset is returned, which
  6343 ! !
  6416 ! !
  6344 
  6417 
  6345 !DialogBox class methodsFor:'documentation'!
  6418 !DialogBox class methodsFor:'documentation'!
  6346 
  6419 
  6347 version
  6420 version
  6348     ^ '$Header: /cvs/stx/stx/libwidg/DialogBox.st,v 1.143 2000-02-01 11:23:14 cg Exp $'
  6421     ^ '$Header: /cvs/stx/stx/libwidg/DialogBox.st,v 1.144 2000-02-05 14:20:44 cg Exp $'
  6349 ! !
  6422 ! !
  6350 DialogBox initialize!
  6423 DialogBox initialize!