With some help i've created a variable amount of buttons in my gui:
for n=1:shandles.b{n}=uicontrol('Style','PushButton','Units','pixels', 'Position',[125-breiteQuadrat/2-5+breiteQuadrat*n 45 10 10],'Visible','on'); end
Now i want to colour the button when it is selected and when you click twice it has the start-colour. here i call the callback function:
for n=1:sset(handles.b{n},'Callback',@(obj,event)varBButton_Callback(n,hObject,eventdata,handles)); end
for the callback i implemented a new function:
function varBButton_Callback(n,hObject, eventdata, handles)if get(handles.b{n},'Value')==get(handles.b{n},'Max')set(handles.b{n},'BackgroundColor',[1 0 0],'Value','Min');set(handles.tauschButton,'enable','on');set(handles.deaktivierenButton,'enable','on');elseset(handles.b{n},'BackgroundColor',[1 1 1],'Value','Max');endguidata(hObject, handles);
the change of the value doesn't work but i can't find my mistake.
and after that i want that it is possible to remove or change the position of the selected button. maybe someone has an idea how to realize that problem Thank you
Best Answer