Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

component is deprecated. moving from zenity to slint for all graphical applications. #5382

Closed
ghost opened this issue Jun 10, 2024 · 2 comments

Comments

@ghost
Copy link

ghost commented Jun 10, 2024

if i take this as a code template

import { StandardButton, GridBox, LineEdit } from "std-widgets.slint";
_ := Dialog {
    property name <=> name-le.text;
    property address <=> address-le.text;
    StandardButton { kind: ok; }
    StandardButton { kind: cancel; }
    preferred-width: 300px;
    GridBox {
        Row {
            Text { text: "Enter your name:"; }
            name-le := LineEdit { }
        }
        Row {
            Text { text: "Address:"; }
            address-le := LineEdit { }
        }
    }
}

then the declarable gives

':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'

any solution for this.

@hunger
Copy link
Member

hunger commented Jun 10, 2024

I would opt for a more descriptive name than _ like maybe UserDataDialog:

import { StandardButton, GridBox, LineEdit } from "std-widgets.slint";
component UserDataDialog inherits Dialog {
    property name <=> name-le.text;
    property address <=> address-le.text;

    StandardButton { kind: ok; }
    StandardButton { kind: cancel; }

    preferred-width: 300px;

    GridBox {
        Row {
            Text { text: "Enter your name:"; }
            name-le := LineEdit { }
        }
        Row {
            Text { text: "Address:"; }
            address-le := LineEdit { }
        }
    }
}

Basically X := Foo { } becomes component X inherits Foo {}, but actually component X { } works now, too.

You might also want to export the components you want to access from your business logic or from other .slint files, which would turn the above into export component UserDataDialog inherits Dialog {.

I hope this helps!

@ghost
Copy link
Author

ghost commented Jun 10, 2024

@hunger thank you and would it be possible to export the variable that we are reading in Text to another variable by shadowing the variable or implementing the hostig. Let me know.

I get to learn the SlintUI first through shell and then putting the javascript and rust later on for some of the applications development. Thank you, Gaurav

@slint-ui slint-ui locked and limited conversation to collaborators Jun 10, 2024
@ogoffart ogoffart converted this issue into discussion #5383 Jun 10, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant