• How would I go about making a DTextEntry that only enters when I press a button
    4 replies, posted
Okay, so. I'm working on my gamemode, and I'm making a thing that uses Derma, and I don't know how I would go about making a DTextEntry only submit when I press a DButton, It's probably glaring me in the face, but I cant think of anything, Thanks in advance <3
You need DoClick callback And GetText function
How would I incorporate that though? I am fairly new to derma, and lua in general. In case you want a base code, here you go. local TextEntry = vgui.Create( "DTextEntry", frame ) -- create the form as a child of frame TextEntry:SetPos( 0, 0 ) TextEntry:SetSize( 0, 0 ) TextEntry:SetText( "Type here" ) TextEntry.OnEnter = function( self ) end local OKButton = vgui.Create( "DButton", frame ) OKButton:SetPos( 0, 0 ) OKButton:SetSize( 0, 0 ) OKButton:SetText( "Submit" ) OKButton.DoClick = function( ) end I do know DoClick, but I don't see how I could 'bridge' the two. I really don't like asking for code outright, but I'm stumped :/
DTextEntries don't have a submit function by default. I guess you're using OnEnter as the submit function. Just copy paste whatever code is in the TextEntry's OnEnter function into the OKButton's DoClick function, and get rid of the OnEnter bit.
That's working, thanks for the heads up!
Sorry, you need to Log In to post a reply to this thread.