Listbox - select row through code, not with mouse

2 ビュー (過去 30 日間)
Brent
Brent 2011 年 2 月 7 日
How can you define in code which element of a listbox is selected (similar to the C# .selectedIndex property)?
I populate a listbox with various elements. In a textbox, the user would specify a number. I would like the highlighted row in the listbox to reflect this value entered. So if I had a listbox with the values 1 through 10 and the user entered 4, the fourth row would be highlighted.
Thanks for any help.

採用された回答

Walter Roberson
Walter Roberson 2011 年 2 月 7 日
set(boxhandle, 'Value', 4)
The Value should be the index, not the content.
  1 件のコメント
Brent
Brent 2011 年 2 月 8 日
Thank you.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMigrate GUIDE Apps についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by