-
Notifications
You must be signed in to change notification settings - Fork 36
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
How to set property requiring more than one parameter? #21
Comments
Just for the record, setting the size can be done using distinct properties for width and height: gtk! {
<AspectFrame::new(None, 0.5, 0.5, 1f32, false)
property_width_request=100
property_height_request=100>
<Button label="xalala" />
</AspectFrame>
} |
The right thing to do here, I think, is to go with the two individual properties. However, I hate those "property_" names and I think I'll need to add helper methods for them. Leaving the issue open for that. |
Some properties don't have a single setter though: see set_default_size
(It's mentioned in the docs to be preferred over set_size_request
https://valadoc.org/gtk+-3.0/Gtk.Widget.set_size_request.html)
I think we should accept (1, 2) as multiple parameters (or use a different
type of brackets maybe)
…On Wed, 27 Nov 2019 at 22:28, Bodil Stokke ***@***.***> wrote:
The right thing to do here, I think, is to go with the two individual
properties. However, I hate those "property_" names and I think I'll need
to add helper methods for them. Leaving the issue open for that.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#21?email_source=notifications&email_token=AAKPF5UJBMPGKKG2KTARIALQVZYW7A5CNFSM4JQZ52QKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEFJP4GQ#issuecomment-559087130>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAKPF5X2HDDQESS2API2TUDQVZYW7ANCNFSM4JQZ52QA>
.
|
But those two set different properties - The reason I'm extremely reluctant to add syntax for this is that the only reasonable syntax I can imagine for it ( |
Weird, I'm not sure how I missed that, thanks! Agreed, although I'd still like a way to be able to wrap calls that require more than one argument. I'm currently experimenting with adding an extension trait for https://github.com/subgraph/gtk-layer-shell-rs/blob/master/examples/example.rs#L21-L39 I guess my trait's method could just take a single parameter that would be a tuple, i.e. |
This is also necessary for setters like Notebook::set_action_widget. On the topic of syntax, what about adopting tuple-splatting from python (e.g., |
I'm trying to set a fixed size for a widget:
I'm passing the parameters as a tuple because that's what feels natural in this case. However, I get an error:
How can I set it? Is it necessary to add helper to vgtk (
WidgetHelpers
) for it?The text was updated successfully, but these errors were encountered: