• Print

Author Topic: XGUI settings tabs  (Read 6598 times)

0 Members and 1 Guest are viewing this topic.

Offline bender180

  • Full Member
  • ***
  • Posts: 217
  • Karma: 42
    • Benders Villa
XGUI settings tabs
« on: August 31, 2014, 09:57:37 am »
Well after searching around the forums I found that xgui has no docs, so i figured I'd ask here and hope someone can help me, I want to create a tab in xgui for the ttt cvars, basically identical to the one stickly made for the sbox ones. I'm having a rough time figuring out how stickly did this, if anyone could kick me in the right direction that would be great.
Made community pool and community bowling and for the life of me couldn't tell you why they are popular.
Also made the ttt ulx commands.

Offline Neku

  • Hero Member
  • *****
  • Posts: 549
  • Karma: 27
Re: XGUI settings tabs
« Reply #1 on: August 31, 2014, 11:11:34 am »
Isn't there a lua file specifically for that sandbox tab?
Out of the Garry's Mod business.

Offline bender180

  • Full Member
  • ***
  • Posts: 217
  • Karma: 42
    • Benders Villa
Re: XGUI settings tabs
« Reply #2 on: August 31, 2014, 04:50:20 pm »
yea there is but I'm having an issue understanding most of it...
Made community pool and community bowling and for the life of me couldn't tell you why they are popular.
Also made the ttt ulx commands.

Offline Neku

  • Hero Member
  • *****
  • Posts: 549
  • Karma: 27
Re: XGUI settings tabs
« Reply #3 on: August 31, 2014, 08:24:30 pm »
In that case, I think Stickly is going to need to explain a bit, as I don't understand most of it as well. :-\
Out of the Garry's Mod business.

Offline Stickly Man!

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 1270
  • Karma: 164
  • What even IS software anymore?
    • XGUI
Re: XGUI settings tabs
« Reply #4 on: September 02, 2014, 12:21:14 pm »
Sorry I haven't seen this yet- been quite busy as of late :P

Really, all you need to set up a gamemode-specific module for XGUI is to create a file in your gamemode or addon's lua/ulx/xgui/gamemodes/ folder, and name it the EXACT same name as the folder name of the gamemode you want to use. (Likely ttt.lua). The "magic" for this happens here, if you want to see how XGUI loads it.

From there, the only required thing you have to do is have these two lines of code in your ttt.lua file:
Code: Lua
  1. local nameofyourpanel = xlib.makepanel{ parent=xgui.null }
  2.  
  3. -- Your code to create the UI here
  4.  
  5. xgui.addSettingModule( "TTT", nameofyourpanel, "icon16/box.png", "xgui_gmsettings" )
  6.  

.. Where "nameofyourpanel" will be a oddly sized panel you can affix Derma elements to, "TTT" is the text that appears on the tab, "icon16/box.png" is the icon that shows on your tab, and "xgui_gmsettings" is your required permissions level to be able to access it.

That's it!

How you go about creating your list of CVars is entirely up to you- you could copy what I did with the sandbox settings, but it pulls in lists of limits from a file that's stored on the sever (the serverside code for that is here). Feel free to ask more questions- I will try to respond as quickly as possible :P
Join our Team Ulysses community discord! https://discord.gg/gR4Uye6

Offline bender180

  • Full Member
  • ***
  • Posts: 217
  • Karma: 42
    • Benders Villa
Re: XGUI settings tabs
« Reply #5 on: September 11, 2014, 06:21:06 pm »
Thanks for the help stickly, im starting to understand how xgui works :P (I've never done any vgui before) that said how can I make a tooltip appear when the user hovers on say a slider?
Made community pool and community bowling and for the life of me couldn't tell you why they are popular.
Also made the ttt ulx commands.

Offline bender180

  • Full Member
  • ***
  • Posts: 217
  • Karma: 42
    • Benders Villa
Re: XGUI settings tabs
« Reply #6 on: September 11, 2014, 08:32:04 pm »
I figured it out with some trial and error.

I'm having one other issue with Collapsible Categories if i want to have multiple on one panel how can i make it so the other categories move down when one is opened? right now i have 2 of them moving with each other but when the top one is closed the others disappear with it.
« Last Edit: September 15, 2014, 05:09:59 pm by bender180 »
Made community pool and community bowling and for the life of me couldn't tell you why they are popular.
Also made the ttt ulx commands.

  • Print