Currently on Roblox, it’s impossible to automatically capture the focus of a text box in a plugin widget.
One of my plugins, Pick, has a command bar-like interface which attempts to automatically focus (using TextBox:CaptureFocus()) when you open it. However in order to start typing as expected I need to click on the plugin widget first.
I understand there are concerns that plugins could abuse this functionality to force capture input, so maybe capturing focus would only be allowed in certain cases e.g. the user opening a plugin widget.
Being able to automatically capture focus would considerably speed up my workflow as I would not need to use the mouse at all in order to use the plugin.
A possible alternative is to just go with an old ScreenGui, but I would lose a lot of flexibility with positioning as the command bar would be confined to the 3D view. This would not work for me as I primarily use this plugin in the script editor, where the 3D view is hidden and not interactive.
Sorry to necrobump this, but it’s still an issue and I also have a use-case for this now. I’m currently working on an Explorer plugin (to replace the built-in Explorer), and I have a plugin action setup that allows the filter/search box to capture focus (just like the Filter workspace... box in the Explorer).
I could hide a TextBox in CoreGui and just capture the focus there, mirroring it back to the plugin window, but this seems like a long and unnecessary way to go about it. Also doesn’t solve the issue of not being able to capture focus when the script editor is open (as @Elttob stated).
Currently, for my Widget in a plugin, I want to automatically focus onto a text box whenever it is opened.
Focusing on a text box is possible, however the actual DockWidgetPluginGui isn’t focused, so if I start trying to type within the text box, it won’t work and assume I’m trying to use keybinds for what I was originally using (eg. Explorer) [You can also tell that the widget is not active because of the appearance of the Widget title bar if the widget is floating]
There should be a way so that a developer can “Focus” on a specific DockWidgetPluginGui, making it active.
This is useful for my plugin so that I can increase its efficiency - letting users quickly go into typing in the text box without having to click the Widget and the textbox
I know I’m reviving this topic, but I need this feature as well. The class converter plugin I am working on functions based off a single TextBox and I would like to be able to reliably open the widget containing the TextBox and start typing instantly.
I say “reliably” because there’s already a way to achieve this but it requires some hacky manipulation of enabling and disabling the widget you want to focus on. Plus, this only works <100% of the time and changes based on the widget’s state.
This is still something that you can’t do? I need this for the plugin I am making now, and I find it weird this isn’t already a thing and that more creators aren’t in need of this.