What is the Mastershape of a TextBox?

Started by qw12, March 03, 2009, 04:30:21 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

qw12


As I understand, a Textbox does not have mastershape (shp.Master = NULL).

But how can I find out if an aribtrary shape is a textbox or not?

Lars-Erik

Not sure what or how you are using this:
Something all textfields share (the basic ones from Visio) is EventDblClick=OPENTEXTWIN()
Perhaps you can use this to check if its a textbox.

Give us some more information on what you want to do and what other shapes are on the page, are the textfields changed or default ones? etc etc. in other words, some information about the what and why.

- Lars

qw12

#2
Quote
Give us some more information on what you want to do and what other shapes are on the page, are the textfields changed or default ones? etc etc. in other words, some information about the what and why.

- Lars

I have created a "scalable Text"-shape (as decribed in this forum). Now I want to loop through a page, and change all textboxes to "scalable text".
So when looping through the shapes, I want to see what "type" they are. I supposed that the "type" in visio is the same as a "mastershape"

JuneTheSecond

#3
Hi, qw12.

I think text box is also the shape,
the differences are line style and fill style.

Sub test()
    Dim shp As Visio.Shape
    For Each shp In ActivePage.Shapes
        Debug.Print shp.Name, shp.Type, shp.LineStyle, shp.FillStyle
    Next
End Sub
Best Regards,

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

qw12

#4
Quote from: JuneTheSecond on March 04, 2009, 12:24:27 AM
Hi, qw12.

I think text box is also the shape,
the differences are line style and fill style.

Sub test()
    Dim shp As Visio.Shape
    For Each shp In ActivePage.Shapes
        Debug.Print shp.Name, shp.Type, shp.LineStyle, shp.FillStyle
    Next
End Sub


Hello JuneTheSecond,

So,  if  LineStyle ="Text Only" AND FillStyle="Text Only" then I have a textbox?
All other cases I have another type of shape?



JuneTheSecond

May be correct, but not definitive.
Because, a text box is a usual shape,
if you change the line weight to normal,
and fill with any color. A shape is a text box,
if you change the line weight to zero, and delete fill color.
Best Regards,

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

qw12

Quote from: JuneTheSecond on March 04, 2009, 11:31:50 AM
May be correct, but not definitive.
Because, a text box is a usual shape,
if you change the line weight to normal,
and fill with any color. A shape is a text box,
if you change the line weight to zero, and delete fill color.

Hello JuneTheSecond,
Ok, I now understand. A "text box" is not more than a Rectangle with invisible line, and no fill color.
Am I right?

Next question:
Is there a way to fire an event if somebody changes the font size?
Is there a

Lars-Erik

Using the Visio Event Monitor (part of visio SDK) (downloadable here)
You can see what event fire when you change the textsize.

As far as I can see the following things are fired, that might be usefull:

1) EnterScope Font Size [1130;0;Font Size;198304]
2) FormulaChanged Sheet.1!Char.Size 0,194444444444444=14 pt
3) CellChanged Sheet.1!Char.Size 0,194444444444444=14 pt

Here is a list of events.

Now you would have to catch the formulachanged event, check if the charsize changed, and then you can use that.
Or perhaps you can catch the scopes visio enters check if thats a font size event and work with that.

- Lars


Visio Guy

Hi Guys,

I have another quick note (haven't read the whole thread thoroughly, because I'm a bit busy at the MVP Summit in Seattle).

Shapes "have text" in any of three ways:

1. Single shape, has a text block (of course!)
2. Grouped shape, has a text block that belongs to the group, top level, in group ShapeSheet, etc.
3. Grouped shape, text belongs to top-most sub-shape. This is the old style before groups could have text, and is also an option you can set in newer versions.

#2 and #3 can be specified using the Format  > Behavior dialog. There you'll see a "Edit text of group" check box. If this is checked, then the group will hold text. If not, then the top-most sub-shape (that can have text) will hold the text for the shape.

You need to know this stuff if you are editing text blocks with code.

For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010