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

Feature Request: add containers for widgets #320

Open
gospacedev opened this issue Oct 20, 2022 · 0 comments
Open

Feature Request: add containers for widgets #320

gospacedev opened this issue Oct 20, 2022 · 0 comments

Comments

@gospacedev
Copy link

The way to set the positions of widgets is through the x1 y1 coordinates in func (*Block) SetRect:

p := widgets.NewParagraph()
	p.Title = "Lunar"
	p.Text = selectedAudio
	p.SetRect(0, 0, 40, 3)
	p.TitleStyle.Fg = ui.ColorYellow
	p.BorderStyle.Fg = ui.ColorCyan

	c := widgets.NewParagraph()
	c.Title = "Audio Controls"
	c.Text = `Pause and play music: [ENTER]
Volume: [↓ ↑]
Speed:  [← →]
Normal Speed: [Ctrl + N]
Back to menu: [BACKSPACE]
Quit Lunar: [ESC]
	`
	c.SetRect(0, 4, 40, 12)
	c.TitleStyle.Fg = ui.ColorYellow
	c.BorderStyle.Fg = ui.ColorCyan

	ui.Render(p, c)

But this can create overlap over widgets:

+-Lunar--------------------------------+
|Playing Charlie Puth                  |
+--------------------------------------+
|Normal Speed: [Ctrl + N]              |
|Back to menu: [BACKSPACE]             |
|Quit Lunar: [ESC]                     |
+--------------------------------------+

Preferred output:

+-Lunar--------------------------------+
|Playing Charlie Puth                  |
+--------------------------------------+

+-Audio Controls-----------------------+
|Pause and play music: [ENTER]         |
|Volume: [↓ ↑]                         |
|Speed:  [← →]                         |
|Normal Speed: [Ctrl + N]              |
|Back to menu: [BACKSPACE]             |
|Quit Lunar: [ESC]                     |
+--------------------------------------+

My idea is to create a container for the widgets like in the Fyne GUI to position
the widgets and avoid widget overlap:

SetContent(NewVericalBox(c, p))
@gospacedev gospacedev changed the title Feature Request: containers for widgets Feature Request: add containers for widgets Oct 20, 2022
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

1 participant