--- a/DialogBox.st Thu Feb 29 12:55:15 1996 +0100
+++ b/DialogBox.st Thu Feb 29 14:38:07 1996 +0100
@@ -2604,26 +2604,71 @@
"Modified: 22.2.1996 / 15:40:54 / cg"
!
-addListBoxOn:aModel withNumberOfLines:numLines
+addListBoxOn:aModel class:aListViewClass withNumberOfLines:numLines hScrollable:hs vScrollable:vs
"add a selectionInListView to the box.
The list has numLines (if nonNil) number of lines shown."
- |l scr h|
-
- l := SelectionInListView new.
+ |l scr h dH|
+
+ l := aListViewClass new.
l model:aModel.
l doubleClickAction:[:name | self okPressed].
- scr := ScrollableView forView:l.
+
+ vs ifTrue:[
+ hs ifTrue:[
+ scr := HVScrollableView forView:l miniScrollerH:true .
+ ] ifFalse:[
+ scr := ScrollableView forView:l
+ ].
+ scr resize.
+"/ Transcript show:scr height; show:' '; showCr:l height.
+ dH := scr height - l height.
+ ] ifFalse:[
+ l level:-1.
+ scr := l.
+ dH := 0.
+ ].
numLines notNil ifTrue:[
h := l heightForLines:numLines.
] ifFalse:[
h := l preferredExtent y
].
- self addComponent:scr withHeight:h.
+ self addComponent:scr withHeight:(h + dH).
^ l
"
+ |dialog listView|
+
+ dialog := DialogBox new.
+ (dialog addTextLabel:'select any') adjust:#left.
+
+ listView := dialog
+ addListBoxOn:nil
+ class:FileSelectionList
+ withNumberOfLines:10
+ hScrollable:false
+ vScrollable:false.
+
+ listView directory:'/etc'.
+
+ dialog addAbortButton; addOkButton.
+ dialog open.
+
+ dialog accepted ifTrue:[Transcript show:'selection is:'; showCr:listView selectionValue].
+ "
+
+ "Created: 22.2.1996 / 15:40:07 / cg"
+ "Modified: 22.2.1996 / 15:41:25 / cg"
+!
+
+addListBoxOn:aModel withNumberOfLines:numLines
+ "add a selectionInListView to the box.
+ The list has numLines (if nonNil) number of lines shown."
+
+ ^ self addListBoxOn:aModel withNumberOfLines:numLines hScrollable:false vScrollable:true.
+
+ "
|dialog model listView|
model := SelectionInList new.
@@ -2645,6 +2690,57 @@
"Modified: 22.2.1996 / 15:41:25 / cg"
!
+addListBoxOn:aModel withNumberOfLines:numLines hScrollable:hs vScrollable:vs
+ "add a selectionInListView to the box.
+ The list has numLines (if nonNil) number of lines shown."
+
+ ^ self
+ addListBoxOn:aModel
+ class:SelectionInListView
+ withNumberOfLines:numLines
+ hScrollable:hs
+ vScrollable:vs
+
+ "
+ |dialog model listView|
+
+ model := SelectionInList new.
+ model list:#('one' 'two' 'three' 'four').
+ model selectionIndex:2.
+
+ dialog := DialogBox new.
+ (dialog addTextLabel:'select any') adjust:#left.
+
+ listView := dialog addListBoxOn:model withNumberOfLines:3 hScrollable:true vScrollable:true.
+
+ dialog addAbortButton; addOkButton.
+ dialog open.
+
+ dialog accepted ifTrue:[Transcript show:'selection is:'; showCr:model selection].
+ "
+
+ "
+ |dialog model listView|
+
+ model := SelectionInList new.
+ model list:#('one' 'two' 'three' 'four').
+ model selectionIndex:2.
+
+ dialog := DialogBox new.
+ (dialog addTextLabel:'select any') adjust:#left.
+
+ listView := dialog addListBoxOn:model withNumberOfLines:3 hScrollable:false vScrollable:false.
+
+ dialog addAbortButton; addOkButton.
+ dialog open.
+
+ dialog accepted ifTrue:[Transcript show:'selection is:'; showCr:model selection].
+ "
+
+ "Created: 22.2.1996 / 15:40:07 / cg"
+ "Modified: 22.2.1996 / 15:41:25 / cg"
+!
+
addOkButton
"create an okButton - to be sent from redefined initialize
methods in subclasses or when creating a box programmatically.
@@ -3551,5 +3647,5 @@
!DialogBox class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg/DialogBox.st,v 1.49 1996-02-28 14:23:12 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg/DialogBox.st,v 1.50 1996-02-29 13:38:07 ca Exp $'
! !