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

TextEdit height #577

Open
DK-92 opened this issue Jun 29, 2019 · 3 comments
Open

TextEdit height #577

DK-92 opened this issue Jun 29, 2019 · 3 comments

Comments

@DK-92
Copy link

DK-92 commented Jun 29, 2019

Good day,

I am using TextEdit to display the body of a HTTP response. The problem is, once the response gets too big, the TextEdit control will just grow to a size larger than the window. Below is an example of how it should look.

one

Once there is a large amount of text however, it will look as such.

two

There is no way to scroll or resize.

The code for the tabpage looks as such.

					TabPage{
						Title:  "Response",
						Layout: VBox{},
						Children: []Widget{
							GroupBox{
								Title:  "Response information",
								Layout: Grid{Columns: 2},
								Children: []Widget{
									Label{Text: "Response"},
									LineEdit{Text: strconv.Itoa(entry.Response.Status) + " " + entry.Response.StatusText, ReadOnly: true}, // LineEdit doesn't work with ints
									Label{Text: "HTTP Version"},
									LineEdit{Text: Bind("Response.HTTPVersion"), ReadOnly: true},
								},
							},
							GroupBox{
								Title:  "Headers",
								Layout: VBox{},
								Children: []Widget{
									TableView{
										Columns: []TableViewColumn{
											{Title: "Name", Width: 200},
											{Title: "Value", Width: 300},
											{Title: "Comment", Width: 100},
										},
										Model: table.NewHeaderModel(&entry.Response.Headers),
									},
								},
							},
							GroupBox{
								Title:  "Content",
								Layout: Grid{Columns: 2},
								Children: []Widget{
									Label{Text: "Size in bytes"},
									LineEdit{Text: strconv.Itoa(entry.Response.Content.Size), ReadOnly: true},
									Label{Text: "Bytes saved by compression"},
									LineEdit{Text: strconv.Itoa(entry.Response.Content.Compression), ReadOnly: true},
									Label{Text: "MimeType"},
									LineEdit{Text: Bind("Response.Content.MimeType"), ReadOnly: true},
								},
							},
							GroupBox{
								Title:  "Response body",
								Layout: VBox{},
								Children: []Widget{
									TextEdit{
										Text:     Bind("Response.Content.Text"),
										ReadOnly: true,
										Font:     Font{Family: "Consolas", PointSize: 10},
										HScroll:  true,
										VScroll:  true,
									},
								},
							},
						},
					},

I have not been able to figure out how to solve this issue. Setting the HScroll/VScroll in any way does not seem to help.

Thanks in advance!

@DK-92
Copy link
Author

DK-92 commented Jun 29, 2019

Once I place the TextEdit control into a ScrollView it seems to do the job.

							GroupBox{
								Title:  "Response body",
								Layout: VBox{},
								Children: []Widget{
									ScrollView{
										Layout: VBox{MarginsZero: true},
										Children: []Widget{
											TextEdit{
												Text:     strings.ReplaceAll(entry.Response.Content.Text, "\n", "\r\n"),
												ReadOnly: true,
												Font:     Font{Family: "Consolas", PointSize: 10},
											},
										},
									},
								},
							},

Kind of feel like a hacky solution though, but for now this seems to work.

@lxn
Copy link
Owner

lxn commented Jun 30, 2019

This is probably fixed by some layout system improvements that should land soon. Until then ScrollView is a decent solution.

@StephanVerbeeck
Copy link

StephanVerbeeck commented Feb 4, 2021

  • Frankly we prefer that the TextEdit widget would adhere to the given MaxSize attribute (what else is it for?)
  • Being that told, MaxSize does not seem to work for almost all widgets (is that broken on yet todo or by design).
  • Even if MaxSize is not given it should be assumed to be defined as the size of the current monitor (there can be multiple in the system and they can be enumerated via the windows API but even if it was just the size of the main monitor would be great).

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

No branches or pull requests

3 participants