Just wondering if anyone has already created an open-source license "spinner" control in Prototype. An demo of a spinner control is here: http://download.dojotoolkit.org/release-0.3.1/dojo-0.3.1-widget/tests/widget/test_Spinner.html And source here: http://trac.dojotoolkit.org/browser/trunk/src/widget/html/Spinner.js?rev=4268 If not, I''ll try making one and report back. Thanks, Ken Snyder --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Yeah, I put one together. It''s attached in as a 7-zip archive. If you don''t have 7-zip you can download it free online or let me know and I can put it in a different archive for you. Interestingly, I''ve always referred to such widgets as numeric counters. - Dash - Ken Snyder wrote:> Just wondering if anyone has already created an open-source license > "spinner" control in Prototype. > > An demo of a spinner control is here: > http://download.dojotoolkit.org/release-0.3.1/dojo-0.3.1-widget/tests/widget/test_Spinner.html > > And source here: > http://trac.dojotoolkit.org/browser/trunk/src/widget/html/Spinner.js?rev=4268 > > If not, I''ll try making one and report back. > > Thanks, > > Ken Snyder > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Dash, I''d be interested to see a working example of your spinner. TAG On Jul 13, 2007, at 8:01 AM, David Dashifen Kees wrote:> Yeah, I put one together. It''s attached in as a 7-zip archive. If > you > don''t have 7-zip you can download it free online or let me know and I > can put it in a different archive for you. Interestingly, I''ve always > referred to such widgets as numeric counters. > > - Dash - > > Ken Snyder wrote: >> Just wondering if anyone has already created an open-source license >> "spinner" control in Prototype. >> >> An demo of a spinner control is here: >> http://download.dojotoolkit.org/release-0.3.1/dojo-0.3.1-widget/ >> tests/widget/test_Spinner.html >> >> And source here: >> http://trac.dojotoolkit.org/browser/trunk/src/widget/html/ >> Spinner.js?rev=4268 >> >> If not, I''ll try making one and report back. >> >> Thanks, >> >> Ken Snyder--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
My bad. I didn''t realize that my old archive contained only the necessary PHP file (which was really an HTML file) and not the images. This new archive is the one people should use. I also commented the code pretty extensively to help understanding. Note, that this current code doesn''t really degrade all that well if javascript isn''t available because the buttons will still be there. If you wanted a true progressive enhancement off of a normal input field, you''d want to create and place the two <div> elements which are the counter''s buttons via JavaScript so that they don''t appear to those that can''t use them. This isn''t really that hard to do, but if anyone wants more explanation, let me know and I''ll work it up. - Dash - Tom Gregory wrote:> Dash, > > I''d be interested to see a working example of your spinner. > > > TAG > > On Jul 13, 2007, at 8:01 AM, David Dashifen Kees wrote: > > >> Yeah, I put one together. It''s attached in as a 7-zip archive. If >> you >> don''t have 7-zip you can download it free online or let me know and I >> can put it in a different archive for you. Interestingly, I''ve always >> referred to such widgets as numeric counters. >> >> - Dash - >> >> Ken Snyder wrote: >> >>> Just wondering if anyone has already created an open-source license >>> "spinner" control in Prototype. >>> >>> An demo of a spinner control is here: >>> http://download.dojotoolkit.org/release-0.3.1/dojo-0.3.1-widget/ >>> tests/widget/test_Spinner.html >>> >>> And source here: >>> http://trac.dojotoolkit.org/browser/trunk/src/widget/html/ >>> Spinner.js?rev=4268 >>> >>> If not, I''ll try making one and report back. >>> >>> Thanks, >>> >>> Ken Snyder >>> > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
I really liked the functionality of the dojo spinner control example, so I went ahead and did my own. Demo and source here: http://kendsnyder.com/sandbox/Spinner/demo.1.0.html It uses mousedown to allow continuous incrementing which speeds up over time. It also implements keydown to allow up and down arrow control while focused on the input. The trickiest part was accounting for a case that even the dojo example didn''t address: keyup doesn''t get fired on the up or down element if you make a drag action outside of the element. This is solved by attaching an additional mouseout event that also stops the incrementing. -- Ken Snyder --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
I didn''t peek at the code (much), but the demo was very nice. I preferred it to a handful of others that I''ve tried. I can think of a couple of situations where it might come in handy. I can think of only a few things I would change: - Allow interval to be a function (accepts attributes currentValue and op =up|down|reset) to allow for odd patterns (powers of two, Fibonacci, exponential growth, whatever). - Does it fire onChange observers? - (Personal preference), move the up/down ids into the options rather than be their own parameters. Create them if not specified. - Allow "power" intervals (maybe this goes along with the function idea), where the interval is different if the shift or meta key is held down. TAG On Jul 15, 2007, at 9:27 PM, Ken Snyder wrote:> > I really liked the functionality of the dojo spinner control > example, so > I went ahead and did my own. Demo and source here: > > http://kendsnyder.com/sandbox/Spinner/demo.1.0.html > > It uses mousedown to allow continuous incrementing which speeds up > over > time. It also implements keydown to allow up and down arrow control > while focused on the input. > > The trickiest part was accounting for a case that even the dojo > example > didn''t address: keyup doesn''t get fired on the up or down element > if you > make a drag action outside of the element. This is solved by > attaching > an additional mouseout event that also stops the incrementing. > > -- Ken Snyder > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Tom Gregory wrote:> I didn''t peek at the code (much), but the demo was very nice. I > preferred it to a handful of others that I''ve tried. I can think of a > couple of situations where it might come in handy. >Yah. In my current app, the goal is to allow certain forms to be filled out without using a keyboard so a spinner works well in many situations.> I can think of only a few things I would change: > - Allow interval to be a function (accepts attributes currentValue > and op =up|down|reset) to allow for odd patterns (powers of two, > Fibonacci, exponential growth, whatever). >Interesting. Right now you would have to overwrite the updateValue() function on the instance which only get''s passed 1, 0, or -1 depending on the direction.> - Does it fire onChange observers? >It fires onIncrement, onDecrement, onStop, afterUpdate. There isn''t a true onChange because the updateValue() function doesn''t check if the value actually changed. I pictured the first two being used to set the button to a "depressed" state. I pictured onStop unsetting the "depressed" state or calling an onBlur-type function. I pictured the afterUpdate function applying some type of additional formatting or processing beyond the optional prefix and suffix. What would you do onChange?> - (Personal preference), move the up/down ids into the options rather > than be their own parameters. Create them if not specified. >Yah, not my preference... as the demo shows, there are many ways you might want it to look. dojo goes as far as to download a separate html template from the server--yuck.> - Allow "power" intervals (maybe this goes along with the function > idea), where the interval is different if the shift or meta key is > held down. >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---