Ctrl-C/Ctrl-X/Ctrl-V - How to catch.

S

Stumple

I noticed in the documentation that I can not catch the copy/cut/paste key
events. I would like to be able to catch these and so I thought I would add
my own event handler to catch these keys so that visio does not process the
cut/copy/paste. I want to process this operation because I have special
configurations that need to be done.

Is making an event handler with the add advise going to do this or is there
a better way?

Thank you.
 
J

JuneTheSecond \)cotton.ocn.ne.jp>

Hi, I have an example to catch when you
are going to copy.
To try this code, put this code in ThisDocument,
and enter run mode, but not limited to key-in, sorry.

The message appears when you enter "Cntl+C"
or when you select menu "Copy".

Private WithEvents m_visApp As Visio.Application

Private Sub Document_RunModeEntered(ByVal doc As IVDocument)
Set m_visApp = ThisDocument.Application
End Sub

Private Sub m_visApp_EnterScope(ByVal app As IVApplication, ByVal nScopeID
As Long, ByVal bstrDescription As String)

If nScopeID = Visio.VisUICmds.visCmdUFEditCopy Then
MsgBox "Hi, you are going to copy!"
End If

End Sub

--
Best Regards.

JuneTheSecond
Now the Visual calculation is more visual.
http://www.geocities.jp/visualcalculation/english/index.html
 
D

David Parker

Don't forget Duplicate too...and Cut/Paste

JuneTheSecond )cotton.ocn.ne.jp> said:
Hi, I have an example to catch when you
are going to copy.
To try this code, put this code in ThisDocument,
and enter run mode, but not limited to key-in, sorry.

The message appears when you enter "Cntl+C"
or when you select menu "Copy".

Private WithEvents m_visApp As Visio.Application

Private Sub Document_RunModeEntered(ByVal doc As IVDocument)
Set m_visApp = ThisDocument.Application
End Sub

Private Sub m_visApp_EnterScope(ByVal app As IVApplication, ByVal nScopeID
As Long, ByVal bstrDescription As String)

If nScopeID = Visio.VisUICmds.visCmdUFEditCopy Then
MsgBox "Hi, you are going to copy!"
End If

End Sub

--
Best Regards.

JuneTheSecond
Now the Visual calculation is more visual.
http://www.geocities.jp/visualcalculation/english/index.html
 
S

Stumple

I actually ended up catching the keyboard events and did it that way. This is
nice too though! The problem I had was that I had no way to prevent visio
from performing the paste which I was doing internally with .Paste(). I have
figured a way around it but just for the knowledge is there anyway to keep
visio from making the paste?

Thanks.
 
J

JuneTheSecond \)cotton.ocn.ne.jp>

Stumple,

You have only to add ,,,
If nScopeID = Visio.VisUICmds.visCmdUFEditCut Then
MsgBox "Hi, you are going to cut!"
End If

If nScopeID = Visio.VisUICmds.visCmdUFEditPaste Then
MsgBox "Hi, you are going to paste!"
End If
and, if you include lines to delete the pasted shapes,
you might prevent anyone from pasting.

--
Best Regards.

JuneTheSecond
Now the Visual calculation is more visual.
http://www.geocities.jp/visualcalculation/english/index.html
 

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