Is there any way to get all changes?

Started by JuneTheSecond, May 19, 2009, 01:42:44 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

JuneTheSecond

Hi,

Is there any way to get all changes of the control point?
If you put a formula in User Defined cell like
=DEPENDSON(Controls.Row_1)+CALLTHIS("GetChanges",),
many events are triggered ,and it calls macro GetChanges every time.
But GetChanges returns always same value until mouse button is up.

GetChanges is


Sub GetChanges(shp As Visio.Shape)
    Debug.Print shp.Cells("Controls.Row_1").Result("mm")
End Sub
Best Regards,

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

Visio Guy

I think you can do something like this (if it isn't too hard)


  • In GetChanges, you add the calling shp or shp.id to a collection, if it isn't already in the collection.
  • When Visio fires NoEventsPending, you process each shp in the collection, then clear the collection

So shp "A" might call GetChanges 25 times, but "A" will only be added to the "TODO" collection one time, then processed when Visio is done messing around in your NoEventsPending loop.
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

JuneTheSecond

Hi, Visio Guy.

Thank you for your responce.
But I am sorry my description was not enough.
I wish to get changing data while I am moving control point of a shape.
If you insert text field to the shape for the location of control point,
and if you move the controlpoint, the text on the shape changing
while you are moving control point.
In my code I got constant values while I am moving control point.

Your kind suggestion made me try to add shape to a collection in GetChanges,
and read in the collection. But the result seems unchanged.


Option Explicit
Dim myShapes As New Collection

Sub GetChanges(shp As Visio.Shape)
'    Debug.Print shp.Cells("Controls.Row_1").Result("mm")
    myShapes.Add shp
End Sub

Sub ReadShapes()
    Dim shp As Visio.Shape
    Dim I As Long
    For Each shp In myShapes
        I = I + 1
        Debug.Print I, shp.Cells("Controls.Row_1").Result("mm")
    Next
End Sub

Best Regards,

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

JuneTheSecond

#3
Hi,

Now, I'v come to QUEUEMARKEREVENT function.

A formula is put in user-defined cell,
=QUEUEMARKEREVENT(Controls.Row_1&"   "&Controls.Row_1.Y),
and the changing data are gathered with code,


Option Explicit

Private WithEvents app As Visio.Application

Sub start()
    Set app = Application
End Sub

Private Sub app_MarkerEvent(ByVal app As IVApplication, ByVal SequenceNum As Long, ByVal ContextString As String)
    Debug.Print SequenceNum, ContextString
End Sub

Private Sub Document_RunModeEntered(ByVal doc As IVDocument)
    If app Is Nothing Then Set app = Application
End Sub

Best Regards,

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