list chooser with default?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

list chooser with default?

Gary Peterson-2
Hello All,
 
Anyone have a doit for a simple list chooser that will *default* to an item (first is okay). Just want to avoid clicking when rarely needed.
 
Don't need a button list / just vanilla labels list.
 
 "Dialog
  choose: 'Which one do you want?'
  fromList: #('first' 'second' 'third' 'fourth') values: #(1 2 3 4) 
   ...
    ?
 
thx,
 
Gary

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: list chooser with default?

Steven Kelly
We built a subclass of SimpleDialog with a selectionIndex instance variable, and override:
 
addList: model lines: maxLines validation: valid
   selectionIndex notNil ifTrue: [model selectionIndex: selectionIndex].
   ^super addList: model lines: maxLines validation: valid
 
Call like this:
 
dialog := SimpleDialog2 new.
dialog selectionIndex: (valueColl identityIndexOf: selectedObject ifAbsent: []).
lines := valueColl size + 1 min: Screen default bounds height // 3 // SequenceView defaultGrid.
^dialog
   choose: promptString
   fromList: stringColl
   values: valueColl
   buttons: #()
   values: #()
   lines: lines
   cancel: nil
   for: nil


From: [hidden email] on behalf of Gary Peterson
Sent: Sat 30/11/2013 22:00
To: [hidden email]
Subject: [vwnc] list chooser with default?

Hello All,
 
Anyone have a doit for a simple list chooser that will *default* to an item (first is okay). Just want to avoid clicking when rarely needed.
 
Don't need a button list / just vanilla labels list.
 
 "Dialog
  choose: 'Which one do you want?'
  fromList: #('first' 'second' 'third' 'fourth') values: #(1 2 3 4) 
   ...
    ?
 
thx,
 
Gary

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc