Hi I'd like the user to select some app generated text and copy it to his device clipboard. The only way I can think of doing it is through imgui inputText wih readonly flag, but using imgui only for this feature seems a bit overkill.
Is there any other way I am not aware to do this in gideros?
Thank you!
Comments
Likes: MoKaLux, pie
It might do the job but I can't find a way to select the text:
using viewport:
I get an error in
viewport:setPanmode(UI.Viewport.PANMODE.ALWAYS) - attempt to index nil with 'ALWAYS',
but commenting the line is enough to make it run. It pans perfectly, but I couldn't see a way to tell it if the text should be selectable or not.
As a side question: does viewport support "bold text/colored" sections/single words?
using TextField, I can select the text only on windows player with SHIFT+ARROW, but the cursor is stuck at the beginning of the line on every touch or mouse click on the element.
were you thinking about another UI element?
Thank you a lot!
Try the code below instead:
Likes: MoKaLux, pie
If I set a height constraint on the texfield It seems that the same cursor bug as before happens, but I guess this falls under the "manually sized textfield" bug.
Do you think it might be possible to extend the viewport class and add a "selectable text" flag without too much hassle? Of course I guess that in this scenario it won't be possible to scroll the text without the use of a scrollbar.
thank you
Likes: MoKaLux, pie
It almost works:
the \e[color tag isn't recognized if text is between [[ ]] if there is a quick fix, otherwise I can live without it.
Is there a way to avoid automatically opening android (and IOS) virtual keyboard?
This might be useful even for the non readonly textfield: I planned to copy from a first textfield and paste the info into another textfield for validation.
The popup copy (and cut) buttons raise a
ui/uitextfield.lua:683: attempt to index nil with 'set'
ui/uitextfield.lua:676: attempt to index nil with 'set'
I think that if readonly=true we can directly copy to clipboard without the need for the popup at all: readonly text should not be cut anyway.
Thank you again
About the 'attempt to index nil', it seems that UI.Clipboard is nil, while it should have been initialized in uifocus.lua
Likes: pie
Also you can add
Likes: MoKaLux, pie
Are you sure that Clipboard is initialized in uifocus.lua? I don't have any occurrence of "Clipboard" outside uitextfield.lua if I search for it with notepad++ "find in files"
https://github.com/gideros/gideros/blob/master/Library/ui/uifocus.lua#L177
But using your linked file everything works
Thank you