XUL questions

Hi. I start developing a komodo extension. At now
i work with gui. I need to past a menupopup into Tools
(menupopup#popup_tools). How i can made this?
I try to paste something like this:

<menupopup id="menu_myskin">
        <menuitem id="menu_myskin" label="RGB to BGR" class="menu-iconic-wide" observes="RGB:BGRTORGB"/>
    </menupopup>

Into menupopup#popup_tools, but it’s not give me a result.

Huh, i find it. You must create the structure like this:

menu > menupopup > menuitem

Assuming this is an overlay yo uneed to ensure that the root element matches the ID of the element that you are trying to overlay (extend), eg. <menupopup id="popup_tools">.

Why it’s happens? I don’t want to see the textbox with 100% height of window.

We can’t possibly tell unless you share the source with us. I’m guessing you might be using a vbox where you meant to use a hbox.

1 Like

Well, when i replace hbox to vbox, i get a normal textbox! Thanks

Hi. How I can add a keybind for my command? E.g. Ctrl+Shift+/ calls my function myobject.myfunc('myarg');
And of course I want that user can change keybind from Preferences - Key bindings (for this I think I must override pref-ui.xul with my custom pref-ui.xul)

I found. I just use addEventListener and special function that call another functions if I press alt+[key].
My special manipulator:

shortcut: function (e) {
                var k = e.keyCode;
                if (e.altKey) {
                        switch(k) {
                                case 192:
                                        [objectname].[object-function]();
                                        break;
                                //etc
                        }
                }
        }

With “this” instead of [objectname] - not work.

That’s not an ideal approach as it would be invoking your code every time someone presses a key regardless fo whether it is the keys you are looking for. However I don’t believe there is a simple way to create keybindings in a macro at the moment, though this will be available in Komodo 9.

It’s not a macro. It’s a normal extension with custom xuls, styles and javascript files.
Anyway, I create a special menu with special button that enable/disable keybindings :slight_smile:

In that case have a look at the following code as an example:

https://github.com/Komodo/KomodoEdit/blob/trunk/src/modules/breadcrumbs/content/overlay/komodo.p.xul#L110

Lines 110 through 132.

Thanks, I watch this code later :smile:

There are any method to create a custom tooltip with custom list of items via JavaScript?

It depends on the list and what you need to do with it.

We have ko.dialogs.selectFromList() for a generic list of strings.

Otherwise, you might want to create your own UI through DOM manipulation, similar to what the incremental numbering macro does:

Cheers,
Todd

I think ko.dialogs.selectFromList() it’s what I need. I try this, thanks.
But where I can get information about ko.dialogs.selectFromList()?
Also this function generate a popup like code-autocomplite?
Uh, I’m check this function and it’s not that I want.

Up :stuck_out_tongue_winking_eye:

Huh…
http://code.activestate.com/recipes/577012-komodo-js-macro-show-custom-code-completions/
I have a idea - create a page contains something useful tips for developers :smile:

We have the Komodo resources for that:

There is also a recipe set for Komodo macros:

and we have our github macros page for a good set of examples:

Cheers,
Todd

1 Like

Second and third link contains is really good stuff! Thanks.

Note I believe all the macros covered on the third link are already on the Resources section.

The second like (recipes) is technically not deprecated yet but I wouldn’t exactly call it maintained. If you want to submit macros I’d strongly urge to use the Resources section.