Solved

Visio 2013 - Reposition Text handle - Where is it?

Posted on 2014-01-27
4
1,963 Views
Last Modified: 2014-02-03
I am using a stencil and after I entered text I saw there was no "reposition text handle"  I don't think this stencil has one.  How can I create one for this shape?
0
Comment
Question by:brothertruffle880
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 30

Expert Comment

by:Scott Helmers
ID: 39814917
Unless the text block has been locked, you can manipulate it with the text block tool. Simply select the tool, then click the shape: any moves or changes you make affect the text block and not the underlying shape.text block
0
 
LVL 11

Expert Comment

by:Visio_Guy
ID: 39815057
FYI: The control-handle-text is a nicety built into some shapes, but not all of them. Networking shapes have it (although it is partially broken in Visio 2013), flowchart shapes don't (since the text usually lives "inside the box").
0
 

Author Comment

by:brothertruffle880
ID: 39818688
Is there any way for me to add the control-handle-text to my custom-built shapes?  I really like them and I want to place them into my own custom-built shapes.
That's my ultimate goal in asking.
0
 
LVL 11

Accepted Solution

by:
Visio_Guy earned 500 total points
ID: 39823059
Hi BT,

I put this code in a stencil, and save the stencil in My Shapes. Then I can get to it easily via More Shapes.

You still have to open the VBA editor (Alt + F11) to run it, but it's super easy to do.

Just select a shape or shapes in a drawing window or master-editing window, then place the cursor in one of the "Sub AddTextRepositionControlHandleToSelection_" procedures and hit F5. Boom! You've got control-handle text!

Option Explicit

'// Module: ControlHandleText
'//
'// Last Edit: 2010.05.17
'//
'// Procedures for adding the default control-handle-positioned
'// text to a selection of shape.
'//
'// Includes the SETREF behavior to handle users moving the text
'// block using the Text Block Tool, and hiding the control handle
'// when the shape has no text or HideText is true.

Private Const TextChCellName$ = "Controls.vgRepositionText"
Private Const TextChRowName$ = "vgRepositionText"

Private Const DefTextPosX_Left% = 0
Private Const DefTextPosX_Center% = 1
Private Const DefTextPosX_Right% = 2

Private Const DefTextPosY_Bottom% = 0
Private Const DefTextPosY_Middle% = 1
Private Const DefTextPosY_Top% = 2

'// Bottom-left:
Sub AddTextRepositionControlHandleToSelection_BottomLeft()
    Call m_iterateSelection(DefTextPosX_Left, DefTextPosY_Bottom)
End Sub
'// Bottom-center:
Sub AddTextRepositionControlHandleToSelection_CenterBottom()
    Call m_iterateSelection(DefTextPosX_Center, DefTextPosY_Bottom)
End Sub
'// Bottom-right:
Sub AddTextRepositionControlHandleToSelection_RightBottom()
    Call m_iterateSelection(DefTextPosX_Right, DefTextPosY_Bottom)
End Sub
'// Middle-left:
Sub AddTextRepositionControlHandleToSelection_LeftMiddle()
    Call m_iterateSelection(DefTextPosX_Left, DefTextPosY_Middle)
End Sub
'// Middle-right:
Sub AddTextRepositionControlHandleToSelection_RightMiddle()
    Call m_iterateSelection(DefTextPosX_Right, DefTextPosY_Middle)
End Sub
'// Top-left:
Sub AddTextRepositionControlHandleToSelection_TopLeft()
    Call m_iterateSelection(DefTextPosX_Left, DefTextPosY_Top)
End Sub
'// Top-right:
Sub AddTextRepositionControlHandleToSelection_TopRight()
    Call m_iterateSelection(DefTextPosX_Right, DefTextPosY_Top)
End Sub
'// Middle-center:
Sub AddTextRepositionControlHandleToSelection_CenterMiddle()
    Call m_iterateSelection(DefTextPosX_Center, DefTextPosY_Middle)
End Sub



Sub AddResetTextPositionAction()

  Const ResetTextActionLabel$ = "Reset Text Position"
  Const ResetTextActionRowName$ = "vgResetTextCH"
  
  Dim shp As Visio.Shape
  Dim r As Visio.Row
  Dim fDefaultX As String, fDefaultY As String
  For Each shp In Visio.ActiveWindow.Selection
  
    If (shp.CellExists(TextChCellName, Visio.VisExistsFlags.visExistsAnywhere)) Then
      
      Set r = ShapeUtils.GetOrAddActionRow(shp, ResetTextActionLabel, ResetTextActionRowName)
      
      fDefaultX = shp.Cells(TextChCellName).Formula
      fDefaultY = shp.Cells(TextChCellName & ".Y").Formula
      
      r(Visio.VisCellIndices.visActionMenu).Formula = Chr(34) & ResetTextActionLabel$ & Chr(34)
      r(Visio.VisCellIndices.visActionDisabled).Formula = _
        "AND((" & fDefaultX & ")=" & TextChCellName & ",(" & fDefaultY & ")=" & TextChCellName & ".Y)"
      r(Visio.VisCellIndices.visActionAction).Formula = "SETF(GETREF(" & TextChCellName & ")," & _
        Chr(34) & fDefaultX & Chr(34) & ")+SETF(GETREF(" & TextChCellName & ".Y)," & Chr(34) & fDefaultY & Chr(34) & ")"
        
      r(Visio.VisCellIndices.visActionSortKey).Formula = Chr(34) & "CheckState200" & Chr(34)
      r(Visio.VisCellIndices.visActionBeginGroup).ResultIU = 1
              
    End If
        
  Next shp
  
End Sub

Private Sub m_iterateSelection(ByVal defaultXpos As Integer, _
                               ByVal defaultYpos As Integer)

    Dim shp As Visio.Shape
    For Each shp In Visio.ActiveWindow.Selection
      
      Call m_addControlHandleText(shp, defaultXpos, defaultYpos)

    Next shp
    
End Sub
Private Sub m_addControlHandleText(ByRef shp As Visio.Shape, _
                                   ByVal defaultXpos As Integer, _
                                   ByVal defaultYpos As Integer)
  
  Dim visRow As Visio.Row
  Set visRow = ShapeUtils.GetOrAddControlHandleRow(shp, TextChRowName$)
  
    
  shp.Cells("TxtWidth").FormulaForceU = "GUARD(TEXTWIDTH(TheText))"
  shp.Cells("TxtHeight").FormulaForceU = "GUARD(TEXTHEIGHT(TheText,TxtWidth))"
  shp.Cells("TxtPinX").FormulaForceU = "SETATREF(" & TextChCellName & ".X)"
  shp.Cells("TxtPinY").FormulaForceU = "SETATREF(" & TextChCellName & ".Y)"
  shp.Cells("TxtLocPinX").FormulaForceU = "GUARD(TxtWidth*0.5)"
  shp.Cells("TxtLocPinY").FormulaForceU = "GUARD(TxtHeight*0.5)"
  
  Dim c As Visio.Cell
    
  Set c = visRow(Visio.VisCellIndices.visCtlX)
  Select Case defaultXpos
  Case 0
    c.FormulaForce = "-TxtWidth*0.5"
  Case 1
    c.FormulaForce = "Width*0.5"
  Case 2
    c.FormulaForce = "Width + TxtWidth*0.5"
  End Select
  
  Set c = visRow(Visio.VisCellIndices.visCtlY)
  Select Case defaultYpos
  Case 0
    c.FormulaForce = "-TxtHeight*0.5"
  Case 1
    c.FormulaForce = "Height*0.5"
  Case 2
    c.FormulaForce = "Height + TxtHeight*0.5"
  End Select
  
  Set c = visRow(Visio.VisCellIndices.visCtlTip)
  c.FormulaForce = Chr(34) & "Reposition Text" & Chr(34)
  
  Set c = visRow(Visio.VisCellIndices.visCtlGlue)
  c.FormulaForce = "FALSE"
  
  Set c = visRow(Visio.VisCellIndices.visCtlXCon)
  c.FormulaForce = "5*OR(HideText,STRSAME(SHAPETEXT(TheText)," & Chr(34) & Chr(34) & "))"
  
End Sub

Open in new window

0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Can I crop a diagram in Visio 2013? 9 2,154
Visio 2013 Data Linking 2 41
download visio 4 80
Visio 2013 COMMENTS PANE commandbar: how to display via VBA? 4 86
The Question Several times in recent years, someone has posted a question at EE asking whether they could display the Windows directory structure – folders and subfolders – using Visio. When one person specifically asked about displaying directory …
Meetings to discuss business process can waste time, and often do .  The meeting's dialog can get confusing when participants have different professional perspectives and backgrounds.  A jointly-developed process picture helps wade through the confu…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question