Working around Lists deficiencies + Getting Started with VBA

Started by kennyj, May 17, 2013, 09:06:00 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

kennyj

In order to deal with the (mis)behavior of lists in Visio 2010 ie. their improperly automatic re-sizing, I'm placing no-line space holder shapes into my horizontal list shape, to keep it the correct height & width, which means I need to control which shapes in the list are user selectable/moveable, as well as automatically re-sizing space-holder shapes to counterbalance user actions that alter dimensions of other shapes in the list, in order to keep the list container from changing its dimensions upon such actions.

Additionally, I need to alter flags in multiple contained shapes in response to shapes being moved.

For instance: Lets say the List container is a rectangle 90"W x 24"H

After dropping the list shape, I simultaneously drop 4 rectangular shapes into it, totaling 90" wide.
shape1 is .25" by 24" and is set to no line, so it's essentially invisible, and needs to remain in the leftmost position in the horizontal list. This shape holds the 24" dimension for me, but I don't want the shape selected or moved.

shape2 is a rectangle 30" x 12" with prop.me="lefty"
shape3 is a rectangle 30" x 12" with prop.me="righty"
shape4 is a rectangle 29.75" x 24" no-line spaceholder shape and should not be user selectable or moveable

Now, I want to drop shape5 into the list. But I don't want the list to resize.
shape5 is 24" x 12". When I drop it, I want to simultaneously resize shape4 to 5.75" width.
shape5 needs to land in the 4th position
change shape3 prop.me="lefty"

Now the user selects shape5, hits the left arrow, swapping the list positions of shapes4 & 5.
change shape5 prop.me="lefty"
change shape4 prop.me="righty"

So any shape I drop will be a rectangle.

Somehow I need to know when a new shape is dropped, probably before it is added to the list, in order to keep it from getting dropped into position 1, which is only for my 1/4" space holder.

The space holder on the far right reduces it's width by the width of the new rectangle (I still have to figure out how to handle rectangles that are bigger than the available space)

Then, I guess I query the list object for the id of each shape it contains. (or should I keep track of these separately?)
Then loop through to get the position of each id.
The highest position (furthest right) that is not a space-holder shape has it's prop.me set to "righty"
every other non-spaceholder shape has it's prop.me set to "lefty"

Upon selecting and moving a shapes position via the keyboard, the same loop resets everybody's prop.me according to their new position.
Upon selecting a space-holder shape - it needs to be deselected, or somehow blocked from ever being selected.
Upon resizing a rectangle shape's width, the spaceholder shape needs to simulatneously resize in the opposite direction to offset and maintain overall list dimension.

I presume this should not be too terribly difficult or complicated using VBA, but I'm also new to VBA and it would be super wonderful and much appreciated if anyone could help me work through the essential VBA logic, syntax, etc; possibly even provide some example code to get me started.


As far as my entry level:
I'm of necessity venturing into VBA now, which is completely new. I have minimal programming experience: BASIC & Assembly for the 8088, so you can guess how long ago that was, and more recently a single Python course at Udacity (highly recommended & free!); so I understand many of the basic concepts, but new to OOP and VBA syntax, etc.

I've done some fooling around with macros, and I've ordered "visualizing information with microsoft visio 2007" and "professional development with visio 2000" hoping they'll help introduce me to vba for visio. There doesn't seem to be anything more specifically for, or more current that's directly related to vba and visio. But I'm sure most of what I find in these books will still be applicable. I've also looked around in the visio object model, and such.

Any suggestions on excellent intro to good vba programming or especially visio specific vba are much appreciated.
Any points in direction of useful sample code or related articles etc are also certainly appreciated.

TIA for any help!

-k

Yacine

Yacine

kennyj


Yacine

Are you sure that you want to automate that process so much?
You still have "almost" intelligent users in front of your app.
Wouldn't it help to keep it simplier, but give more recommendations instead? eg : show propper connection points, instead of pre-defining them.
Yacine

kennyj

Well the application is such that the List is the walls of a room, or in this case a closet.
The rectangle shapes are top view of sections, such as shelving, etc.
Based on the relative position of the sections determines whether there's a panel included on the left, or on the right, or both.
The shapes self adjust their geometry, size/position to reflect the presence or absence of these panels based on the property.

The user is often 100% non-technical, and the major selecting and dropping of shapes is done automatically by the UI (VBA Forms for this proof of concept phase). So the user might select various combinations of shelving, drawers, hangers, etc. and the top view diagram will then draw itself.

Then the user can make any adjustments via changing sizes, positions, or types of sections, etc.
Then click a button to draw the elevation view.

Having the room / list shape change sizes would not do.
Having space holder shapes be movable would be an unnecessary encumbrance on the user.

The only thing there really is for them to do is select the size, type, and order of sections. All of the alignment beyond that is easily calculated, so no need to burden the user with any of that.

The idea is to be able to do a drawing that might take 20 minutes by hand down to minutes or seconds.