Bugzilla – Bug 24907
Truncated labels in qt and ncurses
Last modified: 2006-07-21 07:30:47 UTC
In the attached screenshots, the label above the second selection box is supposed to display the string selected in the first selection box. But the label is truncated to the length of the shorter string in the first box. The source of this dialog is modules/y2c_nfs_server/ui.ycp, function ExportsDialog().
Created attachment 8931 [details] Screenshot in qt
Created attachment 8932 [details] Screenshot in ncurses
You are talking about the "table" widget, not the SelectionBox, right? This is what is used in this code example.
Oops, of course, the lower one is a table.
This is a layout problem, not an UI problem: Since the table itself does not have a caption above it (it has column headers instead), you are using a Label widget to simulate that. The label widget, however, does NOT resize itself when its label (its value) is changed, so it sticks to its initial size. You can either make the label large enough when you create it (specify `opt(`hstretch) should do the trick) or put it inside a ReplacePoint and then replace the entire widget rather than change its label. ReplaceWidget() unlike ChangeWidget() causes a re-layout of the dialog. BTW this is a feature, not a bug: Geometry management is expensive, so we don't do that upon every single ChangeWidget() call.
OK, hstretch worked. Please mention this in the layout tutorial, the difference between ChangeWidget and ReplaceWidget as well as the trick with reserving enough space beforehand. By the way, the original code reserved a fixed-width space which did not work because the space shrunk as the label got a new shorter value. Not the way to go.
(found in SL 7.3 pre, moving just to make it public)
UI::RecalcLayout now exists for such situations