General > Developers Corner

how do i make the ulx motd open up with tabs?

(1/6) > >>

DooBiiE:
im trying to make my motd have tabs, for rules/forum/etc


--- Code: --- <html>

local FrameColor = Color(255, 255, 255, 255) --You can set your own frame color, remember to decrease the alpha value.
local ButtonColor = Color(255, 0, 0, 255) --You can set your own button color, remember to decrease the alpha value.

function OpenMOTDMenu()

local MenuFrame = vgui.Create("DFrame")
MenuFrame.OPaint = MenuFrame.Paint
MenuFrame:SetSize(ScrW() * 0.95, ScrH() * 0.95)
MenuFrame:SetPos((ScrW() - MenuFrame:GetWide()) / 2, (ScrH() - MenuFrame:GetTall()) / 2)
MenuFrame:SetTitle("Welcome to " .. GetHostName())
MenuFrame:SetVisible(true)
MenuFrame:SetDraggable(true)
MenuFrame:ShowCloseButton(true)
MenuFrame.Paint = function()
MenuFrame.OPaint(MenuFrame)
surface.SetDrawColor(Color(60, 60, 60, 255))
surface.DrawLine(1, MenuFrame:GetTall() - 27, MenuFrame:GetWide() - 1, MenuFrame:GetTall() - 27)
draw.RoundedBox( 6, 0, 1, MenuFrame:GetWide(), MenuFrame:GetTall() + 1, FrameColor )
end
MenuFrame:MakePopup()

local CloseButton = vgui.Create("DButton", MenuFrame)
CloseButton.OPaint = CloseButton.Paint
CloseButton:SetSize(150, 35)
CloseButton:SetPos(MenuFrame:GetWide() * 0.75, MenuFrame:GetTall() - 27 - CloseButton:GetTall()/2)
CloseButton:SetText("Ok, now let me play!")
CloseButton.Paint = function()
    CloseButton.OPaint(CloseButton)
    surface.SetDrawColor(ButtonColor)
    surface.DrawRect(1, 1, CloseButton:GetWide() - 2, CloseButton:GetTall() - 2)
end
CloseButton.DoClick = function(button)
MenuFrame:Close()
end

local MenuPSheet = vgui.Create("DPropertySheet", MenuFrame)
MenuPSheet:SetPos(13, 30)
MenuPSheet:SetSize(MenuFrame:GetWide() - 25, MenuFrame:GetTall() - 84)

local MOTD = vgui.Create( "HTML", MenuFrame )
MOTD:SetPos( 25, 50 )
MOTD:SetSize( 250, 250 )
--MOTD:SetHTML([[]]) --use this for custom html code
MOTD:OpenURL("http://steamcommunity.com/groups/JustAwesomeGaming") -- JustAwesomeGaming steam group/

local Rules = vgui.Create( "HTML", MenuFrame )
Rules:SetPos( 25, 50 )
Rules:SetSize( 250, 250 )
--Rules:SetHTML([[]]) --use this for custom html code
Rules:OpenURL("") -- or this if you want to open an URL, remember that you must pick only one

local AdminList = vgui.Create( "HTML", MenuFrame )
AdminList:SetPos( 25, 50 )
AdminList:SetSize( 250, 250 )
--AdminList:SetHTML([[]]) --use this for custom html code
AdminList:OpenURL("") -- or this if you want to open an URL, remember that you must pick only one

local GroupPage = vgui.Create("HTML")
GroupPage:SetParent(MenuPSheet)
GroupPage:SetPos( 25, 50 )
GroupPage:SetSize( 250, 250 )
--GroupPage:SetHTML([[]]) --use this for custom html code
GroupPage:OpenURL("http://steamcommunity.com/groups/JustAwesomeGaming") -- or this if you want to open an URL, remember that you must pick only one

local Forums = vgui.Create( "HTML", MenuFrame )
TabName:SetPos( 25, 50 )
TabName:SetSize( 250, 250 )
--TabName:SetHTML([[]]) --use this for custom html code
TabName:OpenURL(http://www.jagaming.co.uk/") -- or this if you want to open an URL, remember that you must pick only one

local Donations = vgui.Create( "HTML", MenuFrame )
TabName:SetPos( 25, 50 )
TabName:SetSize( 250, 250 )
--TabName:SetHTML([[]]) --use this for custom html code
TabName:OpenURL("") -- or this if you want to open an URL, remember that you must pick only one

--You can add your own tabs down here
/*EXAMPLE:
local TabName = vgui.Create( "HTML", MenuFrame )
TabName:SetPos( 25, 50 )
TabName:SetSize( 250, 250 )
--TabName:SetHTML([[]]) --use this for custom html code
--TabName:OpenURL("") -- or this if you want to open an URL, remember that you must pick only one
*/

--You can chane the popup order here, or add your own tab!

local order = {}
order[1] = {"Group Page", GroupPage, "gui/silkicons/group", false, false, "Group page here"}
order[2] = {"Rules", Rules, "gui/silkicons/exclamation", false, false, "Rules are listed here"}
order[3] = {"MOTD", MOTD, "gui/silkicons/page", false, false, "Message of the day"}
order[4] = {"Admin List", AdminList, "gui/silkicons/shield", false, false, "Admins are listed here"}
--order[5] = {"A name", TabName, "gui/silkicons/page", false, false, "A description"}

for _, tab in pairs(order) do
MenuPSheet:AddSheet(unpack(tab))
end

end

concommand.Add("showmotdmenu", OpenMOTDMenu)

</html>
 
--- End code ---

this is my code, when the motd loads it just loads as is, i was wondering how to make it display as a tabbed motd?

Marshy:
bump
would also like info on this please :)

MrPresident:
This isn't something ULX can do. You can, however, modify the MOTD panel yourself if you are so inclined.

Here is the control element to created a tabbed panel.

http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/indexb285.html

It's a fairly simple process. You would just create tabbed panels as the example in the wiki shows and then parent an HTML frame to each of the individual panels.

Marshy:
oh so it's just a normal dpanel sweet

thanks for this

leon.

MrPresident:
Sure thing, it's fairly easy to do. If you can't figure it out, let me know how many tabs you want and I can throw something together for you when I have a moment.

Navigation

[0] Message Index

[#] Next page

Go to full version