• [Wiki REQ] DImageButton Info/Arguments
    18 replies, posted
[URL]http://wiki.garrysmod.com/page/VGUI/Elements/DImageButton[/URL] Does anyone know what the arguments are, and if so would you mind adding it to the wiki so the rest of us know?
Don't forget about the old wiki: [url]http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/indexa599.html[/url] And you always can have a look at the source code: [url]https://github.com/garrynewman/garrysmod/blob/master/garrysmod/lua/vgui/dimagebutton.lua[/url]
Just do, [code]lua_run_cl PrintTable(DImageButton)[/code] Output [code] ] lua_run_cl PrintTable(DImageButton) ] GetStretchToFit = function: 0x268f1a38 OnMousePressed = function: 0x266dfdb0 SetMaterial = function: 0x268f1ae8 SetDisabled = function: 0x266df810 ThisClass = DImageButton OnMouseReleased = function: 0x266dfdc8 SetOnViewMaterial = function: 0x266df828 SetImageVisible = function: 0x266df878 Init = function: 0x268f1ad0 SetColor = function: 0x268f1b00 SetImage = function: 0x268f1ae8 PerformLayout = function: 0x266dfde0 SetKeepAspect = function: 0x268f1a78 GetImage = function: 0x268f0780 SetIcon = function: 0x268f1ae8 Base = DButton Derma: ClassName = DImageButton BaseClass = DButton Description = A button which uses an image instead of text GenerateExample = function: 0x266df840 SizeToContents = function: 0x268f1a90 SetStretchToFit = function: 0x268f1ab0 [/code]
[QUOTE=Aide;40417141]Just do, [code]lua_run_cl PrintTable(DImageButton)[/code] Output [code] ] lua_run_cl PrintTable(DImageButton) ] GetStretchToFit = function: 0x268f1a38 OnMousePressed = function: 0x266dfdb0 SetMaterial = function: 0x268f1ae8 SetDisabled = function: 0x266df810 ThisClass = DImageButton OnMouseReleased = function: 0x266dfdc8 SetOnViewMaterial = function: 0x266df828 SetImageVisible = function: 0x266df878 Init = function: 0x268f1ad0 SetColor = function: 0x268f1b00 SetImage = function: 0x268f1ae8 PerformLayout = function: 0x266dfde0 SetKeepAspect = function: 0x268f1a78 GetImage = function: 0x268f0780 SetIcon = function: 0x268f1ae8 Base = DButton Derma: ClassName = DImageButton BaseClass = DButton Description = A button which uses an image instead of text GenerateExample = function: 0x266df840 SizeToContents = function: 0x268f1a90 SetStretchToFit = function: 0x268f1ab0 [/code][/QUOTE] Yeah, that will give you perfect idea of what the functions do and what their arguments are.
[QUOTE=Robotboy655;40417691]Yeah, that will give you perfect idea of what the functions do and what their arguments are.[/QUOTE] Alright, I'll remember that one from now on; thanks. Edit: Am I doing this wrong? [img]http://gyazo.com/3f20ef421108fcc3dcf0fb6ba0ca3c5a.png[/img]
You need to set sv_allowcslua to 1
[QUOTE=MDave;40418076]You need to set sv_allowcslua to 1[/QUOTE] [img]http://gyazo.com/6e8a0daa4e5c023830d85bf7cb286956.png[/img] Why doesn't it work? I didn't spell them wrong.
[QUOTE=JVanover;40424209][img]http://gyazo.com/6e8a0daa4e5c023830d85bf7cb286956.png[/img] Why doesn't it work? I didn't spell them wrong.[/QUOTE] If you are playing on a server, then you need to do this in server console, not clientside. If you are playing this singleplayer then it's a bug.
[QUOTE=ColaCoca;40424233]If you are playing this singleplayer then it's a bug.[/QUOTE] I was in singleplayer; is this a bug?
Try sv_cheats 1 in SP.
[lua] GetStrechToFit( bool StrechToFit ); SetStrechToFit( bool StrechToFit ); OnMousePressed( ); OnMouseReleased( ); SetDisabled( bool Disabled ); SetMaterial( string Material ); SetOnViewMaterial( MatName, Backup ); SetImageVisible( bool Visible ); Init( ); SetColor( Color col ); SetImage( String Image, String Backup ); PerformLayout( ); SetKeepAspect( bool KeepAspect ) GetImage( ) SetIcon -> Alias of SetImage( String Image, String Backup ); SizeToContents( ) [/lua]
Feel free to add it to the wiki after you find out what you want. Or even better post a pull request to github with comments added so my script will parse them and auto document
[QUOTE=garry;40428611]Feel free to add it to the wiki after you find out what you want. Or even better post a pull request to github with comments added so my script will parse them and auto document[/QUOTE] I tried editing the page the other day, but I have no idea what to do because I've never edited a wiki before, and I don't know much about web pages.
Edit with format... it's helpful
[QUOTE=garry;40428611]Feel free to add it to the wiki after you find out what you want. Or even better post a pull request to github with comments added so my script will parse them and auto document[/QUOTE] Is there any documentation / examples of how your script parses & documents comments? I would prefer to do that rather then adding functions directly to the wiki.
Basically like this: [lua]-- -- Name: util.Stack -- Desc: Returns a new Stack object -- Arg1: -- Ret1: Stack|a brand new stack object -- function util.Stack() local t = {} setmetatable( t, T ) t.objs = {} return t end[/lua] [lua]-- -- Name: [library].[functionname] -- Desc: [desc (can contain \n to indicate newlines)] -- Arg[num]: [type]|[name]|desc -- Ret[num]: [type]|[desc] -- [/lua] if it's a class seperate library functionaname with a : if it's a callback library should be fullcaps.
[QUOTE=garry;40440152]Basically like this: [lua]-- -- Name: util.Stack -- Desc: Returns a new Stack object -- Arg1: -- Ret1: Stack|a brand new stack object -- function util.Stack() local t = {} setmetatable( t, T ) t.objs = {} return t end[/lua] [lua]-- -- Name: [library].[functionname] -- Desc: [desc (can contain \n to indicate newlines)] -- Arg[num]: [type]|[name]|desc -- Ret[num]: [type]|[desc] -- [/lua] if it's a class seperate library functionaname with a : if it's a callback library should be fullcaps.[/QUOTE] Can you add a method to set its realm?
Not right now - if you want to invent one though I will include it
[QUOTE=garry;40442981]Not right now - if you want to invent one though I will include it[/QUOTE] Okay. I will just add.. [lua] -- Realm: Server/Client/Shared/Menu [/lua] It would be easier though to set a file realm and then have a method to override that but regardless its not too big of a hassle to add it.
Sorry, you need to Log In to post a reply to this thread.