[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Visio 2013 - Reposition Text handle - Where is it?

Posted on 2014-01-27
4
Medium Priority
?
2,190 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 31

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 2000 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

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Question has a verified solution.

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

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 …
The ability to add structure to Visio diagrams using containers, lists and callouts is one of my favorite features in Visio 2010. In this article we’ll examine lists. We’ll explore containers and callouts in separate articles. Prior to reading th…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

656 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