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

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

lockLocation top of graphic "line" ??

Post by shawnblc » Wed Jun 03, 2015 5:40 pm

I'm trying to anchor bar1 to the top of graphic line. The below isn't working, any help is appreciated. Thanks.

Code: Select all

   set the lockLocation of graphic "bar1" to true
   set the lockLocation of graphic "bar1" to the top of graphic "line"

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

Re: lockLocation top of graphic "line" ??

Post by dunbarx » Wed Jun 03, 2015 6:02 pm

Hi.

There is a really big difference between the "lockLocation", which determines whether a control can be moved, and any of the properties which define the extents of a control and their position on the card. Long winded, I know.

Try this:

set the top of graphic "bar1" to the top of graphic "line"

Craig Newman

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

Re: lockLocation top of graphic "line" ??

Post by Klaus » Wed Jun 03, 2015 6:05 pm

Hi shawn,

this (your second line) not works in any case! 8)

"the lockloc" is a BOOLEan value and can be TRUE or FALSE!
Read up the dictionary to see the meaning of "locklocation" (lockloc).

What exactly are you trying to achieve? You cannot "anchor" any objects at all in LC!
Maybe you can group the 2 graphics? That is as close as you can get to "anchoring" :D


Best

Klaus

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 » Wed Jun 03, 2015 6:23 pm

Thanks klaus and dunbarx. Here's what I have now and it seems to be working, I'll continue testing.

Code: Select all

   set the bottom of graphic "bar1" to the top of graphic "line" +2
Update: edited.
Last edited by shawnblc on Wed Jun 03, 2015 6:35 pm, edited 1 time in total.

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 » Wed Jun 03, 2015 6:28 pm

Klaus wrote: What exactly are you trying to achieve?
Just trying to create a basic bar chart.
Last edited by shawnblc on Wed Jun 03, 2015 8:31 pm, edited 1 time in total.

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

Re: lockLocation top of graphic "line" ??

Post by Klaus » Wed Jun 03, 2015 6:39 pm

shawnblc wrote:

Code: Select all

   set the bottom of graphic "bar1" to the top of graphic "line" +2
AHA! :D
Yep, that's the way to go!

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 » Wed Jun 03, 2015 11:38 pm

Klaus wrote:
shawnblc wrote:

Code: Select all

   set the bottom of graphic "bar1" to the top of graphic "line" +2
AHA! :D
Yep, that's the way to go!

Trying something a little different now. Which works for positive numbers, but isn't for negative numbers. Hmmm.

Code: Select all

  if tBlue2 < 0  then 
     set the right of graphic "bar3" to the left of graphic "Line2"
  else
      set the left of graphic "bar3" to the right of graphic "Line2"
      end if

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

Re: lockLocation top of graphic "line" ??

Post by dunbarx » Wed Jun 03, 2015 11:46 pm

Hi.

What doesn't work? The setting of the rights and lefts, or the "if" statement? And are you saying that if tBlue2 is positive, it works? No way...

Craig

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 » Wed Jun 03, 2015 11:53 pm

dunbarx wrote:Hi.

What doesn't work? The setting of the rights and lefts, or the "if" statement? And are you saying that if tBlue2 is positive, it works? No way...

Craig
Here's what I mean (see attached). See how the negative number is not drawing the bar? What am I doing wrong.
Attachments
Screenshot 2015-06-03 17.51.45.png
Screenshot 2015-06-03 17.51.32.png

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

Re: lockLocation top of graphic "line" ??

Post by dunbarx » Thu Jun 04, 2015 6:04 am

Hmmm.

Are you sure it is not drawing the bar, or that it is drawing it offscreen to the left?

Try -10 instead of -33 and see if half of the bar appears.

Craig

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 12:26 pm

dunbarx wrote:Hmmm.

Are you sure it is not drawing the bar, or that it is drawing it offscreen to the left?

Try -10 instead of -33 and see if half of the bar appears.

Craig

Same thing with -10 or even less like -5. I tried adjusting the group, and moving the vertical line, but still the same. Any other ideas?

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

Re: lockLocation top of graphic "line" ??

Post by Klaus » Thu Jun 04, 2015 12:58 pm

What exactly are you doing with the negative numbers?
Set the LOC/LEFT/TOP/RIGHT/BOTTOM of your graphic?

If yes, the the graphic must be part of a LOCKED group,
which would explain its disappearance! :D

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

Re: lockLocation top of graphic "line" ??

Post by dunbarx » Thu Jun 04, 2015 2:19 pm

I am confused.

Regardless of the value of the variable tBlue2, either of the lines:

set the right of graphic "bar3" to the left of graphic "Line2"
set the left of graphic "bar3" to the right of graphic "Line2"

should simply work. Have you tried executing either of those by hand? We are trying to determine what is going on without context. The creation and management of a simple bar graph, by using the properties you are working with, ought to be fun and straightforward. Try those lines from the message box.

Craig

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 3:25 pm

I'll post a stack, that'll be more helpful.
Last edited by shawnblc on Thu Jun 04, 2015 8:03 pm, edited 1 time in total.

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

Re: lockLocation top of graphic "line" ??

Post by jacque » Thu Jun 04, 2015 5:01 pm

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.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply