textual icon indicating copy to clipboard operation
textual copied to clipboard

Add a Label widget

Open davep opened this issue 1 year ago • 2 comments

For the moment this does nothing more than inherit from a Static; but what it does do is make it easier for someone to add text to their application and to style it by styling all the Labels. Before now it would be common to use a Static but if you try and style (or query) all Statics, you'd also get things like Buttons, which inherit from Static.

See #1190

davep avatar Nov 16 '22 15:11 davep

This feels weird... I get the idea but if a user would want to change the style of only part of them he'd still need to do work. And if going with this approach, I think a warning message should be added if constructing a Static directly and not through inheriting it. What do you think @davep?

UriyaHarpeness avatar Nov 17 '22 04:11 UriyaHarpeness

I get the idea but if a user would want to change the style of only part of them he'd still need to do work.

Obviously, hence classes and styles and the like in CSS. This early split between a more "baseline" renderable container and a more "has a specific job" renderable container isn't about reducing or eliminating that sort of work (which, as we both know, would be very little anyway), it just starts to set up what seems like a fairly natural split between a basic renderable container that's about showing text, and more involved widgets.

It's possible that at some point in the near future Label may acquire some extra functionality that wouldn't make much sense in Static but which anyone using Label would optionally want. This wee addition acknowledges that.

And if going with this approach, I think a warning message should be added if constructing a Static directly and not through inheriting it.

I'm not really seeing much value in emitting warnings for this. As it stands, using Static rather than Label makes zero difference and has zero cost. What we're likely to do though is update the documentation and example code to naturally show that labels in an application will use Label, buttons will use Button, etc... and Static will sort of transition into being a more foundational type.

davep avatar Nov 17 '22 05:11 davep