Container Shape

Started by -VisioNewbie-, May 02, 2013, 03:28:30 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

-VisioNewbie-

Hi!

When moving a container shape over another shape, you cannot see if the shape is a member of the container unless you move the container shape. Is there any function to handle this problem?

I did't find any function for this. So I tried to get the position data (top, left, width, height) of the moved container (via "MovedSelectionEvent.SelectionTarget" [1]) in order to compare its values with the positions of all the other shapes. If a Shape is located within a container area but isn't a member it should be colored grey.

If you don't have a better idea for solving my problem can you tell me how I can use the ovedSelectionEvent.SelectionTarget event? The following code doesn't work..

Dim WithEvents vsoApplication As Visio.Application
Set vsoApplication = Application

Private Sub vsoApplication_MovedSelectionEvent()
    Debug.Print "test"
End Sub


[1] http://msdn.microsoft.com/en-us/library/office/ff765742(v=office.14).aspx


Thank's a lot!

Paul Herber

If you move a container over a shape then by definition that shape cannot be a member of that container. You have to move a shape over the container to add the shape.

Electronic and Electrical engineering, business and software stencils for Visio -

https://www.paulherber.co.uk/

-VisioNewbie-

That's true but I'ld like to implement a function that improves this "problem", so that "view" and "functionality" are identical.

JuneTheSecond

I've made a macro that changes the color of the members of selected container.


Option Explicit

Sub test()
    Dim shp As Visio.Shape
    Dim memID As Variant
   
    If ActiveWindow.Selection.Count = 0 Then Exit Sub
   
    Set shp = ActiveWindow.Selection(1)
   
        If Not (shp.ContainerProperties Is Nothing) Then
           
            For Each memID In shp.ContainerProperties.GetMemberShapes(visContainerFlagsDefault)
                ActiveWindow.Select ActivePage.Shapes.ItemFromID(memID), visSelect
                ActivePage.Shapes.ItemFromID(memID).Cells("FillForegnd").Formula = "RGB(0,100,200)"
            Next
        End If
   
   
End Sub

Best Regards,

Junichi Yoda
http://june.minibird.jp/