Building custom menu for status bar button

I have added (using a javascript macro) a toolbarbutton element to the status bar with a menupopup element with the onpopupshowing attribute with the value of 'ko.uilayout.updateViewAsLanguageMenu(this)', so this button now acts just tlike as the supplied File Type button. Now, I want to create my own menu and items for use, rather than 'ko.uilayout.updateViewAsLanguageMenu(this)', and I want to know if there is a standard way, are there API methods, to build such a menu with items. Can anyone point me to an example, or give a short code example? Thanks.

There’s really not a whole lot to it, the function is triggered onpopupshowing, then that function just does whatever it needs to do. The popupshowing does not given you anything except the event, so if you want to add menu items you are manually modifying the DOM to do so.

I would recommend you have a look at our new SDK’s though, as they facilitate some of this process:

http://beta.docs.komodoide.com/SDK/api/commonjs

Ok, so just create a div and contents to be displayed, like in a normal browser, no special element names or attributes need to be used or anything? I looked at the documents but is there something in particular that I should look at as I didn’t see what commands facilitate the process.

Note Komodo is built in XUL, not HTML, so you should not be using divs. I would recommend you install the DOM Inspector addon to get a feel for how Komodo is structured.

Here’s an example of a menupopup being populated: https://github.com/Komodo/KomodoEdit/blob/master/src/chrome/komodo/content/statusbar.p.js#L605

Well, I can say that the code example was more useful than the docs. :slight_smile: Thanks!