Visio Guy

Visio Discussions => Shapes & Templates => Topic started by: AdamK on September 22, 2008, 08:57:41 PM

Title: Shape with pop-up text box
Post by: AdamK on September 22, 2008, 08:57:41 PM
Hi,

I'm trying to create a shape with two text elements... one that displays all the time and another thatappears and disappears when you double-click the shape.

I'm working on an interactive graph where the data points are associated with actions to be taken. I've succeeded in creating a circle with the text to the right of the circle, and I managed to have the color change automatically from green to yellow to red as the shape is placed in different quadrants of the graph by inserting a formula into the ForegroundFill attribute.

I would like to add behavior that will cause another text box to open next to this shape when I double click it. I would use Custom Properties, but I can't figure out a way to display a custom property in a multi-line, readable format for a lot of text.  I'm looking for a formatted text box that is editable, then gets hiden when I double click it again. I tried creating a text box and grouping it with the circle. When I do this, the color change formula stops working, and I can't figure out where I would insert an action that would show or hide the box.

I'm very new to shape design, so sorry if this dosen't make a lot of sense. Any advice would be greatly appreciated.

Thanks,
Adam
Title: Re: Shape with pop-up text box
Post by: vojo on September 24, 2008, 01:00:51 PM
couple of options:

1.  in the double click cell....add docmd(1312)...this will open the custom props menu on a double click
2.  could do the following:
          - on primary shape double click cell, have it toggle a variable
          - on secondary shape, use the variable to trigger in the geometry noshow cell
          - could do one of the following
                  - edit text (might be tough to figure out the raw text...might be "TheText" field
                  - Have its double click do something (I have used variables to bring up
                    subsets of custom props ....like network config, storage config, system config props.
                  - action buttons to launch subset of props
                  - etc.
     So in essence, double click primary shape....secondary shape shows up....use one of the means
     to edit the info...double click primary again...secondary shape dissappears.
3. Of course, could jump into code (VB is easiest / most visio friendly)
Title: Re: Shape with pop-up text box
Post by: wapperdude on September 24, 2008, 03:19:57 PM
I think the dbl click -- dbl click gets into some kind of loop.  Somehow need to keep track if it's the 1st dbl click or the 2nd.  My initial try produced circular argument.  Almost need a time delay function.
Title: Re: Shape with pop-up text box
Post by: vojo on September 24, 2008, 04:24:15 PM
user.click_tracker = 0
double click cell = setf(getref(user.click_tracker), if(user.click_tracker =1,0,1))

for debug could do the following:
actions.row_1.text = "checked if even num of double clicks"
actions.row_1.checked = user.click_tracker
actions.row_actions = ""

Once happy...delete actions row
Title: Re: Shape with pop-up text box
Post by: Paul Herber on September 24, 2008, 04:42:48 PM
Quote from: AdamK on September 22, 2008, 08:57:41 PM
Hi,
I'm trying to create a shape with two text elements... one that displays all the time and another thatappears and disappears when you double-click the shape.

To start with, have a look at my article on this forum at:
Text output popup box (http://visguy.com/vgforum/index.php?topic=343.0)

This will do the first bit of what you want. If this works for you then we can progress to the next stage ...

Title: Re: Shape with pop-up text box
Post by: AdamK on September 26, 2008, 01:29:21 PM
Hi,

Thanks for all the great input. I did a little of "all of the above" and got a really good result.

After I got over my obsession with doing this without writng code, I created a user form with multiple fields, to help organize the data I wanted to store. I then created user variables for the shape and wrote a short routine to populate and display the form modaly, then capture the values from the form and write them back to the shape's variables when the user clicks Save. I included a field on the form for the actual text of the shape, so now I have "smart dots" that I can move around on the graph; they change color based on the quadrant they are in, and I can add a bunch of information to each one.

Now that I'm back in scripting-mode, I'd like to create a routine to capture all of the data in my variables for all the dots on a sheet and export it to an Excel spreadsheet... has anyone done something like this?

Thanks again,
Adam