Spin button

15 views
Skip to first unread message

FrD

unread,
Feb 16, 2011, 12:33:03 PM2/16/11
to TiddlyWiki
Hello,

I'm using form elements in a TW of mine.
I'd like to use a "spin button" instead of a "select" (with a drop
down list like 1 2 3 4 ...).

Does anybody know of the source code for a very simple spin button
usable in a TW ?
(By very simple I mean no acceleration or elaborate behaviours)
Maybe with the core functions like createTiddlyElement, ... or a
simple code I could translate with core functions.

Thanks

FrD

Tobias Beer

unread,
Feb 16, 2011, 12:36:41 PM2/16/11
to TiddlyWiki
I don't know of any such thing in existence. Would you have an example
for what precisely you mean? ...preferably in the form an
implementation based on html/js.

Cheers, Tobias.

FrD

unread,
Feb 16, 2011, 12:53:05 PM2/16/11
to TiddlyWiki

Tobias Beer

unread,
Feb 16, 2011, 3:19:19 PM2/16/11
to TiddlyWiki
In what context do you want to use this form? Do you want to send its
information or save it to a tiddler, etc.?

I guess for an implementation of such a control one would...
a) define a placeholder for each such control in the respective form
by giving it a specific class
b) invoke a macro - or simply js code - after the form has been
rendered, which...
- based on the class information identifies the form element(s)
- creates the missing spin controls and initializes their values
- assigns the control functions to any of them
c) read the value from the input element(s) related to such controls
and...
- send it
- write it to a tiddler field
- etc...

Sounds like a doable thing, esp. with the code you've provided in your
link [1]. But, do you think it's worth the effort, considering the
length of the codebits that would accumulate even through the quite
straight forward example you've provided?

In other words: What's the usecase in which you think this kind of
control spins a whole lot better than - say - a dropdown or a mere
text input? At least, the one situation where I would actually use
such a control instead of using my keyboard is when I wanted to simply
increment a value by 1... which could easily be done with a button
before the input that reads [-] and one behind it that reads [+].

Cheers, Tobias.

[1] http://www.switchonthecode.com/tutorials/javascript-controls-the-spin-control

FrD

unread,
Feb 16, 2011, 4:09:12 PM2/16/11
to TiddlyWiki
Hello,

You're right it's probably not worth the work !
It was just in order to have a more user-friendly interface.
But your idea is good. I'll try with an input control and two buttons
for increment and decrement.

I'll post a TW with my code.

Thanks for taking the time to have a look and for your reflexions.

FrD

On 16 fév, 21:19, Tobias Beer <beertob...@googlemail.com> wrote:
> In what context do you want to use this form? Do you want to send its
> information or save it to a tiddler, etc.?
> ...
>
> Cheers, Tobias.
>
> [1]http://www.switchonthecode.com/tutorials/javascript-controls-the-spin...
Reply all
Reply to author
Forward
0 new messages