Garry's Mod

Garry's Mod

[E2] Vgui Core
54 Comments
Linus  [author] 4 May @ 4:03pm 
@cirro
I've never used the DHTML element myself.
I took a quick look and security might be a problem. As I understand it the website gets loaded by the client that creates the DHTML element.
Therefore it allows the e2-creator to open any URL on any other player, which is something I'm not willing to implement.

That said. It might be possible to allow only the e2-owner to use DHTML elements but block it on other players or add additional features to the buddy system to explicitly allow the usage of DHTML elements.
Aside from that, there seems to be a feature that allows Javascript to execute Lua code which also might present security problems (I took note that you can disable this specific funtionality though)
I will have to look into it a bit more.

Do you have any specific use cases in mind for DHTML which would help me understand what features you need?
cirro 31 Mar @ 8:48am 
might be outside the scope of this addon, but is there any way we can get dhtml?
Linus  [author] 26 Nov, 2023 @ 10:33pm 
Thanks for bringing this to my attention. I will try to get it fixed within the next few days, I'm currently a bit busy. The fix itself seems to be pretty simple though. Someone already made a pull request on GitHub (thanks for that).
Kerk 24 Nov, 2023 @ 12:44pm 
Adding on back to my previous comment, I think the new Wiremod update broke the addon. Not 100% sure but It seemed to have stopped working since.
Kerk 21 Nov, 2023 @ 7:48pm 
BUG:
For some reason VGUI core just stopped working entirely. None of the functions or anything show up in expression 2, and it makes errors whenever I try to spawn any of my dupes using VGUI core. The spawnmenu extensions still exist, like the buddies and blacklist menu, but the core is just non-existent in the editor.
Linus  [author] 15 Mar, 2022 @ 2:43am 
@LoganDark
That "duplicate column" error is something I can't really fix. It happens when you try to create columns which use the same index (e.g. add 2 columns without index and then add another one with index 1)

See: https://github.com/Facepunch/garrysmod/blob/master/garrysmod/lua/vgui/dlistview.lua#L71

I'm unsure what causes the second error, can you provide a simple code example to reproduce this (in a new issue on github) ?
LoganDark 10 Mar, 2022 @ 4:04pm 
Also, a couple of errors:

[[E2] Vgui Core] Attempted to insert duplicate column.
1. AddColumn - lua/vgui/dlistview.lua:71
2. unknown - lua/autorun/client/cl_vgui_lib.lua:75
3. applyAttributes - lua/autorun/client/cl_vgui_lib.lua:170
4. createFunc - vgui_elements/client/dlistview.lua:8
5. func - lua/autorun/client/cl_e2_vgui_netmessage.lua:33
6. unknown - lua/includes/extensions/net.lua:33

[[E2] Vgui Core] lua/autorun/client/cl_vgui_lib.lua:79: attempt to index local 'column' (a nil value)
1. unknown - lua/autorun/client/cl_vgui_lib.lua:79
2. applyAttributes - lua/autorun/client/cl_vgui_lib.lua:170
3. createFunc - vgui_elements/client/dlistview.lua:8
4. func - lua/autorun/client/cl_e2_vgui_netmessage.lua:33
5. unknown - lua/includes/extensions/net.lua:33
LoganDark 10 Mar, 2022 @ 3:59pm 
This addon's missing the ability to set the minimum size of a frame (https://wiki.facepunch.com/gmod/DFrame:SetMinWidth / https://wiki.facepunch.com/gmod/DFrame:SetMinHeight) , missing the ability to detect when a frame's close button is clicked (even when delete on close is set to 0), missing the ability to turn off clipping for panels (https://wiki.facepunch.com/gmod/Panel:NoClipping)

It also has some edge cases where panels created by an E2 can be stuck on-screen forever even when the E2 is deleted. There needs to be a console command to clear all E2 VGUIs
Linus  [author] 22 Jul, 2020 @ 11:59am 
I've added some examples for idividual elements such as dslider, dcombobox, dbutton on the wiki here [github.com].
I will add more example in the future but if you need help with anything specific just post a comment here or ask me on the Official Wiremod Discord @Linus
Elitedino 20 Jul, 2020 @ 3:08pm 
thanks for the quick response, i'm still quite confused on how to print out what data was collected
Linus  [author] 20 Jul, 2020 @ 2:29pm 
cb:getValue(vguiClkPlayer())/xcb:getData(vguiClkPlayer()) should return the selected data
If that's not working I will have a look at it tomorrow.
Also I will try to add a wiki page for every component explaining how to use it in detail.

Here are all functions for the
ComboBox [github.com]
Elitedino 20 Jul, 2020 @ 1:46pm 
is there any way to get a string output from a combo box cause i got it to display all players in the server, i'm just not sure how to get the output of the selected name
Mihoshika 20 Jul, 2020 @ 6:28am 
Thanks for the prompt implementation of requests~
Linus  [author] 17 Jul, 2020 @ 10:35am 
I added the requested things and also added a new page to the wiki.
The page gets auto-generates based on the source code and lists every every e2 function.
It's currently in an early stage so some things might not fully work yet.
Also note that some functions are not listed because of the way I register them in e2. (Mainly the functions mentioned here [github.com]).

Lastly, the page also also tells me what functions still need a description, which i will try to add in the following weeks.
But since most functions are self-explanatory or can be looked up in the ]gmod wiki [wiki.facepunch.com] it should at least now be easier to see what's implemented.
Mihoshika 14 Jul, 2020 @ 6:02am 
Spawn icon would be nice, as opposed to dmodelpanel which is super finicky to get good images that fully represent a prop.
Linus  [author] 23 Jun, 2020 @ 9:46am 
That should certainly be possible but currently I'm very busy so it might take a few more days or weeks.
reldesn 22 Jun, 2020 @ 10:50am 
Hello, sorry for asking for many things to be added, can we get a function to set column width inside of dlistview?
Linus  [author] 17 Jun, 2020 @ 2:29pm 
As far as i know the normal button icon always gets displayed on the left side.
I would need to implement a DImageButton [wiki.facepunch.com] for it to work.
I will see how much time i have but generally speaking its not much work.
0vector 15 Jun, 2020 @ 3:50pm 
@idiot
I haven't used E2 in a while but I'm subscribed to this thread, the last time I used E2 was a year ago, but I think if you just use vec2(256,256) it might center the icon. Not completely sure so if anyone has a better answer feel free to suggest it
reldesn 15 Jun, 2020 @ 3:30pm 
Is there any way to center an icon on a button? By default, the icon is set on the left of the button. Thanks.
Linus  [author] 11 Jun, 2020 @ 8:59am 
@twmatthew
I just added the buddy system a few days ago to make it more restrictive. But I understand that you might not always want that.
I will add a way to disable it.
aang 10 Jun, 2020 @ 9:23pm 
I know this is old, but is there a way to get rid of the buddy system? I want all players to be able to open the VGUI instead of those manually buddied
Linus  [author] 31 Dec, 2018 @ 3:46am 
It's no problem, also if there is something you don't understand, tell me and I'll see if i can add a wiki page for it on github.
David Know-rzejski 28 Dec, 2018 @ 5:03pm 
Im sorry for bothering you :P
Linus  [author] 28 Dec, 2018 @ 5:00pm 
When you create a button you have to assign it an index similar to egp objects.
For example dbutton(4) will create a button with the id 4.
David Know-rzejski 27 Dec, 2018 @ 8:58am 
Also idk what's my button id xD
Linus  [author] 27 Dec, 2018 @ 3:49am 
@Elite
You have to enable runOnVgui(1) and use the vguiClk() event to check if someone used a button.
You can use vguiClkPanelID() to get the ID of the element that was interacted with (e.g. the id you asigned to the button element in code) and use vguiClkPlayer() to see which player did the interaction, optionally you can use vguiClkValues()/vguiClkValuesTable() to retrieve the new values, for example the new value of a slider value or the selected entry in a listview
David Know-rzejski 23 Dec, 2018 @ 4:12pm 
How to get output from button?
Like im new to this, and these exaples aren't really helping :P
Linus  [author] 7 Dec, 2018 @ 5:27pm 
There is actually a limit on how many things you can create per tick similar to propCreate, check the console commands in the wiki on that. You would have to spread the creating of the panel over multiple ticks to make it work
Alexis(Mssun21) 7 Dec, 2018 @ 8:54am 
Linus any way to stop payers from being able to open the menu intell evrything is loaded because now and then i fine all my buttons do not load in.
Linus  [author] 7 Dec, 2018 @ 2:24am 
@Mr_Sum21 I'm currently not planning on implementing photos from Google photos or other internet related sources, sorry
Linus  [author] 7 Dec, 2018 @ 2:22am 
@Jared From Subway, you should just be able to do Slider:getValue(E), with E being the player you want to retrieve the value from.
0vector 2 Dec, 2018 @ 5:59am 
Was just wondering how I could actually get the data that is in the slider/text input stuff. (I'm new to VGUI but not E2)
Alexis(Mssun21) 26 Nov, 2018 @ 11:23pm 
Hi im trying to understand how to add Photos From Google To the Menu.
reldesn 20 Sep, 2018 @ 1:58pm 
I've got a few questions. Is there a way to update a frame or combobox without restarting the e2 itself? In the e2 I shared before (I've since updated quite a bit}, it adds people to a combo box from an array, however when I add them to the array the dcombobox list doesn't update. If what I said doesn't really make any sense add me on steam or discord: nate#9823 Also im still getting the same error from before
Linus  [author] 18 Sep, 2018 @ 1:51pm 
I will take a look at it tomorrow, thank you. Also I noticed that I really should start to rework the access stuff for panels. It's really annoying to work with xD
Guess you can expect an update on that in the next week or so
reldesn 18 Sep, 2018 @ 1:12pm 
@Linus It just happened to me again, It may be because the server im on hasnt restarted yet but heres the pastbin to my e2: https://pastebin.com/sLfMHcuz
Linus  [author] 18 Sep, 2018 @ 12:37pm 
@RIP BURT REYNOLDS
I did a little change to that line (#122) in the hope it won't happen again.
If you see any errors please report them and the E2 that causes the error (on pastebin or something).

It's really useful to me because i can't do that much testing on my own and i appreciate any feedback i can get, may it be good or bad xD
reldesn 18 Sep, 2018 @ 10:36am 
@Linus I have no clue how to recreate the error, it just happens randomly with no pattern
Linus  [author] 18 Sep, 2018 @ 9:38am 
@RIP BURT REYNOLDS
I'm not entirely sure whats the cause of this is, could you explain in more detail how you got the error and if its relevant to the problem maybe upload the E2 to pastebin or something (if possible a small chip that will recreate the error).
reldesn 16 Sep, 2018 @ 7:16pm 
Does anyone know what this error means? ' sv: Expression 2 (Toll): addons/tools/lua/autorun/server/vguicore.lua:122: Tried to use a NULL entity!'
⋆ ˚。 Megurine Luka ౨ৎ˚ 29 Jul, 2018 @ 10:39am 
Well thats very compicated then
Linus  [author] 29 Jul, 2018 @ 10:38am 
Its an extension for the Expression 2 tool from Wiremod. You have to write code in order to use it. As i said, i provided some examples on the github wiki page :)
⋆ ˚。 Megurine Luka ౨ৎ˚ 29 Jul, 2018 @ 10:24am 
to open a menu that creates these "gui's"
Linus  [author] 29 Jul, 2018 @ 10:04am 
What exactly do you mean with "open menu" ?
I added some examples to the github wiki page maybe thats helps you out.
I'm still working on the wiki and so it might take a while until everything is listed there but if you have any problems just ask here or create an issue request on github and i will see what i can do :)
⋆ ˚。 Megurine Luka ౨ৎ˚ 28 Jul, 2018 @ 10:29am 
How to open menu
Linus  [author] 28 Jul, 2018 @ 8:19am 
I added a parameter to the create() and modify() function that accepts an array of players, so you can change it for individual players
LoneCuriosity 27 Jul, 2018 @ 9:32pm 
:setvisible(N,E) missing ? entity is not there? only number.
LoneCuriosity 27 Jul, 2018 @ 8:10pm 
Does anybody have any examples on how to use this?
⋆ ˚。 Megurine Luka ౨ৎ˚ 14 Jul, 2018 @ 12:39pm 
EEeeer ok