GUI: Change keyboard focus to listbox

4 ビュー (過去 30 日間)
Tobias Litherland
Tobias Litherland 2012 年 1 月 24 日
Hi
I've got a workflow related GUI question.
Situation: A GUI with 3 buttons and a listbox. Buttons populate listbox with various content.
What i want to do: When i press the buttons, I want focus to shift to the listbox automatically. This so that the user may easily navigate the listbox using the arrow-keys and use ctrl+a if needed, without having to press tab first.
I tried changing the main GUI property 'CurrentObject' to the listbox handle, but this had no effect. Also, changing the listbox handle property 'Selected' to 'on' had no effect.
Does anyone have a solution?
Tobias

採用された回答

Jan
Jan 2012 年 1 月 24 日
Perhaps this helps:
uicontrol(ListboxHandle)

その他の回答 (1 件)

John Perko
John Perko 2013 年 6 月 6 日
No such thing in Matlab 2010b as "ListboxHandle".
  1 件のコメント
Tobias Litherland
Tobias Litherland 2013 年 6 月 6 日
A listbox handle is a unique pointer to a specific listbox. When you create a listbox (or any other object, for that matter) the output is a pointer to that specific object:
handleToListbox = uicontrol('Style', 'listbox','string','test');
handleToPlot = plot(1:10,rand(10,1));
handleToFigure = figure;
And so on.
To set keyboard focus to the listbox created above, use:
uicontrol(handleToListbox)

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

カテゴリ

Help Center および File ExchangeDesktop についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by