Set selection as value

Started by twoeyes, January 13, 2021, 03:43:43 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

twoeyes

Hi all, I'm giving this a shot, although it seems to be rather difficult from the searches I've done.

I would like to get the IDs (or names) of shapes that I have selected, and set them as values in a user-defined cell of a custom shape that I have.
For context, the custom shape is a Router, and the selected shapes are networks that the Router known about.

My first instinct was the following workflow:
1. select the relevant shapes
2. run a custom action (from context menu of the router)
3. the action calls a macro which assigns the selection to the user-defined shape

But when I right-click for step 2, I lose the selection.

My next plan was to swap steps 1 and 2, and create a button on-the-fly to confirm my selection. That is:
1. run action from context menu of Router
2. create a button on-the-fly.
3. select the shapes
4. click the button which would run the relevant macro
5. delete the button

This time I get stuck in step 2, since as soon as I drop the button with Set btn = ActivePage.InsertObject("forms.commandbutton.1", 0), the document goes into design mode, and the macro stops running.

My next idea was to try to figure out how the Shape.ConnectedShapes method works, and maybe replicating it for my ends, but that's quite a bit out of my depth.

Of course, I can set it up such that there is a 'control corner' in the page with some combobox listing all Routers and a button which says "set as routes" but having some sort of right-click > Action would be a bit more user-friendly methinks.

thanks so much for all I've learned in the forum :)
Twoeyes.

PS: I wasn't sure if this should go here or in Programming & coding

Surrogate

Quote from: twoeyes on January 13, 2021, 03:43:43 PM
1. select the relevant shapes
...
But when I right-click for step 2, I lose the selection.
Context menu of router shape can work if selected ONLY this shape !