Code Monkey home page Code Monkey logo

Comments (5)

andydotxyz avatar andydotxyz commented on August 24, 2024

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.
The layout is correctly asking the item to fill that space and the text responds by putting it at the top left.
This sort of misalignment can happen if you mix canvas primitives and widgets - they serve different purposes.

from fyne.

andydotxyz avatar andydotxyz commented on August 24, 2024

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?

from fyne.

chran554 avatar chran554 commented on August 24, 2024

I did not see the possibility to use text in the formlayout as a bug.
Bug or not, I liked the possibility to use text instead of labels because it can give you a very condensed layout that way without the spacing between labels.

If you offer the use of text in the first column I rather thought it would be consistent if you could use text in the second column as well.

image

from fyne.

andydotxyz avatar andydotxyz commented on August 24, 2024

I did not see the possibility to use text in the formlayout as a 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?

from fyne.

chran554 avatar chran554 commented on August 24, 2024

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?

Yes, correct

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?

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).
image

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)

from fyne.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.