Categories
Felix tips

Felix tip: Use a macro to give Felix focus

The latest version of Felix (1.6.4) has an expanded COM API. One of the new things you can do with this API is control the size and focus of the memory and glossary windows.

As an example, here is a Word macro that will raise Felix to the top of your screen, while keeping the keyboard focus in Word. This is useful if you return to Word after an internet search, etc., and don’t want to go searching around for the Felix window.

Sub ActivateFelix()

    Dim felix As Object
    Set felix = CreateObject("Felix.App")
    felix.Visible = True
    Call felix.app2.MemoryWindow.Raise

End Sub

Now if you assign a keyboard shortcut for this (in Word 2010, it would be File >> Options >> Customize Ribbon >> “Customize” keyboard shortcuts button, then select Macros >> ActivateFelix >> “your keyboard shortcut”).

You could also create a “document changed” event handler, so that every time Word gets focus, Felix is raised to be visible. The code for this is a bit too involved for this blog post, but you can see the Microsoft documentation for how to write document event handlers.

In a future release of Felix, I plan on making functionality similar to this (also remembering the widow sizes and positions) available as a Felix option.

I’ll be updating the API documentation soon with all the new stuff, but for the meantime, here are the APIs for the memory and glossary windows:

App.App2.MemoryWindow:

  • Raise (method)
  • Left (int)
  • Top (int)
  • Width (int)
  • Height (int)

App.App2.GlossaryWindow:

  • Raise (method)
  • Left (int)
  • Top (int)
  • Width (int)
  • Height (int)

One reply on “Felix tip: Use a macro to give Felix focus”

Leave a Reply

Your email address will not be published. Required fields are marked *