Panel/SetTabPosition

From Garry's Mod
(Difference between revisions)
Jump to: navigation, search
m
 
Line 1: Line 1:
 
{{Func
 
{{Func
|Description={{Stub}}
+
|Description=When TAB is pressed, the next selectable panel in the number sequence is selected.
 
+
Possibly related to in which order pressing TAB should "select/highlight" the panels, presumably used on text entries and buttons.
+
 
|Realm=Client
 
|Realm=Client
 
|IsClass=Yes
 
|IsClass=Yes
Line 9: Line 7:
 
|type=number
 
|type=number
 
|name=position
 
|name=position
 +
}}
 +
{{Example
 +
|Description=Creates a menu to put information in with SetTablePosition application.
 +
|Code=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.
 
}}
 
}}

Latest revision as of 23:25, 23 May 2019

 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