From: Bill W. <bil...@us...> - 2000-12-05 15:38:52
|
One of the reasons I saw was that there was no oncreate being captured by the Label, only onresize. In the Button object, (assuming text was passed to it), the first thing is does is to call its own 'setText' method which eventually makes it down to the dynlayer's setSize method, which invokes the resize event, which is being captured by the label. The onresize handler gets the ContentWidth and ContentHeight which, since it has not been created yet, is still at null. This makes the coverlyr's width and height, 0 and 0. What I did was to give the label an oncreate method: listener.oncreate = function(e) { o = e.getTarget() o.setText(text) o.pack() if(o.hasCover){ o.coverlyr.setSize(o.w,o.h) } } Likewise, I changed the Button object's setText method to (if it wasn't that way to begin with, I'd have to look back): Button.prototype.setText = function(text) { if (this.label==null) { this.label = this.addChild(new Label(arguments[0])) this.label.setSelectable(false) } else { this.label.setText(text) this.label.packWidth() } } Lastly, I added these lines to the first part of Button's recenter method: if (this.label.hasCover){ this.label.coverlyr.setSize(this.w,this.h) }else{ this.label.addCover(this.w, this.h) } That way, the text is set and the label is added when the button is instanciated, the label is added when the button is created, now its size is known, and therefore, the label size can be set. This is kludgy to me, and it was only to get the Button object to work right. But I think the answer may just lie in making a proper oncreate handler for the label. If you want, I can attach my modified label.js and button.js files. I saw what you did with the Button, that is, it will take either text or an image, and thought I would apply the idea to a slide out menu widget I'm making. Now, my widget will take a string, a Button, or a CoreGridButton (which I also had to make work with the new core). I love that CoreGridButton. Domino has something similar. Speaking of Domino, If there are any other domino developers out there, I have managed to port DynAPI into a Domino database. pretty easy, but then it was only DynAPI 1 which was a lot flatter than this version. Now I can do things like having having dynamic forms, views, agents, etc. that I can submit back to the server for processing, and get responses back. Dan Steinman <dy...@fu...> wrote: > The only reason "add cover" was in the original Label was to prevent the text from being selectable. A layer covering the text is one solution, however this can/should be accomplished with event handling. As far as I can tell setSelectable() works perfectly fine in Netscape. It cancels the mouse down event and stops selecting of the test. There must be an equivalent IE method to do the same. > > I'd prefer having the method called "setSelectable" only because it makes more sense of what it accomplishes. > > Dan > > > On Mon, Dec 04, 2000 at 09:36:50PM -0500, Robert Rainwater wrote: > > > > I'm sure this has been mentioned before but here it goes again. > > > > The addCover method does not seem to work. When used, there is no > > change in IE 5. Also, what is the purpose of setSelectable versus > > addCover. In the label example it says that 2 of the labels have a > > cover, but there is no call to addCover, but there is one to > > setSelectable(). This seems like an error to me. > > > > -- > > // Robert Rainwater > > > > > > _______________________________________________ > > Dynapi-Dev mailing list > > Dyn...@li... > > http://lists.sourceforge.net/mailman/listinfo/dynapi-dev > _______________________________________________ > Dynapi-Dev mailing list > Dyn...@li... > http://lists.sourceforge.net/mailman/listinfo/dynapi-dev ____________________________________________________________________ Get free email and a permanent address at http://www.netaddress.com/?N=1 |