Skip to content
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

Start fixing scrolling containing entries #1994

Merged
merged 2 commits into from Feb 26, 2021

Conversation

andydotxyz
Copy link
Member

@andydotxyz andydotxyz commented Feb 21, 2021

When setting up an entry do not expose a scroll container unless multiline or scrolling is specified.
This is the best we can do until a future version of event handling that can reflect on object state not existance.

Fixes #1939

TODO

  • Reconfigure if the wrap type changes

Checklist:

  • Tests included.
  • Lint and formatter run with no errors.
  • Tests all pass.

When setting up an entry do not expose a scroll container unless multiline or scrolling is specified.
Fixes fyne-io#1939
Copy link
Member

@Jacalz Jacalz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is working as expected. Thank you very much 👍
I know that this is a draft, I just popped in a little comment while at it 😅

widget/entry.go Outdated
@@ -158,13 +158,21 @@ func (e *Entry) CreateRenderer() fyne.WidgetRenderer {
// initialise
e.textProvider()
e.placeholderProvider()
scrolling := e.Wrapping != fyne.TextWrapOff
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't this just be moved into the if statement on line 169?

Required also fixing test masters for the off state which is now correct.
@andydotxyz
Copy link
Member Author

I don't know if it is useful, but I was playing with this code to test the changing state :)

func main() {
	a := app.New()
	w := a.NewWindow("Hello")

	e1 := widget.NewEntry()
	e1.Wrapping = fyne.TextWrapOff
	e2 := widget.NewEntry()
	e2.Wrapping = fyne.TextWrapOff
	e3 := widget.NewEntry()
	e3.Wrapping = fyne.TextWrapOff

	off := true
	w.SetContent(container.NewVBox(container.NewScroll(
		container.NewVBox(e1, e2, e3),
	),
	widget.NewButton("Scroll", func() {
		if off {
			e2.Wrapping = fyne.TextTruncate
		} else {
			e2.Wrapping = fyne.TextWrapOff
		}
		off = !off
		e2.Refresh()
	}),
	))

	w.ShowAndRun()
}

@andydotxyz andydotxyz marked this pull request as ready for review February 25, 2021 16:44
@andydotxyz andydotxyz merged commit 580b3de into fyne-io:develop Feb 26, 2021
@andydotxyz andydotxyz deleted the fix/1939 branch February 26, 2021 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants