Page 1 of 1
Make label text copyable
Posted: Mon Nov 07, 2016 3:50 pm
by SparrowhawkMMU
Is there any reason that SB prevents the copying of label (and hyperlink) text? Is this a Dojo feature/limitation? Can this limitation be please be removed if possible (or disabled in code)?
I use labels to display some read-only data, such as record IDs, generated UIDs, fixed status text etc. When users want to send me feature requests / bug reports, they are unable to copy the text and have to copy by sight, which is difficult for some of the longer entries
Thanks
OS X, SB 1.40
Re: Make label text copyable
Posted: Mon Nov 07, 2016 5:03 pm
by Fred
You can try this:
Code: Select all
Procedure RemoveNoSelectClassFromWindow(Window)
Protected WindowObject = WindowID(Window)
; Remove the specific class which disable all mouse selection
!$(v_windowobject.element).removeClass("sbNoSelect");
EndProcedure
OpenWindow(0, #PB_Ignore, #PB_Ignore, 300, 200, "", #PB_Window_ScreenCentered)
TextGadget(0, 10, 10, 200, 80, "Some test to select", #PB_Text_Border)
RemoveNoSelectClassFromWindow(0)
On a side note, we decided to disbale all selction to make the feel like a desktop app. Having a GUI where you can select all text within can be very messy at time
Re: Make label text copyable
Posted: Mon Nov 07, 2016 10:00 pm
by JohnJohnsonSHERMAN
Another method is to set the window as background with #PB_Window_Background. It works fine ...
Code: Select all
OpenWindow(#PB_Any,0,0,200,60,"Example of selectable text", #PB_Window_Background)
TextGadget(#PB_Any,0,0,200,50,~"<font face = \"segoe ui\">You can Select this text And this <a href \"http://www.google.com\">hyperlink</a></font>")
Yes, TextGadget also supports Html

Re: Make label text copyable
Posted: Tue Nov 08, 2016 6:12 am
by Fred
The fact it worked was a bug

. Changed for next version
Re: Make label text copyable
Posted: Tue Nov 08, 2016 8:46 am
by SparrowhawkMMU
Thanks for the info everyone.
Re: Make label text copyable
Posted: Tue Nov 08, 2016 4:02 pm
by SparrowhawkMMU
One suggestion perhaps: a new #PB_Gadget_TextSelectable (or whatever you want to call it) constant for Label gadgets so that this can be done at the gadget level without any JS code.
Re: Make label text copyable
Posted: Wed Nov 09, 2016 1:15 pm
by JohnJohnsonSHERMAN
+1 for the option... And everyone will be happy
