def __init__(self):
        self.sStrings=[["foo0", "bar0", "baz0", "toto0", "tintin0"],
            ["foo1", "bar1", "baz1", "toto1", "tintin1"],
            ["foo2", "bar2", "baz2", "toto2", "tintin2"],
            ["foo3", "bar3", "baz3", "toto3", "tintin3"],
            ["foo4", "bar4", "baz4", "toto4", "tintin4"]]

        self.combo=ListBox()
        self.list=ListBox()
        self.echo=Label()

        self.combo.setVisibleItemCount(1)
        self.combo.addChangeListener(self)
        self.list.setVisibleItemCount(10)
        self.list.setMultipleSelect(True)
        
        for i in range(len(self.sStrings)):
            self.combo.addItem("List " + i)
        self.combo.setSelectedIndex(0)
        self.fillList(0)
        
        self.list.addChangeListener(self)
        
        horz = HorizontalPanel()
        horz.setVerticalAlignment(HasAlignment.ALIGN_TOP)
        horz.setSpacing(8)
        horz.add(self.combo)
        horz.add(self.list)
        
        panel = VerticalPanel()
        panel.setHorizontalAlignment(HasAlignment.ALIGN_LEFT)
        panel.add(horz)
        panel.add(self.echo)
        self.setWidget(panel)
        
        self.echoSelection()
Esempio n. 2
0
 def __init__(self):
     self.fDialogButton = Button("Show Dialog", self)
     self.fPopupButton = Button("Show Popup", self)
     
     panel = VerticalPanel()
     panel.add(self.fPopupButton)
     panel.add(self.fDialogButton)
     
     list = ListBox()
     list.setVisibleItemCount(5)
     for i in range(10):
         list.addItem("list item " + i)
     panel.add(list)
     
     panel.setSpacing(8)
     self.setWidget(panel)