Page 1 of 1

set a graphic effects on only one line of field

Posted: Mon Nov 23, 2015 7:03 pm
by problème
Hello,

I would like to know how to set a graphic effect but on only one line, i tried to do this but don't work

Code: Select all

 set the dropShadow["color"] of line 2 of field "field" to "255,255,0"

Re: set a graphic effects on only one line of field

Posted: Mon Nov 23, 2015 7:06 pm
by dunbarx
Probleme.

You cannot set the "dropShadow" property to a line of text. This applies only to objects. Obviously this does not throw an error, but also has no effect. Try it on a button.

What are you trying to do?

Craig Newman

Re: set a graphic effects on only one line of field

Posted: Mon Nov 23, 2015 7:06 pm
by Klaus
Yes, this only works for objects and not for text chunks.

Re: set a graphic effects on only one line of field

Posted: Mon Nov 23, 2015 8:46 pm
by problème
I try to put the same effect that dropShadow with a color "yellow" and browse his opacity between 127 and 255 on only line of my field.
Because when i press arrow key "up" or "down" the elements in the fields move one positons and the second line of my field is the elements chosen

Re: set a graphic effects on only one line of field

Posted: Mon Nov 23, 2015 10:16 pm
by dunbarx
Hi.

You may have to make your own here, unless the "borderColor" can help you, but that only works with text style "box".

But it would be a fun project to make a graphic that looks like what you want, and does what you want, that is, track the line designated by the user. Do you need help with this?

Craig

Re: set a graphic effects on only one line of field

Posted: Mon Nov 23, 2015 10:34 pm
by problème
i found a solution as I have a small number of elements (<= 5), i create a field for each elements and i put them in line 1 of each fields. Now i can use dropShadow.
Thanks for the helps

Re: set a graphic effects on only one line of field

Posted: Tue Nov 24, 2015 12:03 am
by bn
Hi problème,

did you try to turn off "opaque" of the field in the Properties Inspector? Then it will put the dropShadow on the text of the field instead of the field itself. Looks nice.

Kind regards

Bernd

Re: set a graphic effects on only one line of field

Posted: Tue Nov 24, 2015 3:48 am
by dunbarx
Bernd.

Yipes.

Is this an undocumented feature? Both the dropShadow and the shadowColor are ostensibly only for objects.

Craig

Re: set a graphic effects on only one line of field

Posted: Tue Nov 24, 2015 9:53 am
by bn
Hi Craig,

I don't know if it is an unsupported feature but it works like this forever. You can use it to make nice effects on text in certain situations.

Oh, all of the graphic effects work on text.

Have a look:
innerShadowOnText.png
innerShadowOnText.png (6.67 KiB) Viewed 6841 times
GraphicEffectsForText.livecode.zip
shows graphic effects on non-opaque fields
(1.63 KiB) Downloaded 250 times
Kind regards
Bernd

Re: set a graphic effects on only one line of field

Posted: Tue Nov 24, 2015 7:17 pm
by FourthWorld
dunbarx wrote:Is this an undocumented feature? Both the dropShadow and the shadowColor are ostensibly only for objects.
You're both right: Bernd's example shows how graphic effects will render for field text instead of field borders when the field object is transparent, but as you noted graphic effects apply to the object as a whole, rather than specific chunks of text within the field, so valuable as Bernd's example is for other circumstances it won't help tasks where a graphic effect is needed for a subset of text within a field.

Re: set a graphic effects on only one line of field

Posted: Tue Nov 24, 2015 9:46 pm
by dunbarx
Richard.

Right.

The OP wanted to "track" individual lines, I suppose as a "hilite" of some kind for lines of interest.

So Probleme, you still have to likely create a graphic of some kind that has the look and feel you want, and then "place" that graphic over the line of interest. As I said, this should be fun...

Craig

Re: set a graphic effects on only one line of field

Posted: Tue Nov 24, 2015 10:04 pm
by bn
Hi Craig,

I only suggested the dropShadow approach after the OP said he had split the 5 lines of his text into 5 fields.

I am well aware that you can not apply a dropShadow to a chunk of text.

What you can do with this technique however is to blur a part of the text when you take a snapshot from the formattedRect of your chunk and place it as e.g. imageSource into your text, replacing the "blackened" text and keeping the original text in metadata or somewhere else. Etc.

And I use it in a ButtonMaker to give the text just a little more depth with an outershadow that is the inverse of the text color. i.e. textcolor black/white outer shadow.

It is just a curiosity, not more and not less.

Kind regards
Bernd

Re: set a graphic effects on only one line of field

Posted: Tue Nov 24, 2015 11:41 pm
by dunbarx
Bernd.

Interesting stuff.

I think that five fields is inelegant and certainly not robust. Though a traveling drop shadow graphic is a kluge.

Kluge. Inelegance. Which to choose...

Craig