popup menu

RoboFont Forums Help / General popup menu

This topic contains 1 reply, has 2 voices, and was last updated by  frederik 6 years, 6 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #5865

    Jeremie
    Member

    Hello,

    Is there a way to add a contextual popup menu in a tool with vanilla or mojo.UI ? or is it possible to use NSMenu?

    thanks !

    #5866

    frederik
    Keymaster

    the easiest is to add items to the popup (only in a subclass of the EditingTool)

    off course you can always use NSMenu and pop up a menu in a view at specific location

    from mojo.events import EditingTool, installTool
    
    class TestTool(EditingTool):
        
        def additionContectualMenuItems(self):
            
            return [("Test item", self.callback), ("submenu", [("Test Item", self.callback), ("Test Item 2", self.callback)])]
            
        def callback(self):
            print "hello world"
            
    installTool(TestTool())
    
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.