// Selected returns the data about the selected item. // func (widget *List) Selected() (*Item, error) { key, e := gunvalue.SelectedValue(widget.model, widget.selection, rowKey).String() if e != nil { return nil, e } conf, ok := widget.rows[key] if !ok { // TODO: warn return nil, errors.New("no matching row found") } return conf.Conf, nil }
// Selected returns the applet package for the selected line. // func (widget *List) Selected() datatype.Appleter { sel, e := widget.tree.GetSelection() if e != nil { return nil } name, e := gunvalue.SelectedValue(widget.model, sel, RowKey).String() if widget.log.Err(e, "Get selected iter name GoValue") { return nil } if row, ok := widget.rows[name]; ok { return row.Pack } widget.log.NewErr("List Selected: no matching row") return nil }