From: Richard B. <ma...@ri...> - 2001-04-18 23:33:28
|
You can only alter the CSS properties once the layer has been written to the document. Maybe if you add them after this o.addChild(o.list) o.addChild(o.label) o.addChild(o.button) o.list.css etc... it would work alright. - I assume o has been added to the doc at this point. Richard. ----- Original Message ----- From: "Ben Empson" <ben...@ea...> To: <dyn...@li...> Sent: Thursday, April 19, 2001 1:26 AM Subject: Re: [Dynapi-Widgetdev] Select list widget > Hmm, I tried what you said, but got the error 'label.css is null or not an > object'. I don't understand! The line that throws the error is > 'o.label.css.padding="3px"'. > > 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(233) > o.label.setHeight(25) > o.label.setHTML('<b>Click to expand list</b>') > > o.label.css.padding="3px" > o.label.css.borderWidth="2px" > o.label.css.borderColor="black" > o.label.css.borderStyle="solid" > > 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",10) > o.list.add("Item Two",20) > o.list.add("Item Three",30) > o.list.add("Item Four",'test') > > o.button = new DynLayer(null,233,0,17,25) > o.button.imgUp = new Image() > o.button.imgUp.src = > '../dynapi2_51/dynapi/src/lib/dynapi/images/scrollpane/arrowdn0.gif' > o.button.imgDn = new Image() > o.button.imgDn.src = > '../dynapi2_51/dynapi/src/lib/dynapi/images/scrollpane/arrowdn1.gif' > o.button.setBgImage(o.button.imgUp.src) > > o.addChild(o.list) > o.addChild(o.label) > o.addChild(o.button) > > o.button.events = new EventListener(o.button) > o.button.events.onmousedown=function(e){ > o.button.setBgImage(o.button.imgDn.src) > } > > o.button.events.onmouseup=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.button.setBgImage(o.button.imgUp.src) > } > o.button.addEventListener(o.button.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 } > > > > _______________________________________________ > Dynapi-Widgetdev mailing list > Dyn...@li... > http://lists.sourceforge.net/lists/listinfo/dynapi-widgetdev > |