# Not Based on iwidgets version.
class SelectionDialog(Pmw
.Dialog
):
# Dialog window with selection list.
# Dialog window displaying a list and requesting the user to
def __init__(self
, parent
= None, **kw
):
# Define the megawidget options.
('borderx', 10, INITOPT
),
('bordery', 10, INITOPT
),
self
.defineoptions(kw
, optiondefs
)
# Initialise the base class (after defining the options).
Pmw
.Dialog
.__init
__(self
, parent
)
interior
= self
.interior()
('listbox', 'scrolledlist_listbox'),
('label', 'scrolledlist_label'),
self
._list
= self
.createcomponent('scrolledlist',
Pmw
.ScrolledListBox
, (interior
,),
dblclickcommand
= self
.invoke
)
self
._list
.pack(side
='top', expand
='true', fill
='both',
padx
= self
['borderx'], pady
= self
['bordery'])
if not kw
.has_key('activatecommand'):
# Whenever this dialog is activated, set the focus to the
# ScrolledListBox's listbox widget.
listbox
= self
.component('listbox')
self
.configure(activatecommand
= listbox
.focus_set
)
# Check keywords and initialise options.
# Need to explicitly forward this to override the stupid
# (grid_)size method inherited from Tkinter.Toplevel.Grid.
return self
.component('listbox').size()
# Need to explicitly forward this to override the stupid
# (grid_)bbox method inherited from Tkinter.Toplevel.Grid.
return self
.component('listbox').size(index
)
Pmw
.forwardmethods(SelectionDialog
, Pmw
.ScrolledListBox
, '_list')