Prevent Send To Back Within a Shape

Started by ramulose, May 28, 2015, 05:27:20 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ramulose

Hello Everyone,

This seems like it should be very easy to solve but I haven't been able to figure it out and haven't been able to find an answer anywhere online.

I have created a shape that has a textbox shape on top of a rectangle shape to provide a border. I have grouped the shapes so they move together, and added the code to the Shapesheet to cause them to size together, but you can still select the text box and use 'Send to Back' to move it behind the rectangle shape. Is there anyway to supress this feature within a shape?

Thanks for any help you can provide.
We can't solve problems by using the same kind of thinking we used when we created them. - Albert Einstein

vojo


wapperdude

I'm not aware of any shapesheet or macro commands that lock the Z-order.

It sounds like you made the shapes overlap.  Why not butt them against each other?  That way, the Z-order doesn't matter. 

You can do that by controlling the PinY and LocPinY of one or both of the shapes.  For example, suppose the text box is sheet.1, and the other shape is sheet.2.  In sheet.2, you could set PinY to align with the bottom edge of sheet.1, and then set LocPinY of sheet.2 = to Height*1 instead of Height*0.5.

Wapperdude
Visio 2019 Pro

AndyW

Why not just add a border to the text block in the rectangle itself.
Live life with an open mind

Nikolay

You also could simply prevent selection for the text box if you don't want the user to interact with it:
Developer -> Behavior -> Selection -> Group Only.

ramulose

#5
Thanks for the responses. I appreciate all the suggestions.

Vojo - I tried playing around with layers and it looks like layers only apply at the sheet level, not the shape level.

Wapperdude - I was think about doing this, but it gets very complicated. The text boxes automatically size vertically as the text fills up the box. Also, I would need 4 individual rectangles to surround the box, and if I put a line around the boxes to define the outer edges I end up with a frame that has lines through it where the rectangles come together. It could be worse, but not rally what I'm looking for.

AndyW - I need to have lines around the frame both on the outside of the frame, and the inside. Just like a picture frame.

Nikolay - The user needs to be able to select the text box so text can be manually entered.

It seems that being able to lock Z-Order would be something that anyone building shapes might need at some point. I would think that being able to overlap shapes in a master shape would be pretty fundamental functionality.

Again - thanks for the responses. I appreciate your time. If anyone else has any other ideas of a way to do this I would really apreciate the input.

Ramulose
We can't solve problems by using the same kind of thinking we used when we created them. - Albert Einstein

ramulose

Does the 'VisioGuy' ever jump in on these threads?  :D
We can't solve problems by using the same kind of thinking we used when we created them. - Albert Einstein

wapperdude

My apologies, I misunderstood your 1st description.  The z-order issue is still a problem, and so, work-arounds are necessary.  Now that I believe I understand, attached is a proposed solution. 

Basically, you convert the textbox to a group.  That forces it to always be the top most shape.  You can then add one or more rectangles to the group as desired.  I show 2.  Each subshape can be slaved to the textbox as desired.  Note, the textbox is just a normal shape with Line and Fill not shown.  These can be shown if desired.  The textbox and each subshape can be selected.  There is still a z-order issue with the 2 subshapes.  I suppose, the smaller subshape could be converted to a group, and the larger shape made a subshape to it.  Then, there would be no z-order issue at all.  Hopefully, this alleviates your problem. 

Wapperdude
Visio 2019 Pro

ramulose

Hi Wapperdude,

Thanks for the work you did on this. That didn't fix the problem, but now I can show you the exact behavior I am trying to avoid.

If you select the brown bordered box and then select 'send to back' from the 'right-click' drop down menu, the brown box disappears behind the blue bordered box. This is what I don't want to happen

Thanks again for the help. If you can figure this out, I will proclaim your prowess across the land! haha
We can't solve problems by using the same kind of thinking we used when we created them. - Albert Einstein

ramulose

Wapperdude,

I'm looking at your post again and it looks like what you did to the text box is what I am trying to do, but I don't know if I understand your instructions. You said:

"Basically, you convert the textbox to a group.  That forces it to always be the top most shape.  You can then add one or more rectangles to the group as desired."

Are you talking about a group of 1 shape? Just the text box in the group? You then said to "add one or more rectangles to the group". The way I create a group is to select all of the shapes in the group and then select "group". Is that what you mean by adding rectangles to the group?

Thanks
We can't solve problems by using the same kind of thinking we used when we created them. - Albert Einstein

Nikolay

Why don't you Just prevent the selection for the box.. (see my previous post)...?

Developer -> Behavior -> Selection -> Group Only


wapperdude

#11
If/when you have an existing group and then you decide you want to add an additional shape(s), you would normally
  1.  Align the new shape with the existing shape, then deselect all
  2.  Next, select the group, followed by the shapes you want to add.  Important to select the group first.
  3.  Finally, shapes>grouping> add to group.

The new shapes are now members of the existing group.  It's important to use "Add to group".   If you just group, you create a new group consisting of the textbox plus other shapes.   The result is there's an extra layer, the group, which is the new top most.  This would NOT be what you want.  Check my attachment,   it should behave as you desire.

@Nikolay:  Textbox must be selectable to allow user to add text.  Once textbox is "exposed", i.e., selectable, there's no way to protect the z-order.  Hmmm, there may be a single shape solution... need to check out this option,  but I'm not at my computer right now:

Single shape solution...
Take a standard rectangle, open shapesheet, go to geometry section, modify entries so the geometry extends beyond width/height.  The textbox is still bound by the normal width, height, but the shape would extend further.  Something like:

   Was.          Becomes
Width*0.       Width*-0.5
Width*1        Width*1.5

Do similar for the height entry's for y-cells.  This will make the shape frame extend by 50% on each side, regardless of how the textbox re-sizes.

Wapperdude
Visio 2019 Pro

wapperdude

The single shape may provide a satisfactory solution, see attached.  There was some additional work to prevent formulas from being clobbered.

There are two different implementations, but, the variety is not limited to these.  First, for both shapes, the maximum "text driven" width is 10*Char.size.  Seemed like a reasonable value, but, obviously can be altered.  See the Text Transform section.  Note, this could be "parameterized" if desired. 

The Blue shapes are the same, just different amount of text.  These are the most primitive.  The shape size is solely determined by the text.  No other resizing is allowed.
The Red shapes add the ability to expand the shape.  The sizing of the textbox remains unchanged, so this allows increasing the overlap.  The overlap cannot be reduced below the size to show the text.

The amount of minimum overlap is established by the cell formulas in the Geometry section. 

There are now, a variety of solutions, from somewhat complex to reasonably simple.  All of which keep the text at the top of z-order.

HTH
Wapperdude
Visio 2019 Pro

ramulose

Waperdude -

Don't want to leave you hanging. I'm traveling for work this week and won't be able to really dive into this until I get back to my home office. I will keep you posted.

Thanks again for the help.
We can't solve problems by using the same kind of thinking we used when we created them. - Albert Einstein

wapperdude

Thanks ramulose.   :)

Hope the trip is successful.

Wapperdude
Visio 2019 Pro