-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
layout.formLayout do not handle canvas.Text well in second column #4665
Comments
I don't think this is the fault of a layout. The "canvas.Text" is a draw primitive - it has no awareness of standard widget sizes etc. using a "Label" in this place would align perfectly. |
I think the special case code in first column was because a form expects the left will normally be text... so it is simulating a theme label for you. Maybe that is the bug? |
Yes, but the thing that causes the bug is our special handling of text on the left, not adding more special handling on the right? If you are using it for condensed usage but we add the code in you suggest then won't it behave exactly like a label and the condensed usage will be taken away? |
Yes, correct
I think the effect of condensed text (rows) is still there as you can see on the first three rows in the screenshot attached. An example of mixed labels and text in the "altered"/fixed formLayout (textformlayout.go). form := container.New(l.NewTextFormLayout(),
canvas.NewText("text 1", colornames.Yellow), canvas.NewText("text 4", colornames.Yellow),
canvas.NewText("text 2", colornames.Yellow), canvas.NewText("text 5", colornames.Yellow),
canvas.NewText("text 3", colornames.Yellow), canvas.NewText("text 6", colornames.Yellow),
widget.NewLabel("label 1"), canvas.NewText("text 7", colornames.Green),
widget.NewLabel("label 2"), canvas.NewText("text 8", colornames.Green),
widget.NewLabel("label 3"), canvas.NewText("text 9", colornames.Green),
canvas.NewText("text 10", colornames.Orange), widget.NewLabel("label 4"),
canvas.NewText("text 11", colornames.Orange), widget.NewLabel("label 5"),
canvas.NewText("text 12", colornames.Orange), widget.NewLabel("label 6"),
widget.NewLabel("label 7"), widget.NewLabel("label 10"),
widget.NewLabel("label 8"), widget.NewLabel("label 11"),
widget.NewLabel("label 9"), widget.NewLabel("label 12"),
)
window.SetContent(form) |
Checklist
Describe the bug
The form layout do not handle canvas.Text in the second column very well.
The texts at each line in first column do not align vertically with matching texts in second column.
How to reproduce
Create a formlayout with canvas.Text's in both columns.
Screenshots
Example code
Fyne version
2.4.4
Go compiler version
1.21.3
Operating system and version
macOS Sonoma 14.2.1
Additional Information
A hint to a solution and where the problem might lie.
This is a fix I've used in my own project.
The solution for rendering second column is merely trying to mirror the special case handling of canvas.Text in first column.
DO NOTE: The solution is not verified or tested but within my own code with acceptable visual result.
The text was updated successfully, but these errors were encountered: