On 11/6/06, Ashish Agrawal <[EMAIL PROTECTED]> wrote: > > Hi all, > > I have created a ColorPicker using pure MochiKit. It turned out fine. I > am so surprise with ease to use MochiKit. I am completely newbie to JS > and MochiKit but when I start with MochiKit I found my self writing > like pro. Great documentation helped me to resolve each problem I > faced. > > Both script and example are available at > http://www.agrawalinfotech.com/Resources/tabid/57/Default.aspx > > I request JS pros to look at my script and help me to get it more > optimized and perfect. > > One problem I like to share with everyone. I had code like > > OC.Controls.ColorPicker = { > /// lots of code here > // I think these are kind of statics > register: function() > { > //register code here > }, > unregister: function() > { > //UnRegister code here > } > }; > > OC.Controls.ColorPicker = function(imgId, txtId) > { > this.__init__(imgId, txtId); > }; > > OC.Controls.ColorPicker.prototype = { > __init__ : function(imgId, txtId) > { > OC.Controls.ColorPicker.register(this); /// this is not > available > } > }; > > > As you can see in above code I am not able to call > OC.Controls.ColorPicker.register(this) > form __init__ method in ColorPicker.prototype. > > I am not able to resolve this issue. However I renamed top static > method code namespace with > OC.Controls.ColorPickerStatic and used > OC.Controls.ColorPickerStatic.register(this), and now > it is working fine I am not sure what cause this issue. > > Please help me to understand this so I can write things much better > next time.
That code will work perfectly fine, if you add arguments to "register" and "unregister". The problem you experienced must be elsewhere, it doesn't exist in the example you've posted. -bob --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "MochiKit" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/mochikit?hl=en -~----------~----~----~----~------~----~------~--~---
