ryanmcgrath/cacao

todos_list example perference planel size

dominikwilkowski opened this issue · 2 comments

I've been trying to read through the code and make sense of it all. The todos example is great as it touches a lot of topics.
Unfortunately I can't figure out why the preference panel size is borked. It seems to be missing a min content area perhaps? Where would I find more docs for this? Are there other things LayoutConstraint::activate takes than is in the code?
I'd appreciate any sort of docs here you may have. (I don't know much about C# and being able to build macos apps with rust is a dream. This is a fantastic crate!

Using trunk as of c739479
With rust 1.64.0

image

Ah, good catch. That could be solved with a window min size setting, yeah - in examples/todos_list/preferences/mod.rs, did_load(...):

window.set_minimum_content_size(300., 100.);

That said I tend to prefer a different solution: add a layout constraint to the ToggleOptionView like so, which means that any extra options added to the preferences view won't need to contend with the window trying to push a size.

(in ToggleOptionView's layout constraints)

subtitle.width.constraint_greater_than_or_equal_to_constant(100.),

The docs are tricky because it's ultimately just AppKit AutoLayout and/or NSWindow functions, just from the Rust side. There should be docs built on crates.io though, and someone did a pass recently to bump them up a bit.

(Feel free to PR the code change above for the example, otherwise I'll get it at some point here)

I added a PR to add the fix. Thanks for the pointer.
(This issue should close automatically when the PR is merged.)