KivyMD icon indicating copy to clipboard operation
KivyMD copied to clipboard

Need for a selectable "Label"

Open suvidh opened this issue 4 years ago • 3 comments

Description of the Feature

There is a need to make a Label whose contents can be copied, selected etc, by the user. For, an example, I am building a simple app that finds the meaning of the word and prints the message via Label so that it can be properly formatted using Heading etc. But the user cannot select the text! It is like this rigid entity and not normal at all. I am aware that I will be told to use MDTextField with Read-Only option but Label with proper formatting looks far better than MDTextField. So, I suggest a middle ground between the two and a Label which produces text which is selectable- Selectable Label. Even Flutter has a separate widget-SelectableText-class-link= https://api.flutter.dev/flutter/material/SelectableText-class.html

suvidh avatar Aug 28 '20 06:08 suvidh

why not add touch behavior to a custom class inheriting mdlabel

p0lygun avatar Aug 28 '20 08:08 p0lygun

i'm not sure if kivy has a provider for that, i mean, externally of a text input widget. Since every OS has a provider for that functionality

podraco avatar Sep 02 '20 19:09 podraco

It is possible but you have to do a trick. Use text input with focus : 'False' This will not allow user to enter anything. Set your own text to display with text : 'blah! blah! But there is a problem that keyboard comes up just for a moment. It can be managed by overriding on_focus method.

Why this works focus is a Boolean Property but when we pass it a String Value, its behaviour to focus crashes. So now you can use your TextInput for everything instead of typing into it.

darpan5552 avatar Oct 11 '20 06:10 darpan5552