Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.
|
|
John
Posts:
17
Registered:
7/8/07
|
|
Re: gui, playing with figures
Posted:
Sep 9, 2009 3:53 AM
|
|
"Matt Fig" <spamanon@yahoo.com> wrote in message <h861q7$so8$1@fred.mathworks.com>... > Your code could be modified this way to do what you want: > > function [] = mygui() > > S.fh = figure('units','pixels',... > 'position',[500 500 350 50],... > 'menubar','none',... > 'numbertitle','off',... > 'name','GUI_20',... > 'resize','off'); > S.ed = uicontrol('style','edit',... > 'units','pixels',... > 'position',[10 10 220 30],... > 'fontsize',14,... > 'string','Enter Title'); > S.pb = uicontrol('style','push',... > 'units','pixels',... > 'position',[240 10 100 30],... > 'fonts',14,... > 'str','creat figure',... > 'callback',{@pb_call,S}); > > function [] = pb_call(varargin) > L = length(S.fh); > S.fh(L+1) = figure('windowbuttondownfcn',{@fh_wbdfcn},... > 'deletefcn',{@fh_dfcn}); > plot(rand(10,1)); > S.T{L+1} = get(S.ed,'String'); > title(S.T(L+1)); > S.fh > end > > function [] = fh_wbdfcn(varargin) > set(S.ed,'string',S.T{S.fh(S.fh==varargin{1})}) > end > > function [] = fh_dfcn(varargin) > S.fh(S.fh==varargin{1}) = []; > end > > end > > > > > > Note I will leave the commenting up to you!
Thanks for you advice but I have already tried to use windowbuttondownfcn problem is that it is called only when user click inside figure but you can get figure in frond just by clicking on edge of window or by some other way and windowbuttondownfcn doesn’t realize that :( . So I am still looking for another way how to do it.
|
|
|
|