what's the difference between handles and hObject?
2 ビュー (過去 30 日間)
古いコメントを表示
Where do I use handles and hObject?? And why are there function which contain sometimes both of them plus eventdata and other one of those 3 is missed?? for example function pushbutton1_Callback(hObject, eventdata, handles)
0 件のコメント
採用された回答
Sean de Wolski
2014 年 10 月 2 日
hObject is the handle to the calling object; i.e. the object that is calling the function. handles is a structure with all of the handles to all objects.
The only time I use hObject is if I have two objects sharing a callback, e.g. pushbutton1 and pushbutton2 both call foo_Callback. In this scenario, I would use hObject to determine which one called or if we needed to modify the calling object.
2 件のコメント
Sean de Wolski
2014 年 10 月 3 日
No, it's just an extra variable. If you don't need them, you can deny them with a tilde
mygui(hObject,~,~)
その他の回答 (1 件)
Iain
2014 年 10 月 2 日
handles is a structure holding ALL of the handles for the GUI.
hObject, is JUST the handle for the GUI object used.
eventdata contains specific event data - like what cell got selected on a table/what key got pressed.
参考
カテゴリ
Help Center および File Exchange で Data Type Identification についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!