Link text style -- bug or feature ?
gandalf at doctorTimothyMiller.com
Thu Nov 2 21:11:14 EST 2006
Hello Jacque and Mark,
Thanks for your comments.
Okay, it's not a bug. One might have good reason to call it a source of
confusion, though, at least for beginners, or possibly a "room for
I know now how to handle it as a mouseUp, if I want to do that, as Mark
suggests. I had to figure that out by trial and error. The docs are too
cryptic, sometimes, for me, when I'm learning to do something new.
Mark asks why anybody would bother setting the text style of the field
to "link". I might ask in return, if no one would ever bother, then why
is that potentially confusing feature available at all?
In my case, here's why I "bothered to do it at all." Someone told me how
to put a goRevURL handler in the stack script, using the parameter sent
along with the linkClicked message. I pretty much did that by rote. It
seemed like magic, because I didn't really understand the parameter, but
Then I decided I wanted to be able to enter URLs in certain fields in
that stack, using an "ask" dialog, with just a few lines of script, nice
and simple. So I figured if I set the textstyle of the field containing
the URLs, to "link" I'd be good to go.
What made me crazy was that, in some cases, at some point in the past,
or perhaps by accident, I had selected text in some of these fields and
set the textStyle to link. In other cases I hadn't. The textstyle of the
field was also set to "link." These were background fields, so various
fields on various cards worked (opened the browser and navigated to the
URL), or didn't, (depending on whether I had manually selected the text,
and set the style of the selected text to "link") even though the links
all looked the same, and the text style appeared to be "link" in all cases.
Mark uses the analogy of setting textStyle to Bold, either at the level
of text or field. It's not a good analogy. If I set the style of some
text to bold, I don't expect it to *do* anything differently. It only
*looks* different. It looks the same whether it's set to bold at the
text level or the field level.
Setting the textStyle to link is rather a different matter, because the
text behaves differently when clicked, and also depends on whether it's
done at the field level, or at the text level.
Now that I understand these issues, and figured out the difference
between the linkClicked parameter and the mouseChunk function along the
way, it doesn't seem hard. But I didn't enjoy figuring it out by trial
and error, and I wish I had those hours back.
Am I overlooking some non-cryptic version of the documentation that
would have explained the foregoing to me, without having to start over
in xtalk kindergarten?
J. Landman Gay wrote:
> Timothy Miller wrote:
>> This arises from a question I asked on the forum, then solved on my
>> own, by trial and error.
>> If I set the textstyle of a field to "link," by script or manually,
>> text entered into that field looks like a link. It's blue and
>> underlined. However, it doesn't act like a link. When clicked it
>> sends a mouseUp, not a linkClicked. If I select the text, the "text"
>> menu has a checkmark by "Plain," not by "Link"
> This is the difference between field-level settings and
> character-level settings. If you set the default style of a field, any
> text you put into that field will inherit the style. But the text
> itself doesn't have any style; the appearance of the text is just
> reflecting the style of its owner, the field.
> Text in a styled field can also have its own style. Character-level
> styling overrides any field text styles.
>> If I select the text, the "text" menu has a checkmark by "Plain,"
> > not by "Link"
> Because the text has no style of its own yet, it only has inherited
> style. If you select the field with the edit tool, rather than
> selecting the text inside the field with the browse tool, the
> inspector will show the default style setting of the field.
> To make a link, Rev requires actual linked text at the character
> level. Since the text itself has no style in this case, and the field
> is locked, you are getting the normal mouseUp message instead of
> To get a linkClicked message, assign the style to the text characters
> themselves. If you set the style of char 1 to -1 of the field to
> "link" you will get what you expect. (This is the same as dragging
> over the text and selecting the style from the menu.)
More information about the Use-livecode