native-windows-gui icon indicating copy to clipboard operation
native-windows-gui copied to clipboard

Controls should provide functions to return their preferred size

Open vmcrash opened this issue 3 years ago • 3 comments

E.g. for a Button this would mean to return the minimum size that is required not cut off any text or image. For text fields or labels this should consider the set text, too.

For an inspiration, you may look at the implementation for Button in SWT (search for computeSizeInPixels)

This is a fundamental requirement to set the correct control's size, to implement layout managers on top of the controls.

vmcrash avatar Oct 10 '20 08:10 vmcrash

Some control implements way to find this (ex: BCM_GETIDEALSIZE for Button). Not sure all controls have this though. Will probably take some time to implement

gabdube avatar Oct 10 '20 12:10 gabdube

If I would have enough Rust experience* I'd start with the most important ones: buttons, checkboxes, radiobuttons, single line input fields. The others like multiline input fields, tables and trees can return a hard coded size, IMHO.

*) For my first project to start learning Rust I need a decent GUI library and yours looks the most feature-complete (though it is limited to Windows only).

vmcrash avatar Oct 11 '20 05:10 vmcrash

Probably not that important for an input, as it scrolls. Labels though... Would greatly appreciate this.

kim8823 avatar Oct 16 '22 20:10 kim8823