Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local g_Root = getRootElement()
- local g_ResRoot = getResourceRootElement(getThisResource())
- --local g_Me = getLocalPlayer()
- local g_Gui = nil
- function guiCmd()
- if not g_Gui or not guiGetVisible(g_Gui._root) then
- showGUI()
- else
- hideGUI()
- end
- end
- addCommandHandler("gui", guiCmd)
- function showGUI()
- if not g_Gui then
- buildGUI()
- else
- guiSetVisible(g_Gui._root, true)
- end
- showCursor(true)
- end
- function buildGUI()
- g_Gui = build_window()
- if g_Gui._placeHolders.frame_2 then
- local rect = g_Gui._placeHolders.frame_2
- g_Gui.manualLabel = guiCreateLabel(rect.left, rect.top, rect.width, rect.height, "Manually added label", false, rect.parent)
- guiLabelSetColor(g_Gui.manualLabel, 0, 255, 0)
- end
- if g_Gui.dynScrollArea then
- g_Gui.dynamicWidgets = {}
- local top = 0
- for i=1,20 do
- local widget, width, height = build_widget(g_Gui.dynScrollArea, 0, top)
- guiSetText(widget.label, string.format("Dynamic item #%d", i))
- table.insert(g_Gui.dynamicWidgets, widget)
- top = top + height
- end
- end
- end
- function hideGUI()
- if not g_Gui then
- return
- end
- guiSetVisible(g_Gui._root, false)
- showCursor(false)
- end
- function on_closeBtn_clicked(button, state, absoluteX, absoluteY)
- if (button ~= "left") or (state ~= "up") then
- return
- end
- hideGUI()
- end
Advertisement
Add Comment
Please, Sign In to add comment