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

function rdch_Callback(hObject, eventdata, handles)
% hObject    handle to rdch (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
    if (get(hObject, 'Value') == get(hObject, 'Max'))
        set(hObject, 'String', 'show test results');
    else   
        set(hObject,'String', 'show maps results');
    end
    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);
   
function beginValue_Callback(hObject, eventdata, handles)
% hObject    handle to beginValue (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
    current_no = str2double(get(handles.imgNo,'String'));
    if imgno_number_check(current_no, handles) == -1
        return;
    elseif get(handles.rdch, 'Value') == get(handles.rdch, 'Max')
        gui_contents_update(handles, current_no);       
    end
    guidata(hObject, handles);

function beginValue_CreateFcn(hObject, eventdata, handles)
% hObject    handle to beginValue (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 endValue_Callback(hObject, eventdata, handles)
% hObject    handle to endValue (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
function endValue_CreateFcn(hObject, eventdata, handles)
% hObject    handle to endValue (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 sliderImageNo_Callback(hObject, eventdata, handles)
% hObject    handle to sliderImageNo (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
    current = get(hObject,'Value');
    current = floor(current);
    set(handles.imgNo, 'String', num2str(current));
    gui_contents_update(handles, current);
    guidata(hObject, handles);

% --- Executes during object creation, after setting all properties.
function sliderImageNo_CreateFcn(hObject, eventdata, handles)
% hObject    handle to sliderImageNo (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background.
    if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
        set(hObject,'BackgroundColor',[.9 .9 .9]);
    end
    set(hObject, 'Max', handles.sliderImageNo.maxValue);
    set(hObject, 'Min', handles.sliderImageNo.minValue);
    step = 1/(handles.sliderImageNo.maxValue - handles.sliderImageNo.minValue);
    set(hObject, 'SliderStep', [step, 0.1]);
    initValue = handles.sliderImageNo.maxValue + ...
        handles.sliderImageNo.minValue;
    initValue = floor(initValue/2);
    set(hObject, 'value', initValue);
    guidata(hObject, handles);
   
function imgNo_Callback(hObject, eventdata, handles)
% hObject    handle to imgNo (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
    current_no = str2double(get(hObject,'String'));
    if imgno_number_check(current_no, handles) == -1
        return;
    else
        gui_contents_update(handles, current_no);       
    end
    guidata(hObject, handles);
   
% --- Executes during object creation, after setting all properties.
function imgNo_CreateFcn(hObject, eventdata, handles)
% hObject    handle to imgNo (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
    initValue = handles.sliderImageNo.maxValue + ...
        handles.sliderImageNo.minValue;
    initValue = floor(initValue/2);   
    set(hObject, 'String', num2str(initValue));
    guidata(hObject, handles);

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

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