필터 지우기
필터 지우기

How to add the figure toolbar to axes in a gui?

조회 수: 6 (최근 30일)
Rikimaru83
Rikimaru83 2011년 8월 5일
Hi, I'd like to read your suggestions about a trouble that i'm facing these days. I'm wirting a gui(using the guide), this gui plots some 2D and 3D graphs, now the question is that i'd like to add to those graphs the figure toolbar,giving the user the possibility to zoom in, zoom out, save the figure and so on. I'd like to add the toolbar only to the plotted graphs and not to the entire gui figure. I've tried many different ways, but nothing seems to work. Is it possible to perform this or I have to let go this idea? Thanks for your answers.

채택된 답변

Jan
Jan 2011년 8월 5일
The figure toolbar belongs to a FIGURE. It would be rather confusing, if standard GUI elements are attached to unsual objects -the AXES here-, because GUIs should be as intuitive as possible and follow te usual look-and-feel.
You could create 2 figures, one for the GUI and one for the diagrams. Then the toolbar is attached to the diagram figure only. Another idea is FEX: MenuBar.
  댓글 수: 1
Rikimaru83
Rikimaru83 2011년 8월 6일
A Very helpful function. As I was thinking about, the solution is to use the uicontextmenu to add a menubar to any gui elements. Thanks for your suggestions.

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

Desiree
Desiree 2011년 8월 5일
The question would be how these additional graphs are created and if they reside in a new figure window. If they reside in a figure you can use this command to set the toolbar: set(hObject,'toolbar','figure'); You will not be able to add the toolbar for an axes in a figure, you can only do this for a whole figure.

Rikimaru83
Rikimaru83 2011년 8월 5일
Hi,first of all thanks for your answer. What about the addictional graphs, they are children of axes in the gui. As matter of fact when I try to enable the figure toolbar on the gui axes(parent of the addictional graphs) i recive the following error: "There is no 'toolbar' property in the 'axes' class." I've tried to use uipanel instead of axes but the result is always the same. So I've thought to set a figure as children of axes(but this is not possible, because class figure can not be children of class axes),and it is the same using the uipanel instead of axes. So I was thinking about to use the uicontextmenu. Can You tell me something about it? Thanks.
  댓글 수: 1
Desiree
Desiree 2011년 8월 5일
As I already stated you can only associate a toolbar with figures, it's not possible for figure children like axes or uipanel.
You can always workaround this by programming your own buttons and callbacks though.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by