Ulysses
Home
Help
Ulysses
»
General
»
Developers Corner
»
Menu Help
« previous next »
Print
Pages: [
1
]
Go Down
Author
Topic: Menu Help (Read 4824 times)
0 Members and 1 Guest are viewing this topic.
lampman13
Jr. Member
Posts: 71
Karma: -10
Menu Help
«
on:
February 19, 2014, 04:22:23 pm »
could someone give me an example of a menu i have coded one that is not for ulx tht i want to use for a broadcast type thing that basically tells the server what you type but it doesnt work the code i made is
Code: Lua
function
Menu
(
)
local
ply
=
LocalPlayer
(
)
local
BackGround
=
vgui
.
Create
(
"DFrame"
)
BackGround
:
SetSize
(
200
,
70
)
BackGround
:
SetPos
(
(
ScrW
(
)
/
2
-
BackGround
:
GetWide
(
)
,
(
ScrH
(
)
/
2
)
-
BackGround
:
GetTall
(
)
)
BackGround
:
SetTitle
(
"Menu"
)
BackGround
:
SetVisible
(
true
)
BackGround
:
SetDraggable
(
true
)
BackGround
:
ShowCloseButton
(
true
)
BackGround
:
MakePopup
(
)
BackGround
.
Paint
=
function
(
)
draw
.
RoundedBox
(
4
,
0
,
0
,
BackGround
:
GetWide
(
)
,
BackGround
:
GetTall
(
)
,
Color
(
138
,
62
,
189
,
150
)
draw
.
RoundedBox
(
2
,
2
,
2
,
BackGround
:
GetWide
(
)
-
4
,
21
,
Color
(
122
,
122
,
122
,
255
)
end
local
TextEntry
=
vgui
.
Create
(
"DTextEntry"
,
BackGround
)
TextEntry
:
SetPos
(
20
,
30
)
TextEntry
:
SetTall
(
20
)
TextEntry
:
SetWide
(
160
)
TextEntry
:
SetEnterAllowed
(
true
)
TextEntry
.
onEnter
=
function
(
)
ply
:
ConCommand
(
"ulx tsay "
..
TextEntry
:
GetValue
(
)
)
BackGround
:
SetVisible
(
false
)
end
end
concommand
.
Add
(
"open_menu"
,
Menu
)
«
Last Edit: February 21, 2014, 12:48:20 pm by lampman13
»
Logged
lampman13
Jr. Member
Posts: 71
Karma: -10
Re: Menu Help
«
Reply #1 on:
February 19, 2014, 04:37:56 pm »
ok i fixed my problem but now it doesnt do the command i have it so it comes in tsay for the time being but it doens seem to be working
Code: Lua
function
Menu
(
)
local
ply
=
LocalPlayer
(
)
local
BackGround
=
vgui
.
Create
(
"DFrame"
)
BackGround
:
SetSize
(
200
,
70
)
BackGround
:
SetPos
(
(
ScrW
(
)
/
2
)
-
BackGround
:
GetWide
(
)
,
(
ScrH
(
)
/
2
)
-
BackGround
:
GetTall
(
)
)
BackGround
:
SetTitle
(
"Menu"
)
BackGround
:
SetVisible
(
true
)
BackGround
:
SetDraggable
(
true
)
BackGround
:
ShowCloseButton
(
true
)
BackGround
:
MakePopup
(
)
BackGround
.
Paint
=
function
(
)
draw
.
RoundedBox
(
4
,
0
,
0
,
BackGround
:
GetWide
(
)
,
BackGround
:
GetTall
(
)
,
Color
(
138
,
62
,
189
,
150
)
)
draw
.
RoundedBox
(
2
,
2
,
2
,
BackGround
:
GetWide
(
)
-
4
,
21
,
Color
(
122
,
122
,
122
,
255
)
)
end
local
TextEntry
=
vgui
.
Create
(
"DTextEntry"
,
BackGround
)
TextEntry
:
SetPos
(
20
,
30
)
TextEntry
:
SetTall
(
20
)
TextEntry
:
SetWide
(
160
)
TextEntry
:
SetEnterAllowed
(
true
)
TextEntry
.
onEnter
=
function
(
)
ply
:
ConCommand
(
"ulx tsay "
..
TextEntry
:
GetValue
(
)
)
BackGround
:
SetVisible
(
false
)
end
end
concommand
.
Add
(
"open_menu"
,
Menu
)
«
Last Edit: February 21, 2014, 12:48:56 pm by lampman13
»
Logged
Cobalt
Full Member
Posts: 216
Karma: 44
http://steamcommunity.com/id/__yvl/
Re: Menu Help
«
Reply #2 on:
February 19, 2014, 04:52:46 pm »
It's OnEnter not onEnter. Also try GetText() instead of GetValue(). And instead of SetVisible( false )
just do Close()
«
Last Edit: February 19, 2014, 04:57:00 pm by Cobalt
»
Logged
lampman13
Jr. Member
Posts: 71
Karma: -10
Re: Menu Help
«
Reply #3 on:
February 19, 2014, 06:49:33 pm »
thank you so much for a response i will try now
Logged
lampman13
Jr. Member
Posts: 71
Karma: -10
Re: Menu Help
«
Reply #4 on:
February 19, 2014, 06:55:05 pm »
it works uhm could you help me with something else to i dont know how to make something display in the middle of the screen with that like they would open the menu and it would display the text in the middle topish of the screen in a box maybe?
Logged
Cobalt
Full Member
Posts: 216
Karma: 44
http://steamcommunity.com/id/__yvl/
Re: Menu Help
«
Reply #5 on:
February 19, 2014, 08:49:26 pm »
Use Panel:Center()
Logged
lampman13
Jr. Member
Posts: 71
Karma: -10
Re: Menu Help
«
Reply #6 on:
February 20, 2014, 12:36:03 pm »
yeah but i mean like it would make a box in the topish of the screen that said what the text you entered said if that makes sense xD
Logged
lampman13
Jr. Member
Posts: 71
Karma: -10
Re: Menu Help
«
Reply #7 on:
February 20, 2014, 02:10:29 pm »
ok i have changed it so it displays a text in the center of the screen but it doesn work it broke it
Code: Lua
function
Menu
(
)
local
ply
=
LocalPlayer
(
)
local
BackGround
=
vgui
.
Create
(
"DFrame"
)
BackGround
:
SetSize
(
200
,
70
)
BackGround
:
SetPos
(
(
ScrW
(
)
/
2
)
-
BackGround
:
GetWide
(
)
,
(
ScrH
(
)
/
2
)
-
BackGround
:
GetTall
(
)
)
BackGround
:
SetTitle
(
"Menu"
)
BackGround
:
SetVisible
(
true
)
BackGround
:
SetDraggable
(
true
)
BackGround
:
ShowCloseButton
(
true
)
BackGround
:
MakePopup
(
)
BackGround
.
Paint
=
function
(
)
draw
.
RoundedBox
(
4
,
0
,
0
,
BackGround
:
GetWide
(
)
,
BackGround
:
GetTall
(
)
,
Color
(
138
,
62
,
189
,
150
)
)
draw
.
RoundedBox
(
2
,
2
,
2
,
BackGround
:
GetWide
(
)
-
4
,
21
,
Color
(
122
,
122
,
122
,
255
)
)
end
local
TextEntry
=
vgui
.
Create
(
"DTextEntry"
,
BackGround
)
TextEntry
:
SetPos
(
20
,
30
)
TextEntry
:
SetTall
(
20
)
TextEntry
:
SetWide
(
160
)
TextEntry
:
SetEnterAllowed
(
true
)
TextEntry
.
OnEnter
=
function
(
)
PrintMessage
(
HUD_PRINTCENTER
,..
TextEntry
:
GetText
(
)
)
BackGround
:
SetVisible
(
)
end
end
concommand
.
Add
(
"open_menu"
,
Menu
)
«
Last Edit: February 21, 2014, 12:49:14 pm by lampman13
»
Logged
lampman13
Jr. Member
Posts: 71
Karma: -10
Re: Menu Help
«
Reply #8 on:
February 20, 2014, 05:58:32 pm »
no one can help?
Logged
Print
Pages: [
1
]
Go Up
« previous next »
Ulysses
»
General
»
Developers Corner
»
Menu Help