I looked on the wiki and found this for the text box but I am not sure if this is the easiest way to go about it, look, I will show you a cod snippit after this that I would need to go with a text box that would be in my DPanel
I would like a text box in my derma panel and I have never done a text box before so I need help
[lua]// myParent = a panel
myText = vgui.Create("DTextEntry", myParent)
myText:SetText("Initial Value")
--The following has been changed from "myText:GetText()" to "myText:GetValue()"
myText.OnEnter = function() Msg("Text Entered: " .. myText:GetValue() .. "\n") end[/lua]
[lua]DButton.DoClick = function()
LocalPlayer():ConCommand(DTextBox:GetValue())
end [/lua]
I want that linked to the text box but first I need one and I am not sure about how to make one
Please help
Thanks,
Justin
So pretty much you want to make a Text entry box where whatever you type inside and when you click a button it runs whatever you typed as a console command? Not exactly sure what you want with the Text entry box.
Look up dframe on the wiki.
Why dframe? I already have a huge derma frame with tons of tabs with stuff but I am made a new derma frame for f4 but I never made a text box before, so I am not sure about this. A box like this.
|---------------------------------------------------------------------------------------------------|
| <Text entered within here - Example: sv_gravity 100
|---------------------------------------------------------------------------------------------------|
Do you understand it? Sorry if you can't understand
[editline]01:49AM[/editline]
The one line at the end isn't showing up, but that's the example of the text box in the derma frame and of course it doesn't look as neat as it would in there since it is only lines
The text entry box
[CODE] local ConBox = vgui.Create("DTextEntry", Frame)
ConBox:SetPos(100, 50) -- position of the box on the frame x , y
ConBox:SetSize(200, 20) -- size of the box [/CODE]
The Submit button
[CODE] local Submit = vgui.Create("DButton", Frame)
Submit:SetPos(155, 170) -- position of the button on the frame
Submit:SetSize(50, 25) -- size of the button
Submit:SetText("Submit") -- text on the button
Submit.DoClick = function () -- what happens when you click the button
RunConsoleCommand(tostring(ConBox:GetValue()) -- gets the string typed in the text entry box
end -- ends the function [/CODE]
not sure if this is what you wanted tho :o
The last | in there isn't showing up
[editline]01:50AM[/editline]
Perfect, thanks. I appreciate the help man
Sorry, you need to Log In to post a reply to this thread.