Question about editing LineEdit's properties within Dialogic's default layout #1798
-
...Another day, another question...sorry. I've been trying to tinker for several hours with adding a character limit to the Text Input's InputField/LineEdit parameters, without success. From what I'm reading both in Godot's manual and elsewhere, one should be able to set the value either by inputting a number within the inspector's "max length" section or by writing a script, but it doesn't seem that either approach is working (and I'm not generating errors either). The thing is, though, that changing any parameter within the LineEdit inspector doesn't seem to actually change anything with how the InputField operates. I've poked around a few different scripts as well (DialogicDefaultLayout, Node_text_input and InputField), and while I'll fully admit that my coding "knowledge" is pathetic, I'm not seeing anything off-hand which should prevent the changes from passing through. Does anybody have any thoughts on this? Thanks in advance |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I ran into the same issue before and found a way to work around it: Go to: res://addons/dialogic/Modules/TextInput/node_text_input.gd Change the ready function from this:
To this:
You would just change the value from 6 to whatever fits your use-case. It seems you have to change the max_length property here as the input_line_edit is actually created here in the ready function rather than using the properties from the .tscn file. You could also potentially use a var from a singleton to make it more dynamic and then just update the singleton's var anytime you call a text input from Dialogic. Create a singleton named Global, create a var named input_max_length and set it to an integer, then change the line we changed earlier to this:
then you can change the Global.input_max_length value in any .gd file as you need to. Dialogic is very powerful but I've found myself having to do little "cheats" like this to get maximum control of certain things. If you still need help to make it more dynamic then just let me know and I can go in more depth with the singleton method and how to access it with the timeline editor. |
Beta Was this translation helpful? Give feedback.
-
@Promptineer , thank you for this! I finally had a chance to test it out, and it not only works for that, but (in case others have this issue in the meantime) also allows you to hard-code any number of LineEdit parameters (I was actually testing this with various scripts myself before you responded, but I hadn't figured it out yet, so it is nice to know I was on the right track, even if my execution wasn't correct). I haven't tested them all yet, mainly because I don't need them all (or even most of them), but I can confirm you can even do things like disabling the context menu and enabling the 'caret' with writing it in this fashion. Thanks again. |
Beta Was this translation helpful? Give feedback.
I ran into the same issue before and found a way to work around it:
Go to: res://addons/dialogic/Modules/TextInput/node_text_input.gd
Change the ready function from this:
To this: