code: func (p *Pages) AddPage(name string, item Primitive, resize, visible bool) *Pages {
  	hasFocus := p.HasFocus()
  	for index, pg := range p.pages {
  		if pg.Name == name {
  			p.pages = append(p.pages[:index], p.pages[index+1:]...)
  			break
  		}
  	}
  	p.pages = append(p.pages, &page{Item: item, Name: name, Resize: resize, Visible: visible})
  	if p.changed != nil {
  		p.changed()
  	}
  	if hasFocus {
  		p.Focus(p.setFocus)
  	}
  	return p
  }
docs: // AddPage adds a new page with the given name and primitive. If there was
  // previously a page with the same name, it is overwritten. Leaving the name
  // empty may cause conflicts in other functions so always specify a non-empty
  // name.
  //
  // Visible pages will be drawn in the order they were added (unless that order
  // was changed in one of the other functions). If "resize" is set to true, the
  // primitive will be set to the size available to the Pages primitive whenever
  // the pages are drawn.