Your browser does not support JavaScript or its disabled!
Please turn it on, or be aware that some features on this website will not work correctly.
165
Bot Tabs Example #69
This will allow you to add tabs to your bot. I will not be supporting this.
This is an example only. If you do not know how to use it, then you shouldn't be using it.
Its not perfect but its an example. If you are coding your own interfaces you will know what to do with it.
You do not need the loop.
File: Tabs.lua | 762b | 20 lines.
rootWidget = g_ui.getRootWidget()
if rootWidget then
    ListWindow = UI.createWindow('tmpListsWindow', rootWidget)
    TabBar = ListWindow.tmpTabBar
    TabBar:setContentWidget(ListWindow.tmpTabContent)
    for v = 1, 4 do
        tmpPanel = g_ui.createWidget("tPanel") -- Creates Panel
        tmpPanel:setId("panelButtons" .. v) -- sets ID

        TabBar:addTab("Test" .. v, tmpPanel)  -- Adds the New Tab Button and links to the Panel from above.
        -- example button added.
        -- you will need to make your own layouts etc.for
        UI.Label("Test" .. v,tmpPanel)
        UI.Separator(tmpPanel)
        UI.Button("Test Talk" .. v, function()
            g_game.talk("test" .. v)
        end, tmpPanel)
        UI.Separator(tmpPanel)
    end
end
File: Tabs.otui | 515b | 24 lines.
tPanel < Panel
  margin: 3
  layout:
    type: verticalBox

tmpListsWindow < MainWindow
  !text: tr('Test Bars')
  size: 218 258
  @onEscape: self:hide()

  TabBar
    id: tmpTabBar
    anchors.top: parent.top
    anchors.left: parent.left
    anchors.right: parent.right

  Panel
    id: tmpTabContent
    anchors.top: tmpTabBar.bottom
    anchors.left: parent.left
    anchors.right: parent.right
    anchors.bottom: parent.bottom
    image-source: /images/ui/panel_flat
    image-border: 5

17 Nov 2021