Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add readonly toggle for textarea #133

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

elnabo
Copy link

@elnabo elnabo commented May 23, 2017

No description provided.

@ianharrigan
Copy link
Member

Ok, this is fine, but this will need to be applied to every backend or it will break... I wonder if it makes sense to create a class for this (or typedef, or whatever), so that it doesn't have to be updated all the time.

For example, previously, i had getTextDisplay().xyz (like textColor for example) - this became a pain to maintain across all the backends, ie, when you add a new one you have to add to all the backends even if it isnt used / honoured, so now there is an applyStyle and the backend just uses the bits it cares about from the Style object.

I wonder if at this stage it makes sense to to the same for non-style properties (like TextDisplayProps or something)? Or make wrap and readonly styles? Otherwise this would become another maintance pain.

@elnabo
Copy link
Author

elnabo commented May 23, 2017

Maybe just have something like

class TextAreaDefaultReadOnlyBehaviour extends Behaviour {
    public override function set(value:Variant) {
        var textArea:TextArea = cast _component;
        textArea._readOnly = value;
    }

    public override function get():Variant {
        var textArea:TextArea = cast _component;
        return textArea._readOnly;
    }
}

If the corresponding implementation can't use it anyway. Maybe with some kind of warning.

@ianharrigan
Copy link
Member

But some may be able to use it, and other props might come up later, meaning we have to change 9 backends again (or maybe more by that time)... I feel like the safest option is to have something like:

class TextProperties {
    public var wrap:Null<Bool>
    public var readOnly:Null<Bool>
    // etc etc
}

Then in each backend we only need to expose an applyProperties(props:TextProperties) once in each of the backends. If later we have another property, can can just add it to TextProprties and the interface in the backend never needs to change. Basically, the same as Style and applyStyle in the backends, more "future proof" (and easier to maintain)

@ianharrigan
Copy link
Member

Actually, i might have misunderstood this a little. Leave it with me, ill come back with fresh eyes tomorrow. ;)

@elnabo
Copy link
Author

elnabo commented May 25, 2017

I just noticed the class haxeui.core.TextInput, why not have its common properties there ?

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.

2 participants