Hi all,
You know.. When you hover the mouse over a panel element and it tells you what is changes.
For example a slider for setting the mass of the SENT created.
[code]
-----> Sets how heavy the object is. Set this to 0 to make it weightless
|
v
Mass: [-----------------#---] ( [ 0 to 100 ] 85 of 100)
[/code]
I've also seen how Garry uses it like so
[url]https://github.com/garrynewman/garrysmod/blob/master/garrysmod/resource/localization/en/tool.properties[/url]
But i doubt that I'll be able to create the same kinda file because it will replace the existing one maybe while loading.
If this can be done, I guess it will be available for custom panels like mine:
[url]https://raw.githubusercontent.com/dvdvideo1234/TrackAssemblyTool/master/screenshot.jpg[/url]
[QUOTE=King Traitor;49278360][img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Panel/SetTooltip]Panel:SetTooltip[/url][/QUOTE]
But is this going to work when I create the slider panel like this?
[code]
CPanel:AddControl("Slider", {
Label = "Mass: ",
Type = "Integer",
Min = 1,
Max = gnMaxMass,
Command = gsToolPrefL.."mass"})
[/code]
Maybe it's better to just create these using: [url]http://wiki.garrysmod.com/page/Category:DSlider[/url]
and use the Panel:SetTooltip ( With the lower-case "T" as this with the capital one is dicontinued )
As I searched a little bit about that in the net, here is how the creators of PlayX ate using it:
[url]https://github.com/sk89q/playx/blob/master/src/PlayX/lua/playx/client/panel.lua[/url]
[code]
panel:AddControl("Slider", {
Label = "Volume:",
Command = "playx_volume",
Type = "Float",
Min = "1",
Max = "100",
}):SetTooltip("May have no effect, depending on what's playing.")
[/code]
[QUOTE=dvd_video;49278395]
Maybe it's better to just create these using: [url]http://wiki.garrysmod.com/page/Category:DSlider[/url]
and use the Panel:SetTooltip ( With the lower-case "T" as this with the capital one is dicontinued )
[/QUOTE]
Wait, isn't AddControl('Slider') the same as vgui.Create('DSlider')?
[QUOTE=MPan1;49284433]Wait, isn't AddControl('Slider') the same as vgui.Create('DSlider')?[/QUOTE]
I don't know, maybe, may be not, though it makes the job done.
Sill the internal panel management is nowhere to be found in the
Gmod github repository or the Gmod wiki page
In this thread there a discussion about it.
[url]https://facepunch.com/showthread.php?t=1201037[/url]
I guess I cam also say
[code]
if(CLIENT) then
language.Add("tool." ..gsToolNameL..".name", "SENT to horsing around with")
language.Add("tool." ..gsToolNameL..".desc" , "Creates an example SENT")
language.Add("tool." ..gsToolNameL..".0" , "Left click to spawn")
language.Add("tool." ..gsToolNameL..".mass", "Change the SENT's mass") --<<---- See here !
end
---- And later on
CPanel:AddControl("Slider", {
Label = "SENT mass",
Type = "Float",
Min = 0,
Max = gnMaxMass,
Command = gsToolPrefL.."mass"}):SetTooltip("#tool."..gsToolNameL..".mass") --<<---- See here !
[/code]
Do I guess correctly that the tip will say "Change the SENT's mass" after the "translation" ..
I don't think language.Add has anything to do with translating - I think they're just placeholders that get replaced with whatever you defined them as
[QUOTE=MPan1;49284985]I don't think language.Add has anything to do with translating - I think they're just placeholders that get replaced with whatever you defined them as[/QUOTE]
Yes, the term is a "translated string". But in fact there is a table where these are keys used to retrieve the value. This looks promising so far ...
[url]https://wiki.garrysmod.com/page/language/GetPhrase[/url]
Sorry, I think I misread your question. I thought by
[QUOTE=dvd_video;49284896]Do I guess correctly that the tip will say "Change the SENT's mass" after the "translation" ..[/QUOTE]
You meant you were trying to translate it to another language or something.
It [B]would[/B] say that after the translation.
Well it works I applied this on my track assembly tool
[img]http://images.akamai.steamusercontent.com/ugc/393300969328601393/8D4C4968F2CB99BC8C902B0031379A6C03A8B623/[/img]
See the "Click to export the database as a file" thingy :D
You can do this thing on any kind of panel. It does not even matter that it was created by VGUI or AddControl()
Thanks all !
Sorry, you need to Log In to post a reply to this thread.