Page 1 of 2

lockLocation top of graphic "line" ??

Posted: Wed Jun 03, 2015 5:40 pm
by shawnblc
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"

Re: lockLocation top of graphic "line" ??

Posted: Wed Jun 03, 2015 6:02 pm
by dunbarx
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

Re: lockLocation top of graphic "line" ??

Posted: Wed Jun 03, 2015 6:05 pm
by Klaus
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

Re: lockLocation top of graphic "line" ??

Posted: Wed Jun 03, 2015 6:23 pm
by shawnblc
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.

Re: lockLocation top of graphic "line" ??

Posted: Wed Jun 03, 2015 6:28 pm
by shawnblc
Klaus wrote: What exactly are you trying to achieve?
Just trying to create a basic bar chart.

Re: lockLocation top of graphic "line" ??

Posted: Wed Jun 03, 2015 6:39 pm
by Klaus
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!

Re: lockLocation top of graphic "line" ??

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

Re: lockLocation top of graphic "line" ??

Posted: Wed Jun 03, 2015 11:46 pm
by dunbarx
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

Re: lockLocation top of graphic "line" ??

Posted: Wed Jun 03, 2015 11:53 pm
by shawnblc
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.

Re: lockLocation top of graphic "line" ??

Posted: Thu Jun 04, 2015 6:04 am
by dunbarx
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

Re: lockLocation top of graphic "line" ??

Posted: Thu Jun 04, 2015 12:26 pm
by shawnblc
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?

Re: lockLocation top of graphic "line" ??

Posted: Thu Jun 04, 2015 12:58 pm
by Klaus
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

Re: lockLocation top of graphic "line" ??

Posted: Thu Jun 04, 2015 2:19 pm
by dunbarx
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

Re: lockLocation top of graphic "line" ??

Posted: Thu Jun 04, 2015 3:25 pm
by shawnblc
I'll post a stack, that'll be more helpful.

Re: lockLocation top of graphic "line" ??

Posted: Thu Jun 04, 2015 5:01 pm
by jacque
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.