一个简单的matlab图形界面程序GUI(3)

function preBut_Callback(hObject, eventdata, handles)
% hObject    handle to preBut (see GCBO) 
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% previous button callback
    current_no = str2double(get(handles.imgNo,'String'));
    if imgno_number_check(current_no, handles) == -1
        return;
    elseif imgno_number_check(current_no, handles) == 2
        msgbox('At the first image!!','Attention','modal');
    else
        current_no = current_no - 1;
    end
    gui_contents_update(handles, current_no);
    guidata(hObject, handles);

function nextBut_Callback(hObject, eventdata, handles)
% hObject    handle to nextBut (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% next button callback
    current_no = str2double(get(handles.imgNo,'String'));
    if imgno_number_check(current_no, handles) == -1
        return;
    elseif imgno_number_check(current_no, handles) == 3
        msgbox('At the last image!!','Attention','modal');
    else
        current_no = current_no + 1;
    end
    gui_contents_update(handles, current_no);
    guidata(hObject, handles);

% --- Executes on button press in timesRd.
function timesRd_Callback(hObject, eventdata, handles)
% hObject    handle to timesRd (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of timesRd

function showGUI_CreateFcn(hObject, eventdata, handles)
% hObject    handle to showGUI (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called
    handles.sliderImageNo.maxValue = 6000;
    handles.sliderImageNo.minValue = 1;
    guidata(hObject, handles);

function nbs_Callback(hObject, eventdata, handles)
% hObject    handle to nbs (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
    current_no = floor(str2double(get(handles.imgNo,'String')));
    if imgno_number_check(current_no, handles) == -1
        return;
    end
    gui_contents_update(handles, current_no);
    guidata(hObject, handles);
   
function nbs_CreateFcn(hObject, eventdata, handles)
% hObject    handle to nbs (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

function showGUI_DeleteFcn(hObject, eventdata, handles)
% hObject    handle to showGUI (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

function sliderObj_Callback(hObject, eventdata, handles)
% hObject    handle to sliderObj (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
    objNo = get(hObject, 'Value');
    objNo = floor(objNo);
    set(handles.objNo, 'String', num2str(objNo));
    current_no = str2double(get(handles.imgNo, 'String'));
    if imgno_number_check(current_no, handles) == -1
        return;
    else
        gui_contents_update(handles, current_no);   
    end
    guidata(hObject, handles);

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/80870949e2c8b65d9c1641a4b17a3f93.html