• DTextEntry - Input without using MakePopup()
    17 replies, posted
Hello guys! I want to be able to use a DTextEntry without calling MakePopup() on the panel. The reason for this is that the player should still be able to speak while the panel is open but should also be able to use the text entrys. When the DTextEntry is created I call textEntry:RequestFocus() Then the following Hook is called in which I set the Keyboard Input for the main frame to true: hook.Add( "OnTextEntryGetFocus", "MenuKeyboardFocusEnable", function(pnl) mainFrame:SetKeyboardInputEnabled(true) end) This Text Entry is a child of another panel and this panel is the child of this mainFrame! The hook is called when I click on the Textbox but I can't enter any text. I also tried something different. This is working pretty good but the problem is that you need to click another text entry twice if you were typing in another one because the keyboard input is disabled to get the player able to talk. And MakePopup is used which I want to avoid because of the problems occuring. textEntry.OnLoseFocus = function() mainFrame:SetKeyboardInputEnabled(false) end textEntry.OnMousePressed = function() mainFrame:MakePopup() end I hope someone has any idea to find a way to solve the issue. Not sure what to do... Alphaverse
Doenst work
Keep in mind that you have to use an EditablePanel to get DTextEntries to work. Maybe that solves you issue.
I have a DFrame as main frame, a dpanel as its child and the DTextEntry is the child of the dpanel. I also tried adding a editablePanel between the text entry and the dpanel but nothing is working.
I've tried this before and haven't really found a solution, so why use Derma for this?
What else? How should I do it then?
The list is incomplete (see BUTTON_CODE Enumerations to complete it) and there is probably a better way of doing it, but this is the first solution i found so here you go: keylist = { -- The first value is the decimal and the second value is the Key name (each keyname has a unique decimal) [1] = "KEY_0", [2] = "KEY_1", [3] = "KEY_2", [4] = "KEY_3", [5] = "KEY_4", [6] = "KEY_5", [7] = "KEY_6", [8] = "KEY_7", [9] = "KEY_8", [10] = "KEY_9", [11] = "KEY_A", [12] = "KEY_B", [13] = "KEY_C", [14] = "KEY_D", [15] = "KEY_E", [16] = "KEY_F", [17] = "KEY_G", [18] = "KEY_H", [19] = "KEY_I", [20] = "KEY_J", [21] = "KEY_K", [22] = "KEY_L", [23] = "KEY_M", [24] = "KEY_N", [25] = "KEY_O", [26] = "KEY_P", [27] = "KEY_Q", [28] = "KEY_R", [29] = "KEY_S", [30] = "KEY_T", [31] = "KEY_U", [32] = "KEY_V", [33] = "KEY_W", [34] = "KEY_X", [35] = "KEY_Y", [36] = "KEY_Z" } hook.Add("PlayerButtonDown", "PlayerButtonDownTest", function( ply, button ) if keylist[button] then print(keylist[button]) end end )
Still doesnt help me to get a it working with an input.
Well what kind of input are you trying to get?
Sorry I was somewhere else with my thoughts. With the code in my thread I am able to use the keys if a Textentry is not focused and I can click on a Textentry to type into it. But I have two problems: Because of MakePopup() the panel is also shown in the Escape menu When I type in a textentry and click on another one the focus gets removed a short time after because the first OnLoseFocus Call disables the KeyboardInput. So I have to click on a textentry twice if I was writing in one.
Why is this a big problem? Do you find yourself in the escape menu very often when playing on a server?
This isn't the big problem. The second thing mentioned is a big problem. It just would be nice to have and I thought if I ask here I could at least try it. But the problem with the Textbox focus and the keyboardInput is a very big problem but I found no solution..
I find the "problem" you are trying to solve a non issue, but you can always do something like this: textEntry.OnLoseFocus = function() mainFrame:SetKeyboardInputEnabled(false) end textEntry.OnMousePressed = function() timer.Simple( 0, function() mainFrame:MakePopup() end ) end Even though its a stupid solution. Could replace MakePopup() call with SetKeyboardInputEnabled( true ), altho not sure it will work.
I will try the timer idea. Only SetKeyboardInputEnabled(true) doesnt work. I'm not sure why but the Textbox remains not usable and nothing really changes.
Does the DTextEntry have the focus? Just enabling keyboard input isn't enough on it's own you'd need to request focus too.
I also called RequestFocus on the textentry after enabling the keyboard input but it still doesnt work.
Solved the problem with the active textentry getting disabled! Thank you!!
Sorry, you need to Log In to post a reply to this thread.