Panel/SetTabPosition

From Garry's Mod
Jump to: navigation, search
 Panel:SetTabPosition( )

Contents

Description

When TAB is pressed, the next selectable panel in the number sequence is selected.

Arguments

number position

Examples

Example

Creates a menu to put information in with SetTablePosition application.

local Panel = vgui.Create("DFrame")
Panel:SetSize(500,250)
Panel:Center()
Panel:SetText("My Information")
Panel:MakePopup()

local FirstName = vgui.Create("DTextEntry", Panel)
FirstName:SetSize(400,35)
FirstName:SetPos(50, 50)
FirstName:SetPlaceholderText("First Name")
FirstName:SetTabPosition( 1 )

local LastName = vgui.Create("DTextEntry", Panel)
LastName:SetSize(400,35)
LastName:SetPos(50, 100)
LastName:SetPlaceholderText("Last Name")
LastName:SetTabPosition( 2 )

local FavoriteColor = vgui.Create("DTextEntry", Panel)
FavoriteColor:SetSize(400,35)
FavoriteColor:SetPos(50, 150)
FavoriteColor:SetPlaceholderText("Favorite Color")
FavoriteColor:SetTabPosition( 3 )

local CompletedButton = vgui.Create("DButton", Panel)
CompletedButton:SetSize(200,35)
CompletedButton:SetPos(150, 200)
CompletedButton:SetText("Done")
function CompletedButton:DoClick()
    LocalPlayer():ConCommand("say My name is " .. FirstName:GetText() .. " " .. LastName:GetText() .. " and my favorite color is " .. FavoriteColor:GetText() .. "!")
    Panel:Remove()
end

Output:

A Panel with a functional TAB Button.
Personal tools
Navigation