mirror of https://github.com/rivo/tview.git
Added GetFrontPage() to Pages. Resolves #355
This commit is contained in:
parent
731cb7162a
commit
685bf6da76
11
pages.go
11
pages.go
|
@ -226,6 +226,17 @@ func (p *Pages) SendToBack(name string) *Pages {
|
||||||
return p
|
return p
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetFrontPage returns the front-most visible page. If there are no visible
|
||||||
|
// pages, ("", nil) is returned.
|
||||||
|
func (p *Pages) GetFrontPage() (name string, item Primitive) {
|
||||||
|
for index := len(p.pages) - 1; index >= 0; index-- {
|
||||||
|
if p.pages[index].Visible {
|
||||||
|
return p.pages[index].Name, p.pages[index].Item
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// HasFocus returns whether or not this primitive has focus.
|
// HasFocus returns whether or not this primitive has focus.
|
||||||
func (p *Pages) HasFocus() bool {
|
func (p *Pages) HasFocus() bool {
|
||||||
for _, page := range p.pages {
|
for _, page := range p.pages {
|
||||||
|
|
Loading…
Reference in New Issue