Undo/Redo Toolbar Buttons Enabled State

G

Guy..L

How do I query the Visio Undo/Redo Stack to determine if the buttons on my UI
should be enabled or disabled? I'm using the Visio 2007 ActiveX Drawing
Control in a WinForms Application written with C# .net 3.0 and the Interop.
Everything else works fine except for this. There are no examples nor
relevant methods.
 
J

JuneTheSecond

Hi,

Is it IVBUndoUnit.Description Property ?
SDK librarian has example.
Though it is difficult for me to understand.
 
G

Guy..L

Hello,

I checked out the two classes in the SDK code samples. It looks like the
top class is hooked up to the Shape Added event for the document.

I suppose this is a start. Now I need to identify every possible event on a
new or existing document?? Ie., Shape Deleted if shapes exist on the
document, etc., etc. ad nauseam...

Basically, I'm attempting to duplicate the Undo/Redo UI in the Visio Product.

Is there some magic list of events I need to include?

Regards,
GL
 
J

JuneTheSecond

Hi,

Another idea might be to read the text on tool buttons like this.
Public Sub RedoUndoList()
Dim I As Long, N As Long
Dim cbr As CommandBar
Dim cont As CommandBarControl
Dim contUndo As CommandBarComboBox
Dim contRedo As CommandBarComboBox
' For Each cbr In Application.CommandBars
' If cbr.Visible = True Then
' Debug.Print cbr.Index, cbr.Name, cbr.Visible, cbr.NameLocal,
cbr.BuiltIn
' End If
' Next
Set cbr = Application.CommandBars(23)
' Debug.Print cbr.Name
' For Each cont In cbr.Controls
' Debug.Print cont.ID, cont.Index, cont.Caption
' Next
Set contUndo = cbr.Controls(14)
Set contRedo = cbr.Controls(15)
' Debug.Print contRedo.Caption
Debug.Print "Undo Stack"
If contUndo.Enabled Then
N = contUndo.ListCount
For I = 1 To N
Debug.Print " " & contUndo.List(I)
Next
Else
Debug.Print " Empty"
End If
Debug.Print "Redo Stack"
If contRedo.Enabled Then
N = contRedo.ListCount
For I = 1 To N
Debug.Print " " & contRedo.List(I)
Next
Else
Debug.Print " Empty"
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top