Skip to content

Commit

Permalink
ComboBox: Preselect single option.
Browse files Browse the repository at this point in the history
  • Loading branch information
lxn committed Apr 17, 2013
1 parent 9377011 commit 3231cda
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion combobox.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,15 @@ func (cb *ComboBox) SetModel(model ListModel) error {
cb.attachModel()
}

return cb.resetItems()
if err := cb.resetItems(); err != nil {
return err
}

if model != nil && model.ItemCount() == 1 {
cb.SetCurrentIndex(0)
}

return nil
}

func (cb *ComboBox) Format() string {
Expand Down

0 comments on commit 3231cda

Please sign in to comment.