From: Raymond I. <xw...@ya...> - 2003-03-26 22:28:07
|
Hi Everyone, (The views expressed below are my own and are not intented to hurt anyone. I'm just expressing things as I see them in my option) 1) First off - In keeping with naming conventions I would add the prefix btn before buttons (e.g btnUp, btnDown,etc). This is something that I've learned will coding in vb. The truth is this is of little value but it's just my option. 2) The this.KnobListener should not be created inside the constructor. This IMO is a performance hit as the javascript engine will have to create an object and a function for each scrollbar. IMO it should be placed on the prototype of the scrollbar: function scrollbar_light(){ // code here... this.knob.addEventListener(this.KnobListener); }; scrollbar_light.prototype.KnobListener={ // events here }; The same should go for the other events. In this approach the functions and objects are created only once. 3) Instead of reseting the sizes of the buttons by calling setSize inside the allignObjects() functions I would recommend that the setAnchor() function be used. You just set it and forget it: // inside constructor if (this.orientation) { //vertical var al={left:0,right:0}; this.upBTN.setAnchor(al); this.downBTN.setAnchor(al); this.knob.setAnchor(al); }else { //horizontal var al = {top:0,bottom:0}; this.upBTN.setAnchor(al); this.downBTN.setAnchor(al); this.knob.setAnchor(al); } For a very good example of anchoring/strecthing see dynapi.api.dynlayer-anchor-stretching.html and dynapi.api.dynlayer-anchor.html The same can be down for the knob by using the stretchV and stretchH attributes. for example: stretchV:'40%' can be used to stretch the knob '40%' of it's parent width or stretchV:90 will set the knob's height to 90 pixels 3) I've found the scrollbar from dynapi 2.x days to be very difficult to use. I never liked the setRatio() and getRatio() functions. I think the the simplicity of the Visual Basic scrollbar is much prefered than setRatio(). I think the scrollbar should have a setRange(min,man) function that allows me to set a range of values to scroll. I can then use getValue() and setValue() functions to set or get the value of the scrollbar. When I call setValue(v) it will force the scrollbar knob to move to the section where the value can be found. example: hscBar.setRange(0,1000); hscBar.setValue(120); // simulates a user scroll // ^ set knob to value 120 within the range 0-1000 // some code here..... var v = hscBar.getValue(); That's it! Well in summary I think the scrollbar looks good, but I'd like it better if it had arrows :). Since this is the light version I would suggest that you use ←, →, ↑, ↓ or + - to indicate up/down or left/right. Keep up the good work. Best regards. -- Raymond Irving __________________________________________________ Do you Yahoo!? Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop! http://platinum.yahoo.com |