tomwalters@0: % method of class @parameter tomwalters@0: % bleeck@3: % (c) 2011, University of Southampton bleeck@3: % Maintained by Stefan Bleeck (bleeck@gmail.com) bleeck@3: % download of current version is on the soundsoftware site: bleeck@3: % http://code.soundsoftware.ac.uk/projects/aimmat bleeck@3: % documentation and everything is on http://www.acousticscale.org tomwalters@0: function param=setcallback(param,text,cback,inbox) tomwalters@0: % every entry can have a callback function that is called when the item tomwalters@0: % looses its focus tomwalters@0: tomwalters@0: cont=param.entries; tomwalters@0: nrent=length(cont); tomwalters@0: tomwalters@0: if nargin<4 tomwalters@0: inbox='all'; tomwalters@0: end tomwalters@0: nr=-1; tomwalters@0: % text can be a string or a number tomwalters@0: if isstr(text) % if its a sting then look for the member number tomwalters@0: % first search for the exact fit tomwalters@0: for i=1:nrent tomwalters@0: if strcmp(cont{i}.text,text) && (strcmp(cont{i}.panel,inbox) || strcmp(inbox,'all')) tomwalters@0: nr=i; tomwalters@0: break tomwalters@0: end tomwalters@0: end tomwalters@0: % then search for the abbreviation tomwalters@0: for i=1:nrent tomwalters@0: if ~isempty(strfind(cont{i}.text,text)) && (strcmp(cont{i}.panel,inbox) || strcmp(inbox,'all')) tomwalters@0: nr=i; tomwalters@0: break tomwalters@0: end tomwalters@0: end tomwalters@0: else tomwalters@0: nr=text; % in this case we wanted to access it by the number tomwalters@0: end tomwalters@0: tomwalters@0: tomwalters@0: if nr>0 tomwalters@0: param.entries{nr}.callback=cback; tomwalters@0: return tomwalters@0: else tomwalters@0: val='setcallback:: error, the entry does not exist'; tomwalters@0: end