added get_top_selected function (useful with checkbox three-state)