Option text input area - size too small

7 views
Skip to first unread message

fidian

unread,
Nov 15, 2006, 12:57:19 PM11/15/06
to TiddlyWiki
I am trying to develop a plugin that will let you customize the name of
the backups that are generated. I want only one per day, so I made a
format that saved the files as TiddlyWiki.YYYYMMDD.html. Life is great
so far.

The only problem I have is that I want to use <<option
txtBackupOptionsFormat>> and have the user be able to set his or her
own format. I have the input element showing up just fine and I can
edit it, but it is only a dozen or so characters wide - not nearly long
enough in my opinion. I would like to expand the bar to be at least
50% of the screen, so longer format definitions can be used.

For example, my default format is "%N.%Y%M%D.%h%m%s%n.html", and it
only shows "%N.%Y%M%D.%h" before the text area chops it off. This
minor annoyance wouldn't be too bad, but it looks like the
config.macros.option.onChangeOption() function is changing the text
area - every time I type a character, the input area shows me where the
cursor is (way at the end) and immediately bounces back to the
beginning. The cursor doesn't move - the portion of the shown text is
what changes.

My questions:
1) Can the text area box be enlarged for just this one tiddler and not
all tiddlers? I'm a little rusty with CSS and I didn't dig deep enough
to check this out.
2) Can the refocusing thing be removed somehow?

I am using FireFox 1.0.8 + TiddlyWiki 2.1.3. If you want my
BackupOptionsPlugin tiddler, let me know and I'll stick it on the web
somewhere.

Eric Shulman

unread,
Nov 15, 2006, 1:54:58 PM11/15/06
to TiddlyWiki
> 1) Can the text area box be enlarged for just this one tiddler and not
> all tiddlers? I'm a little rusty with CSS and I didn't dig deep enough
> to check this out.

using http://www.TiddlyTools.com/#InlineJavascriptPlugin, you can
write:

<<option txtBackupOptionsFormat>><script>
place.lastChild.style.width="25em"; // adjust width to suit
</script>

HTH,
-e
Eric Shulman
TiddlyTools / ELS Design Studios

fidian

unread,
Nov 15, 2006, 2:08:07 PM11/15/06
to TiddlyWiki
> > using http://www.TiddlyTools.com/#InlineJavascriptPlugin, you can write:
>
> <<option txtBackupOptionsFormat>><script>
> place.lastChild.style.width="25em"; // adjust width to suit
> </script>

It seems like "bad form" for one plugin to require another plugin to
merely be configured. It kinda works as-is and I would rather not
introduce a dependency that isn't required for the functionality of
mine.

Eric Shulman

unread,
Nov 16, 2006, 1:25:25 AM11/16/06
to TiddlyWiki
> merely be configured. It kinda works as-is and I would rather not
> introduce a dependency that isn't required for the functionality of
> mine.

OK... here's the core solution... using no other plugins...


It turns out that the <<option>> macro takes a SECOND param which can
be used to set the 'size' attribute of the input field.

<<option txtUserName 40>>
(change the 40 to any value you want... the default when omitted is 15)

Note that this does not provide precise control over the size of the
input field, because the rendering of the input field with a 'size'
attribute is browser-specific and seems to vary wildly from platform to
platform. Nonetheless, while not as accurate as CSS, setting this
size param will let you force the field to be bigger than the default.

enjoy,

fidian

unread,
Nov 16, 2006, 10:16:21 AM11/16/06
to TiddlyWiki
On Nov 16, 12:25 am, "Eric Shulman" <elsdes...@gmail.com> wrote:
> It turns out that the <<option>> macro takes a SECOND param which can
> be used to set the 'size' attribute of the input field.
>
> <<option txtUserName 40>>
> (change the 40 to any value you want... the default when omitted is 15)

This does not work for me. I reviewed the
config.macros.option.handler() function for the main TiddlyWiki site
and for TiddlyTools. I didn't find anything that referred to parms[1]
or higher. Is this syntax for a version of TiddlyWiki that is not yet
released on tiddlywiki.com? If so, I will be content and add the
second parameter to the option tag in my plugin and rest easy knowing
that soon it will be supported.

I'm somewhat interested why a style parameter isn't used instead of
just a size parameter. <<option txtUserName "width: 40em">> would seem
to make more sense and allow more flexiblity.

Thanks for the great support I've received on this list.

-- Tyler

Eric Shulman

unread,
Nov 16, 2006, 10:43:12 AM11/16/06
to TiddlyWiki

fidian wrote:
> On Nov 16, 12:25 am, "Eric Shulman" <elsdes...@gmail.com> wrote:
> > <<option txtUserName 40>>

> This does not work for me. I reviewed the
> config.macros.option.handler() function for the main TiddlyWiki site

oops! You are right. This feature is NOT part of the core... it seems
that BidiX's UploadPlugin is redefining the option.handler() to support
type='password' input fields, and ALSO adds the support for the second
param to set the size.

> I'm somewhat interested why a style parameter isn't used instead of
> just a size parameter. <<option txtUserName "width: 40em">> would seem
> to make more sense and allow more flexiblity.

I think that is a fine idea. I will create a ticket to suggest it as a
core enhancement.

In the mean time, you could add this code to your plugin:
setStylesheet(".wideInput input { width:40em;
}","fidianPluginStylesheet");
Then, where you place your checkbox option, you can use:
{{wideInput{<<option txtUserName>>}}}

Of course, you can change the CSS (and the stylesheet ID) to suit your
tastes.

BidiX

unread,
Nov 16, 2006, 11:20:19 AM11/16/06
to Tiddl...@googlegroups.com
On 11/16/06, Eric Shulman <elsd...@gmail.com> wrote:

oops! You are right.  This feature is NOT part of the core... it seems
that BidiX's UploadPlugin is redefining the option.handler() to support
type='password' input fields, and ALSO adds the support for the second
param to set the size.

Yes, Eric you are right. I found useful to tweak the size parameter of options. A small size for username or password but a larger one for url or backup directory. To implement PasswordTweak for managing password in UplaodPlugin, I needed to Hijack the whole core config.macros.option I took advantage to define this parameter.

I think that is a fine idea.  I will create a ticket to suggest it as a
core enhancement.

Thanks, you have my support !

Cheers,

-- BidiX
http://TiddlyWiki.bidix.info
Reply all
Reply to author
Forward
0 new messages