DListView.DoDoubleClick

From GMod Wiki

Jump to: navigation, search
Function
Syntax DListView.DoDoubleClick( DPanel parent, Integer index, DListView_Line line )
Where is this used?
Description:
Runs whenever a line is double clicked
Returns: nil
Part of Library: DListView
Realm: NewerClient.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=DListView.DoDoubleClick]DListView.DoDoubleClick [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

DescriptionCreates a panel with a DListView, and adds Isaac Newton's laws of motion. When a line is double clicked the law will be shown to the user, using Derma_Message
Used onNewerClient.png
Code
local DermaPanel = vgui.Create("DFrame")
DermaPanel:SetPos((ScrW() / 2) - (400 / 2), (ScrH() / 2) - (600 / 2))
DermaPanel:SetSize(370, 500)
DermaPanel:SetTitle("Isaac Newton's 3 laws of motion")
DermaPanel:SetVisible(true)
DermaPanel:SetDraggable(true)
DermaPanel:ShowCloseButton(true)
DermaPanel:MakePopup()
 
local lvTestList = vgui.Create("DListView", DermaPanel)
lvTestList:SetPos(10, 30)
lvTestList:SetSize(350, 460)
lvTestList:SetMultiSelect(false)
 
lvTestList.DoDoubleClick = function(parent, index, list)
					Derma_Message(list:GetValue(2), "Text of ID " .. list:GetValue(1),  "Thank you")
				end
 
local clmColumn1 = lvTestList:AddColumn("ID")
local clmColumn2= lvTestList:AddColumn("Name")
clmColumn1:SetMinWidth(40)
clmColumn1:SetMaxWidth(40)
 
lvTestList:AddLine("1", "An object at rest will remain at rest unless acted on by an unbalanced force. An object in motion continues in motion with the same speed and in the same direction unless acted upon by an unbalanced force.")
lvTestList:AddLine("2", "Acceleration is produced when a force acts on a mass. The greater the mass (of the object being accelerated) the greater the amount of force needed (to accelerate the object).")
lvTestList:AddLine("3", "For every action there is an equal and opposite re-action.")
OutputDisplays the text of the line you double click on


Additional Notes

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox