From: Ben E. <ben...@ea...> - 2001-04-18 21:55:41
|
OK, I answered my own question (do o.addChild(o.label) before o.addChild(o.list)). Next question - I can't work out how the borders are put around the list items. Is there an argument to DynLayer that adds borders automatically? I can't find anything. Cheers, Ben -------------code start-------------- function selectList(title) { this.superClass=DynLayer this.superClass() this.id="selectList"+(selectList.Count++) this.moveTo(100,100) this.setSize(500,350) //this.setBgColor('black') var l=new EventListener(this) l.oncreate=function(e) { var o=e.getTarget() o.label = new Label('') o.label.moveTo(0,0) o.label.setBgColor('#eeeeee') o.label.setWidth(250) o.label.setHeight(25) o.label.setHTML('<b>Click to expand list</b>') o.list = new List() o.list.moveTo(0,-75) o.list.setWidth(250) o.list.setBgColor('#000000') o.list.boldOnSelect(true) o.list.add("Item One",1) o.list.add("Item Two",2) o.list.add("Item Three",3) o.list.add("Item Four",4) o.addChild(o.list) o.addChild(o.label) o.label.events = new EventListener(o.label) o.label.events.onmousedown=function(e){ if (!o.list.open) { o.list.slideTo(0,25,20,5) o.list.open=true } else { o.list.slideTo(0,-75,20,5) o.list.open=false } } o.label.addEventListener(o.label.events) o.list.events = new EventListener(o.list) o.list.events.onselect=function(e){ o.label.setHTML(o.list.getSelectedItem().getHTML()) o.list.slideTo(0,-75,20,5) o.list.open=false } o.list.addEventListener(o.list.events) } this.addEventListener(l) return this } selectList.Count=0 selectList.prototype=new DynLayer() selectList.prototype.getSubClass=function() { return button } |