Garry's Mod Wiki

Garry's Mod Wiki

Description

Used in Sandbox tools to allow the player to select models out of a list. Despite being only used in Sandbox, it is not exclusive to that gamemode.

See also MatSelect for the material selecting alternative.

Parent

Derives methods, etc not listed on this page from ContextBase.

Implements

Implements or overrides the following hooks/methods. If you want to override these, you probably want to call the original function too.

Events

PropSelect:OnRightClick( Panel pnl )
Called when the player right clicks a model. By default, this opens a menu that lets the player copy the model path.
PropSelect:OnSelect( string model, Panel pnl )
Called when the player selects a model.

Methods

PropSelect:AddModel( string model, table convars )
Adds a new model to the selection list.
PropSelect:AddModelEx( string value, string model, number skin )
Adds a new model to the selection list.

Example

Example usage of the panel.

local frame = vgui.Create( "DFrame" ) frame:SetSize( 500, 500 ) frame:Center() frame:MakePopup() local PropSelect = vgui.Create( "PropSelect", frame ) PropSelect:Dock( TOP ) --PropSelect:SetConVar( "my_convar_name" ) local items = { "models/props_c17/FurnitureWashingmachine001a.mdl", "models/props_junk/PlasticCrate01a.mdl", "models/props_junk/wood_pallet001a.mdl" } for k, model in pairs( items ) do PropSelect:AddModelEx( model, model, 0 ) end function PropSelect:OnSelect( model, pnl ) print( "Selected model", model, pnl ) end
Output:
image.png

This site is a community mirror of the official Garry's Mod wiki.. This site is not maintained by Facepunch Studios.

Page content is automatically updated twice a day. Edits and history are not available.

Last Parsed: Loading...