Announcement

Collapse
No announcement yet.

Own button opening a custom window/tab

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Own button opening a custom window/tab

    Hey,

    I'm working with OX community edition and try to integrate an own plugin.

    I already studies the plugin-page and I understood the SMS-button in the contacts-panel. But I can't find a guide or a hint to add these buttons to a different tab (actually it's in the "new-tab") or to the E-Mail-Section.

    The second problem for me is opening a new custom window with labels, buttons etc. I only found how to add own configuration-tabs.

    The guides are a bit outdated sometimes but I want to learn

  • #2
    For the menu, see this post.

    For opening a new window, just use window.open() with your own HTML page as URL. This page can reuse scripts and CSS files of the GUI to get the same look as the main window.

    Comment


    • #3
      Isn't it possible to create an own inside-window like OX does e.g. with a new-mail-window?

      Comment


      • #4
        ox.api.mail.open(); does open the new-mail-window. But where is this function defined to look how the window i built?

        Comment


        • #5
          Then you want to use ox.api.window.open(). The first aprameter is the path to your HTML file, the second parameter is an options object. See js/api.js around line 1800 for details.

          Comment


          • #6
            Great, that's exactly what I was looking for

            Now there is a new question. Which parameter has to be changed (from the own-panel-button-example) to add the button to the edit-tab and not the new-tab? And how do I make a big button instead of the small ones?

            Comment


            • #7
              I'm not sure which example you mean, but the buttons appear in the section to which they are added. The default sections are stored in ox.widgets.toolBar.sections.

              The option to create a big button is a boolean called "big":
              Code:
              var button = new ox.gui.MenuItem({ big: true, ... })

              Comment


              • #8
                Ok, the function MenuNodes.createBigButtonContext contains this value. But only using
                Code:
                MenuNodes.createBigButtonContext ( "myId", "mailEdit", "themes/default/img/menu/btn_save.gif", alert("This is my own big button") );
                is not enough i guess, because it's not working :/

                I meant this example here: http://oxpedia.org/wiki/index.php?ti...s_in_the_panel

                Comment


                • #9
                  Well, this works for adding a big button to the new-tab in the mail section

                  Code:
                  var section = MenuNodes.contexts["moveid"] = { node: new ox.gui.PanelMenuSection("movemail") };
                  
                  var item = ox.widgets.toolBar.menuItems["moveid"] = new ox.gui.MenuItem({
                      id: "moveid",
                      title: "MoveMailTitle",
                      icons: "themes/default/img/menu/btn_save.gif",
                      big: true,
                      action: null
                  });
                  
                  
                  section.node.add(item);
                  
                  changeDisplay("mail", "moveid");
                  But I want it to the edit-tab. changeDisplay("mailedit", "moveid"); or changeDisplay("mailEdit", "moveid"); doesn't work

                  Comment


                  • #10
                    MenuNodes is wrapper for backward compatibility. The old API had no notion of multiple tabs, and that's why all buttons land on the first tab.
                    The tab-based code is implemented in js/wtk/classes/, with examples of how it's used in js/wtk/.

                    Comment


                    • #11
                      ok, I guess I understand the tab-based code, but I don't get how to add only one button to an existing tab. I need the $p, but $p = ox.gui.initToolBar(). If I use this, I create a second ToolBar at the top. And $p.add only adds a whole tab, e.g. the edit-tab. Do I have to rebuild everything just to add one button?

                      Comment


                      • #12
                        Is there no way to get this done? I don't believe that it is impossible.

                        Comment


                        • #13
                          Look at the member of ox.widgets.toolBar. All default tabs and sections are stored there.

                          Comment

                          Working...
                          X