lockLocation top of graphic "line" ??

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

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

Re: lockLocation top of graphic "line" ??

Post by Klaus » Thu Jun 04, 2015 5:13 pm

AHA! :D

I thought he was setting the loc or something...

shawnblc
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 342
Joined: Fri Jun 01, 2012 11:11 pm

Re: lockLocation top of graphic "line" ??

Post by shawnblc » Thu Jun 04, 2015 8:02 pm

jacque wrote:You're creating a graphic with a negative width. Those draw as lines. They used to disappear entirely, so in some ways that's an improvement.

The handler should calculate the actual width for the display bar and then set its position on the graph. Widths have to be positive numbers.
AWE! Makes sense! DUH! :)

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

Re: lockLocation top of graphic "line" ??

Post by dunbarx » Thu Jun 04, 2015 9:22 pm

Hmmm.

Surely Jacque is right about that, but where in the thread is it written that you are setting any widths? I only see setting rights and lefts.

Anyway, if what she has psychically discovered is true, you have your answer.

Craig


EDIT. Oh, I see it now. A field in your stack (not any code) sets the width of the graphic. It is always a good idea to label the functionality of these things.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7393
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: lockLocation top of graphic "line" ??

Post by jacque » Thu Jun 04, 2015 9:37 pm

dunbarx wrote:Oh, I see it now. A field in your stack (not any code) sets the width of the graphic.
I didn't look at the stack, the clue was in this code fragment:

Code: Select all

if tBlue2 < 0  then
     set the right of graphic "bar3" to the left of graphic "Line2"
For example, if the left of "bar3" is currently at 10 and its right is then set to, say, -33, then the width of the graphic will be -22. But a bigger clue was that I've done this myself and I recognized the narrow line. ;)
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

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

Re: lockLocation top of graphic "line" ??

Post by dunbarx » Thu Jun 04, 2015 11:17 pm

Jacque.

I learn that way as well.

But he didn't say that the left of a particular control was 10 and its right was then set at -33, he set the right of one control to the left of a different control. Of course if that field value set the right of a control to a value to the left of its left, it would do just that, make a line.

This only means that you are much more clever than you thought.

Craig

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: lockLocation top of graphic "line" ??

Post by sturgis » Thu Jun 04, 2015 11:23 pm

Actually, setting the right of an object or the left of an object simply moves an existing object and doesn't change its size. Like setting the left of button 1 to the left of this card just moves it to the edge of the card. You would actually have to set the width of the object or change the rect of the object to end up at a negative width.

Having said that, if the line is being created elsewhere (it must be), and set to a negative width, you're still right on the money. Always using abs() when setting up the graphic would solve it easily.

If that is NOT the case, and its working in a group with the locloc set, chances are that the rest of the bar is outside the rect of the group, and thus not showing. An easy way to visually see if this is the case would be to turn on the scrollbars for the group and scroll it around.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7393
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: lockLocation top of graphic "line" ??

Post by jacque » Fri Jun 05, 2015 3:05 am

Urf. I had a thinko. You're all correct of course about setting one side only. I recognized the symptom and my mind short-circuited, connecting "right" to "item 3 of the rect". I need to take myself in for an overhaul.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

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

Re: lockLocation top of graphic "line" ??

Post by dunbarx » Fri Jun 05, 2015 3:26 am

Thinko?

Is that like a brain fart?

Craig

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: lockLocation top of graphic "line" ??

Post by sturgis » Fri Jun 05, 2015 3:54 am

I thought it was like "think or thwim" ThinkO for short.

SparkOut
Posts: 2947
Joined: Sun Sep 23, 2007 4:58 pm

Re: lockLocation top of graphic "line" ??

Post by SparkOut » Fri Jun 05, 2015 7:27 am

Like typo is short for typographical error. Thinko is short for thinkographical error.

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: lockLocation top of graphic "line" ??

Post by sturgis » Fri Jun 05, 2015 2:54 pm

Ok. I'm stealing that. I thinko quite often.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7393
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: lockLocation top of graphic "line" ??

Post by jacque » Fri Jun 05, 2015 3:51 pm

Is that like a brain fart?
Yes, but on a much higher level. :-) I first heard it from our mutual friend Cat back on the HC list when I made a similar slip. I was so taken with it that, like Sturgis, I stole it immediately. And I've been waiting 25 years to use it.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

SparkOut
Posts: 2947
Joined: Sun Sep 23, 2007 4:58 pm

Re: lockLocation top of graphic "line" ??

Post by SparkOut » Fri Jun 05, 2015 7:03 pm

The longhand (thinkographical error) is ever so cromulent.

Post Reply