dlangui
dlangui copied to clipboard
Wrongly calculated widget sizes
Here's screenshot of example1 starting on Linux LXDE. As you can see buttons and some other widgets are not big enough to hold their contents.
Try increasing window height.
It becomes ok if I increase window height. But I don't remember such issue on Windows. So something different in Linux version.
Font height is handled a bit different in Win32 font engine and FreeType. Probably, FreeType font is bigger for the same requested height
I think it makes sense to fix either Win32 or FreeType engine to produce exactly the same font size and line height for requested font size.
Maybe better is just change window height and/or width when mainWidget
need more area? The same font family name on different platforms can have different visual representation.
It's hard to measure widget if some of its parts are stretched (FILL_PARENT)
Now when window is too small widgets are shrink so I think we know how much more space is needed. https://github.com/buggins/dlangui/blob/master/src/dlangui/widgets/layouts.d#L177
I think there should be three options (flag in window):
- shrink widgets (now implemented in layouts)
- resize window
- add scrollbars to window (on some platforms we can't just resize window, or when window will be bigger than screen)
Maybe we should add special layout to window that will be the invisible window root widget. That layout will manage mainWidget
, shrink it or change Window size, eventually add scrollbars to window.
That is only idea. Need more investigation what is possible, what will be break.
What do you think about it?
I made some more investigation and I probably know how to implement behavior like in above comment. Do you working on this issue? Please let me know. I can make some prototype but I don't want overlap your work.
I'm not working on this issue now.
OK, I start working on this issue.
Solution in #379.
There is one issue in current implementation. When widget width depends on height - width can be incorrect. For example WidgetList
width is too small when scrollbar appears. Thinking how to fix that without API change.
I made big refactoring on my devel branch. Not ready for merge yet, but maybe someone want to check/test ;) Some controls need more work and there will be API break:
- separate measurement of the minimum size,
- flag to set control height depend on width,
- do not stretch widgets' height in horizontal layout
- do not stretch widgets' width in vertical layout
- possibility to word wrap in checkbox
- possibility to word wrap in radiobutton
- layoutWeight determines the ratio of free space that the control will take
-
measuredContent
->adjustMeasuredSize
- alignments in linearlayout
- word wrap in edits (but need more work)
- currently it works only in SDL
It is currently used in my Agile Commander from version 1.1.0 (because old algorithm has a lot of problems).