Problem with a shape when moving in auto-extended canvas and then back

Started by VisDom, August 21, 2017, 04:28:48 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

VisDom

Hi all,

my self-defined shape which has some constraints gets completely wrong coordinates when I try to move it to a space (negative canvas area) outside my current canvas. My canvas gets auto-extended. When I move my shape back, it breaks. The box gets totally wrong coordinates.

Here is how it goes:

1) I have my box on the canvas. Auto-extend the canvas is activated
2) I move my box to the right (negative area). It moves without issues.
3) I move my box back to the old place (positive canvas space) and my box gets kicked way to the left.

See Image!

I use a formula that prevents the box (Sheet.11) to go further than the vertical line (Sheet.10) to the right (X-Axis) of the box. It kicks the box back 15mm if it gets closer than 5mm to the vertical line.

Here is the formular in the User.Row_1 Field of my Box (Sheet.11)

=IF(PinX+Width>Sheet.10!EndX-5 mm,SETF(GetRef(PinX),Sheet.10!EndX-Width-15 mm),0)

Can anyone help me with this?
How can I restructure my formula so that the box does get the right coordinates when moving it off canvas and back?

Best Regards
VisDom

wapperdude

I have V2007, so don't have the page grow feature, so I can only suggest that after you move the shapes back to the original page, check the formula to see if it is still correct.

Wapperdude
Visio 2019 Pro

VisDom

@wapperdude: Thanks for the quick reply. I am rather new to Visio. How would I check the values after the move? I suppose there must be some kind of "EventMove" - Event? Would it help if I add the Visio-file with the shape?

As an addition to my description: Basically after the move, the PinX value turns negative. Thus the shape ends up far left on the invisible part of the canvas after the move.

wapperdude

Just open the shapesheet for your box and look at the User.Row_1 formula.  Since I can't help too much...wanted to rule out a change to the formula.

2nd question:  does the formula still work?  It only checks if shape is too close to the line.  The large distance is acceptable to your formula..  I'm not sure how Visio handles this add page functionality...might be a bug in how it moves objects.

Wapperdude
Visio 2019 Pro

VisDom

Quote from: wapperdude on August 21, 2017, 08:37:08 PM
Just open the shapesheet for your box and look at the User.Row_1 formula.  Since I can't help too much...wanted to rule out a change to the formula.

No when I move the box the formula does NOT change. It stays the same. Just the PinX turns negative.

Quote from: wapperdude on August 21, 2017, 08:37:08 PM2nd question:  does the formula still work?  It only checks if shape is too close to the line.  The large distance is acceptable to your formula..  I'm not sure how Visio handles this add page functionality...might be a bug in how it moves objects.

It might really be a bug. I attach an example Visio file with my shape. Hint: I converted down to VSD file. It might now work in it. But the example in the file VSDX works for sure.


Surrogate

cross-post
Please change formula in User.Row_5 to


=IF(PinX+Width>Sheet.2!EndX-5 mm,SETF(GetRef(PinX),"=guard(Sheet.2!EndX-Width-15 mm)"),0)
or just


=IF(PinX+Width>Sheet.2!EndX-5 mm,SETF(GetRef(PinX),"Sheet.2!EndX-Width-15 mm"),0)

VisDom

Surrogate, it WORKS!!! Thanks alot! I dont quite undersatnd why adding ' " ' solves the problem. But it totally works :)

Yacine

@Surrogate, I also had a look at the files and could not find out the problem. Neither do I understand why the GUARD does solve it, since the formula was still correct after the wrong placement.
Yacine

Croc

Guard does not matter.
Quotes are important.
Without quotes the SetF function writes a value to the PinX cell.
With quotes the SetF writes the formula. This formula will have time to work again before it turns into a number.
-------
But I still do not like this method.
In my opinion, it's more accurate to use the BOUND function directly in the PinX cell.

VisDom

Gentlemen, thanks for the constructive feedback.

Surrogate suggested a great solution that works. There is a problem though. If I use the following formular in a Master-Shape, the Shapes that I derive from that Master do not work. The reason is: Sheet.2 is NOT Sheet.2 in the derived shaped.

=IF(PinX+Width>Sheet.2!EndX-5 mm,SETF(GetRef(PinX),"Sheet.2!EndX-Width-15 mm"),0)

I tried this the following formular with a MasterShape, but it does not work either for me:

=IF(PinX+Width>Sheet.2!EndX-5 mm,SETF(GetRef(PinX),"GetRef(Sheet.2!EndX)-Width-15 mm"),0)

Any ideas?



Yacine

dumb idea, but would you try: "sheet." & sheet.2!ID() & "!EndX-Width-15 mm" instead?
This way the index should be preserved.
Yacine