What is edit text box type in GUI when I using findobj function?

1 回表示 (過去 30 日間)
Teemu Juujärvi
Teemu Juujärvi 2015 年 8 月 27 日
コメント済み: Teemu Juujärvi 2015 年 9 月 1 日
Hi,
I try to get GUI edit text box object in separate m-file because I like to print something to this text box from m-file. What is the 'Type' of this edit text box when using findobj function?
Teemu

採用された回答

Cam Salzberger
Cam Salzberger 2015 年 8 月 31 日
Hello Teemu,
I understand that you would like to use the findobj function to get access to edit boxes in a GUI.
The 'Type' of an edit box is actually 'uicontrol', just like all other UI Controls (push buttons, pop-up menus, etc). However, you can specify the 'Style' property when calling findobj to get only edit boxes:
figure
uicontrol('Style','pushbutton')
uicontrol('Style','edit')
hEditBoxes = findobj('Type','uicontrol','Style','edit');
Note that if you use findobj a lot in your code, it can slow things down. If at all possible, save the handle from when you create the edit box (or extract it from the handles structure if the GUI is made in GUIDE) and pass it as an input argument to the function that needs access to the edit box.
I hope that this has helped!
-Cam
  1 件のコメント
Teemu Juujärvi
Teemu Juujärvi 2015 年 9 月 1 日
Thanks that helps a lot! that argument passing idea was great.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSpecifying Target for Graphics Output についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by