Reputation: 12868
I am trying to do a very basic user interface wireframe using Visio 2016. I want to do things like show a dialog box when I click on a button and then hide that dialog box when I click on the "ok" in the dialog. I've been previously doing this by completely copying the entire page and adding what I want to the new page and using the "Hyperlink" option. It would be a lot easier if there were a way to show or hide a shape when I click on another shape. Is there any capability like that?
Upvotes: 0
Views: 2186
Reputation: 211
You can get some code to run in fullscreen mode. I've hooked the application MouseMove event in the sample below. It makes the outline of the shape you are over fatter while the mouse is over that shape.
You can test the code by drawing a bunch of rectangles on a page, then moving the mouse in fullscreen mode.
I wasn't able to trap MouseDown in fullscreen mode, though.
More notes in the code's comments!
Option Explicit
'// Notes:
'//
'// - This code works in full screen mode!
'// - The mouse-up code doesn't work if you drag the shape,
'// (which won't be an issue in full-screen mode!)
Dim WithEvents m_visApp As Visio.Application
Private m_visShpMouseDown As Visio.Shape
Private m_lineWeightFormulaU As String
Private Sub Document_RunModeEntered(ByVal doc As IVDocument)
'// Toggle RunMode on and off via the blue triangle button just
'// right of the Stop/Reset button. This lets you reset the
'// code without closing and opening the file every time! Also,
'// this proc runs when you open the file, so m_visApp will
'// be set up to receive events!
Set m_visApp = Visio.Application
End Sub
Private Sub m_visApp_MouseMove(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, CancelDefault As Boolean)
Dim pg As Visio.Page
Set pg = m_visApp.ActivePage
If (pg Is Nothing) Then GoTo Cleanup
Dim shp As Visio.Shape
For Each shp In pg.Shapes
If (shp.HitTest(x, y, 0)) Then
'// The mouse is over a shape.
If (shp Is m_visShpMouseDown) Then
Debug.Print "MouseMove over same shape! " & DateTime.Now
GoTo Cleanup
Else
Debug.Print "MouseMove over shape! " & DateTime.Now
'// Restore any previously mouse-overed shape:
Call m_restoreShape
'// Save the original lineweight and change it to
'// something thicker:
m_lineWeightFormulaU = shp.CellsU("LineWeight").FormulaU
Set m_visShpMouseDown = shp
'// Make the lineweight thick:
shp.CellsU("LineWeight").FormulaForceU = "5pt"
GoTo Cleanup
'// Note: the above won't change the lineweights
'// for all shapes in a group. If you intend to use
'// this on grouped shapes, you'll have to recurse
'// into the group, which makes things a bit more
'// complicated!
End If
End If
Next shp
Call m_restoreShape
Cleanup:
Set shp = Nothing
Set pg = Nothing
End Sub
Private Sub m_restoreShape()
If (m_visShpMouseDown Is Nothing) Then Exit Sub
'// Restore the shape's original lineweight:
m_visShpMouseDown.CellsU("LineWeight").FormulaU = m_lineWeightFormulaU
'// Clear the mouse-down variables:
Set m_visShpMouseDown = Nothing
m_lineWeightFormulaU = vbNullString
End Sub
Upvotes: 0
Reputation: 1200
In Presentation Mode? No. There is almost no interaction available in Presentation Mode.
Upvotes: 1