Skip to content

Conversation

MiaKoring
Copy link
Contributor

As Philocalyst requested I added a modifier to control wether Text() could be selected by the user.

On UIKitBackend I switched from UILabel to a new Class inheriting from UILabel to show a Menu on long press.
Oob selectability is not built into UILabels.
I tested using UITextView like NSTextView in the AppKitBackend, but it lead to rendering issues.
The custom class solution should work as a drop in replacement, rendering exactly the same as before, only with more funktionality.

The isTextSelectionEnabled boolean gets set in the environment.

AppKitBackend, WinUIBackend and GtkBackend required a single line change in the updateTextView function, setting the flag on the native View.

On AppKitBackend the cursor is not always reacting to a change in the reactability instantly and it also doesn’t unselect it (Gtk and WinUI do unselect it) but this seems to be an AppKit Limitation and shouldn't affect the majority of usecases.

I’m sorry for the huge amount of confusing added and removed top level files, I assume a compile process placed them there for some reason.

It should be mergable with my other pr without conflicts.


public func createTextView() -> Widget {
let widget = WrapperWidget<UILabel>()
widget.child.numberOfLines = 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the subclass do something that makes it unnecessary? With plain UILabel, forgetting this means multiline text doesn't work, and I don't see anywhere in the subclass that sets this property.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, I read the description of this property wrong, leading to me thinking 0 was the default value.

@philocalyst
Copy link

yas

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants