set a graphic effects on only one line of field

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
problème
Posts: 77
Joined: Fri Oct 23, 2015 12:03 am

set a graphic effects on only one line of field

Post by problème » Mon Nov 23, 2015 7:03 pm

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"

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10331
Joined: Wed May 06, 2009 2:28 pm

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

Post by dunbarx » Mon Nov 23, 2015 7:06 pm

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

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

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

Post by Klaus » Mon Nov 23, 2015 7:06 pm

Yes, this only works for objects and not for text chunks.

problème
Posts: 77
Joined: Fri Oct 23, 2015 12:03 am

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

Post by problème » Mon Nov 23, 2015 8:46 pm

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

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10331
Joined: Wed May 06, 2009 2:28 pm

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

Post by dunbarx » Mon Nov 23, 2015 10:16 pm

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

problème
Posts: 77
Joined: Fri Oct 23, 2015 12:03 am

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

Post by problème » Mon Nov 23, 2015 10:34 pm

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

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4172
Joined: Sun Jan 07, 2007 9:12 pm

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

Post by bn » Tue Nov 24, 2015 12:03 am

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

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10331
Joined: Wed May 06, 2009 2:28 pm

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

Post by dunbarx » Tue Nov 24, 2015 3:48 am

Bernd.

Yipes.

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

Craig

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4172
Joined: Sun Jan 07, 2007 9:12 pm

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

Post by bn » Tue Nov 24, 2015 9:53 am

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 6823 times
GraphicEffectsForText.livecode.zip
shows graphic effects on non-opaque fields
(1.63 KiB) Downloaded 249 times
Kind regards
Bernd

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10052
Joined: Sat Apr 08, 2006 7:05 am
Contact:

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

Post by FourthWorld » Tue Nov 24, 2015 7:17 pm

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.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10331
Joined: Wed May 06, 2009 2:28 pm

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

Post by dunbarx » Tue Nov 24, 2015 9:46 pm

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

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4172
Joined: Sun Jan 07, 2007 9:12 pm

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

Post by bn » Tue Nov 24, 2015 10:04 pm

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

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10331
Joined: Wed May 06, 2009 2:28 pm

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

Post by dunbarx » Tue Nov 24, 2015 11:41 pm

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

Post Reply