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

Missing custom widgets with a template #316

Open
GeoffreyCoulaud opened this issue Nov 3, 2021 · 1 comment
Open

Missing custom widgets with a template #316

GeoffreyCoulaud opened this issue Nov 3, 2021 · 1 comment

Comments

@GeoffreyCoulaud
Copy link

Hello,

In GJS it's possible to add a XML template to a custom widget, as explained in the documentation.

Luckily, in GJS it is quite simple to load a user interface template

/* imports */
GObject.registerClass({
    Template: 'url://templateurl',
    InternalChildren: ['button'] // Array of IDs
}, class X extends GObject.Object {
    /* implementation */
});

Now you can access the button like this :

this._button.do_something();

This is really useful and lacks in node-gtk, Would it be possible to have a different gi.registerClass, which behave as now when 1 parameter is passed, and behave like described above when 2 are ?

@binyamin
Copy link
Collaborator

binyamin commented Nov 4, 2021

Noting for posterity: this is coming from the discord chat.

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

No branches or pull requests

2 participants