I know Visual Studio has a Command system for creating custom keyboard shortcuts. Is there anything similar for Excel?
Is there a way to access the collection(s) of possible 'actions', including those that can be triggered by keyboard shortcuts or menu items? And if so, are there any events for detecting them?
The purpose of the add-in is to track excel feature usage, preferably including activation time and context, and whether or not the user activated it via keyboard or a menu.
Related
I have made an Excel add-in, which pops up a window either by window.open or Dialog API.
I just tested it in Excel for Mac: when the window is opened, it seems that we can NOT put the focus back to Excel or the add-in taskpane; we have to close the window before choosing Excel or the add-in taskpane.
Does anyone know if there is a way to enable switching focus between popup window and Excel?
The dialog window is a modal in nature that forces the user to interact with it before they can go back to using the parent add-in/Office host. For interaction that requires back-n-forth with Excel, task-pane is the right place for UI.
The dialog API is meant to always show the dialog on top of other items. In terms of modality, you are correct that in Windows the dialog allows you to still interact with the spreadsheet while in other platforms, like Mac or Online is fully modal (cannot switch back to the spreadsheet). My recommendation is to design your add-in accounting for multi-platform so assume the dialog is modal in all platforms. As Sudhi recommends in his response, if your interaction requires the user to use the add-in and the spreadsheet back and forth, using a pane is a better model.
I'm creating a native C++ Outlook add-in (.dll) and started my Visual Studio 2013 project using MS guidance. The idea is to get user input from a dialog box when the user clicks a Ribbon button and then act on the input after the dialog closes.
Where I need help is creating a Window in the ButtonClicked function. I've tried all the wrong ways which include MFC class wizard and ATL window (CAxDialogImpl). The common denominator is I don't have a valid parent window to create another window. Even if I get an active window handle from outlook.
Ideally, I wouldn't take a dependency on MFC but will use it if necessary. I'm looking for assistance creating a dialog/window, any ideas on how to achieve this?
I get C#/managed is the way to go, but the requirements dictate otherwise.
QI the Application.ActiveWindow property (it will be either Explorer or Inspector object) for IOleWindow and call IOleWindow::GetWindow().
Is it possible to override Excel keyboard shortcuts inside a custom task pane?
For instance I would like to capture the shortcut Ctrl+Space, but Excel already uses that shortcut inside a custom task pane, and the shortcut never reaches the KeyPressed event handler on my user control.
Other key combinations that Excel doesn't use reach my event handler just fine.
Is there a way to override this, maybe via the Windows API?
You can use the SetWindowsHookEx function from Windows API to set up a keyboard hook. But overriding the built-in keyboard shortcut is not a good idea. Anyway, you can read more about this and find a sample code in the Using shortcut keys to call a function in an Office Add-in article.
How does one go about handling events that cannot be accessed from the ribbon visual designer in visual studio?
For example I would like to handle a mouse movement into the activesheet or if a user switches between worksheets. How do I go about subscribing to that event? Is there any way to generate an event handler for these kinds of events (that don't involve controls in the ribbon) automatically in visual studio.
Ive spent quite a few hours trying to figure this out (I am new to VSTO and c#) with no luck.
Thanks a lot
Many excel objects expose events. Look into Worksheet and Workbook events for example:
http://msdn.microsoft.com/en-us/library/microsoft.office.tools.excel.worksheet_events.aspx
http://msdn.microsoft.com/en-us/library/microsoft.office.tools.excel.workbook_events.aspx
OSX allows user to add custom keyboard shortcuts for menu items. For instance you can define a custom keyboard shortcut for "Copy" and it will work for every application that has a menu item called Copy.
Is there a way to do this for GTK and/or KDE applications?
For KDE applications, it is possible for common keyboard shortcuts. To do this, open systemsettings and navigate to Standard Keyboard Shortcuts.
For example, here I change the shortcut for "activate next tab" to Ctrl-Tab (for consistency with Firefox):
This changes the shortcut in most tabbed KDE applications as well as tabbed dialog boxes. You can specify up to 2 alternative shortcuts for each action.
However, this only works for common shortcuts; you can't globally specify shortcuts for arbitrary menu-item captions.
I don't think GNOME applications have any such feature. You have to change the shortcuts individually (for each application). (Generally KDE is more customizable.)
Is there a way to set an absolute keyboard shortcut for an arbitrary menu item name that will be honored by any GTK+ application?
No.
Can you set a different global shortcut for Cut/Copy/Paste?
I suspect so. I didn't do the reading, but here's two promising links: making keyboard shortcuts in linux as uniform as the mac and change default/preference keyboard shortcuts like copy & paste
You can of course modify GTK+ applications to tweak their shortcuts. In the case of a GTK+ application whose GUI was designed with Glade, e.g. virt-manager, this could be ridiculously trivial.
I suggest you to take a look at xbindkeys and xdotool. Those are the automation tools which can help you to simulate certain keystrokes with customized shortcut.
By this means, though you don't really modify the original shortcuts, but you can still make your desired key combinations functional.