Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Suppress keyboard shortcuts

73 views
Skip to first unread message

Roger

unread,
Mar 30, 2006, 5:59:02 AM3/30/06
to
Does anyone know anyway of stopping certain keyboard shortcuts being
processed by the Visio Drawing Control? For example, I'd rather have F1
access the help system for my app rather than the Visio help system and I'd
like to direct Ctrl+F to my application rather than to the Visio find dialog.
I've already tried many different alternatives including setting
cancelDefault in the keydown and keyup events.

Many thanks
Roger Billsdon

Chris [Visio MVP]

unread,
Mar 30, 2006, 5:50:50 PM3/30/06
to
This sub gets rid of ALL of the keyboard shortcuts. Perhaps you'll be able
to figure out exactly which one is "F1"

Private Sub m_removeAllKeyboardShortcuts(ByRef visDoc As Visio.Document)

'// Get a the ui object:

Dim ui As Visio.UIObject = visDoc.Application.BuiltInMenus.Clone '.Clone

Dim accTbl As Visio.AccelTable

'// For each menu context:

For iCtx As Integer = 0 To ui.AccelTables.Count - 1

accTbl = ui.AccelTables.Item(iCtx)

Debug.WriteLine("----" & accTbl.TableName & "----")

'// For each accel item in the context:

For i As Integer = accTbl.AccelItems.Count - 1 To 1 Step -1

accTbl.AccelItems.Item(i).Delete()

Next

Next

visDoc.SetCustomMenus(ui)

End Sub


--
Hope this helps,

Chris Roth
Visio MVP


"Roger" <Ro...@discussions.microsoft.com> wrote in message
news:7047CF26-DC28-4CCA...@microsoft.com...

Roger

unread,
Mar 31, 2006, 1:36:02 AM3/31/06
to
Hello Chris
Many thanks for the suggestion, but unfortunately this approach doesn't work
with the Visio Drawing Control. I've also tried many variations on this theme
and manipulating the commandbars.

Among my other ideas was overriding the ProcessCmdKey, PreProcessMessage and
other functions for the Visio Drawing Control and the containing form. I
thought this might provide a means of trapping short-cut keys before they
were processed by the Visio Drawing Control. But no success.

I found a discussion between JuneTheSecond and xargon dated April 2005 on
Visio Drawing Control keypress event handling problems, but no solution was
reported.

Any further comments would be very welcome.
Many thanks
Roger Billsdon

Chris [Visio MVP]

unread,
Mar 31, 2006, 4:34:47 AM3/31/06
to
I did this explicitly WITH the Visio control.


"Roger" <Ro...@discussions.microsoft.com> wrote in message

news:B8EEC8F6-63D7-4801...@microsoft.com...

Roger

unread,
Mar 31, 2006, 6:15:01 AM3/31/06
to
Chris
My sincere apologies, my version must have had some subtle difference
because I've tried your version again and it works perfectly.

Checking the accelerator item's Alt, Shift and Control properties plus
comparing the Key property with the Keys enumeration enables you to find the
short-cut keys you specifically need to disable. An alternative would be to
check the CmdNum property.

0 new messages