Author Topic: how do i make the ulx motd open up with tabs?  (Read 17191 times)

0 Members and 1 Guest are viewing this topic.

Offline DooBiiE

  • Newbie
  • *
  • Posts: 10
  • Karma: 0
how do i make the ulx motd open up with tabs?
« on: March 10, 2013, 11:56:13 AM »
im trying to make my motd have tabs, for rules/forum/etc

Code: [Select]
<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>
 

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?

Offline Marshy

  • Newbie
  • *
  • Posts: 13
  • Karma: 0
Re: how do i make the ulx motd open up with tabs?
« Reply #1 on: May 20, 2013, 02:24:43 AM »
bump
would also like info on this please :)

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: how do i make the ulx motd open up with tabs?
« Reply #2 on: May 20, 2013, 07:11:39 AM »
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.

Offline Marshy

  • Newbie
  • *
  • Posts: 13
  • Karma: 0
Re: how do i make the ulx motd open up with tabs?
« Reply #3 on: May 20, 2013, 08:04:02 AM »
oh so it's just a normal dpanel sweet

thanks for this

leon.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: how do i make the ulx motd open up with tabs?
« Reply #4 on: May 20, 2013, 08:10:25 AM »
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.

Offline Vilusia

  • Newbie
  • *
  • Posts: 7
  • Karma: -1
Re: how do i make the ulx motd open up with tabs?
« Reply #5 on: May 21, 2013, 08:36:26 AM »
Hey would it be possible if you could make one with 3 tabs?
I tried doing it myself but I'm new to lua and I'm still learning. Derma is not my strong point :P
Thanks.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: how do i make the ulx motd open up with tabs?
« Reply #6 on: May 21, 2013, 09:35:31 AM »
Sure, give me time, I'm at work right now. What do you want the 3 tabs to be? What URLs do you want them to point to?

Offline Vilusia

  • Newbie
  • *
  • Posts: 7
  • Karma: -1
Re: how do i make the ulx motd open up with tabs?
« Reply #7 on: May 21, 2013, 01:34:14 PM »
Forum
www.vnbgameservers.net
Donate
http://www.vnbgameservers.net/misc.php?action=payments
Rules
http://www.vnbgameservers.net/thread-58.html

Thanks for doing this. I will study your code so I can better myself in the future. :)

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: how do i make the ulx motd open up with tabs?
« Reply #8 on: May 21, 2013, 05:50:12 PM »
Make sure your ULX and ULib are up to date with the most recent SVN and then replace this file:

replace all the code in this file with
addons/ULX/lua/ulx/modules/cl/motdmenu.lua

Code: [Select]
ulx.motdmenu_exists = true

local isUrl
local url

function ulx.showMotdMenu()
local url1 = "www.vnbgameservers.net"
local url2 = "http://www.vnbgameservers.net/misc.php?action=payments"
local url3 = "http://www.vnbgameservers.net/thread-58.html"

local window = vgui.Create( "DFrame" )
if ScrW() > 640 then -- Make it larger if we can.
window:SetSize( ScrW()*0.9, ScrH()*0.9 )
else
window:SetSize( 640, 480 )
end
window:Center()
window:SetTitle( "ULX MOTD" )
window:SetVisible( true )
window:MakePopup()

local tabmenu = vgui.Create( "DPropertySheet", window )


local html1 = vgui.Create( "HTML" )
local html2 = vgui.Create( "HTML" )
local html3 = vgui.Create( "HTML" )

local button = vgui.Create( "DButton", window )
button:SetText( "Close" )
button.DoClick = function() window:Close() end
button:SetSize( 100, 40 )
button:SetPos( (window:GetWide() - button:GetWide()) / 2, window:GetTall() - button:GetTall() - 10 )

tabmenu:SetSize( window:GetWide() - 20, window:GetTall() - button:GetTall() - 50 )
tabmenu:SetPos( 10, 30 )

html1:SetSize( window:GetWide() - 30, window:GetTall() - button:GetTall() - 70 )
html1:SetPos( 15, 50 )
html1:OpenURL( url1 )

html2:SetSize( window:GetWide() - 30, window:GetTall() - button:GetTall() - 70 )
html2:SetPos( 15, 50 )
html2:OpenURL( url2 )

html3:SetSize( window:GetWide() - 30, window:GetTall() - button:GetTall() - 70 )
html3:SetPos( 15, 50 )
html3:OpenURL( url3 )

tabmenu:AddSheet( "Forum", html1, _, false, false, _)
tabmenu:AddSheet( "Donate", html2, _, false, false, _)
tabmenu:AddSheet( "Rules", html3, _, false, false, _)
end

function ulx.rcvMotd( isUrl_, text )
isUrl = isUrl_
if not isUrl then
ULib.fileWrite( "data/ulx_motd.txt", text )
else
if text:find( "://", 1, true ) then
url = text
else
url = "http://" .. text
end
end
end

Offline Vilusia

  • Newbie
  • *
  • Posts: 7
  • Karma: -1
Re: how do i make the ulx motd open up with tabs?
« Reply #9 on: May 21, 2013, 06:02:56 PM »
Thanks so much! You are amazing!

Offline Marshy

  • Newbie
  • *
  • Posts: 13
  • Karma: 0
Re: how do i make the ulx motd open up with tabs?
« Reply #10 on: May 22, 2013, 07:24:29 AM »
awesome work mr president

ho could i add fma fam fam icon on the tabs?

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: how do i make the ulx motd open up with tabs?
« Reply #11 on: May 22, 2013, 07:44:13 AM »
Take a look at the link I posted a couple of posts up. There is a field in the :AddSheet function where you can assign a silkicon. I left it null, but you can add them if you want.

Offline Marshy

  • Newbie
  • *
  • Posts: 13
  • Karma: 0
Re: how do i make the ulx motd open up with tabs?
« Reply #12 on: May 22, 2013, 12:10:00 PM »
heya sorry to be a pain but ive looked at the dpanel wiki and cant make sence :/

help?

thanks in advanced,
Leon.







Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: how do i make the ulx motd open up with tabs?
« Reply #13 on: May 22, 2013, 01:59:32 PM »
heya sorry to be a pain but ive looked at the dpanel wiki and cant make sence :/

help?

thanks in advanced,
Leon.
You're hijacking someone elses thread that quite reasonably had questions answered....'what' are you wanting 'help' with.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: how do i make the ulx motd open up with tabs?
« Reply #14 on: May 22, 2013, 04:50:13 PM »
I think he was referring to his post before my last one asking how to add the silkicons to the tabs. Did you even look at the wiki article for the DPropertySheet:AddSheet()

It's fairly self explanatory.