Changeset 850 for trunk/src/set_object.m


Ignore:
Timestamp:
Jan 16, 2015, 11:32:34 AM (9 years ago)
Author:
sommeria
Message:

add command clear line on set-object

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/set_object.m

    r809 r850  
    3838function varargout = set_object(varargin)
    3939
    40 % Last Modified by GUIDE v2.5 08-May-2014 23:03:29
     40% Last Modified by GUIDE v2.5 16-Jan-2015 11:03:00
    4141
    4242% Begin initialization code - DO NOT REFRESH
     
    593593
    594594set(handles.REFRESH,'BackgroundColor',[1 0 0])
    595 %set(handles.Coord,'BackgroundColor',[1 1 1])
    596595set(handles.num_RangeY_2,'BackgroundColor',[1 1 1])
    597596
     
    715714%------------------------------------------------------------------------
    716715web('http://servforge.legi.grenoble-inp.fr/projects/soft-uvmat/wiki/UvmatHelp#ProjObject')
    717 % path_to_uvmat=which ('uvmat');% check the path of uvmat
    718 % pathelp=fileparts(path_to_uvmat);
    719 % helpfile=fullfile(pathelp,'uvmat_doc','uvmat_doc.html');
    720 % if ~isempty(dir(helpfile)), msgbox_uvmat('ERROR','Please put the help file uvmat_doc.html in the sub-directory /uvmat_doc of the UVMAT package')
    721 %     addpath (fullfile(pathelp,'uvmat_doc'))
    722 %     web([helpfile '#set_object'])
    723 % end
    724 %------------------------------------------------------------------------
    725 
    726 function Name_Callback(hObject, eventdata, handles)
    727 % hObject    handle to Name (see GCBO)
    728 % eventdata  reserved - to be defined in a future version of MATLAB
    729 % handles    structure with handles and user data (see GUIDATA)
    730 
    731 % Hints: get(hObject,'String') returns contents of Name as text
    732 %        str2double(get(hObject,'String')) returns contents of Name as a double
    733 
    734 %------------------------------------------------------------------------
    735 % --- Executes when entered data in editable cell(s) in Coord.
    736 function Coord_CellEditCallback(hObject, eventdata, handles)
    737 %------------------------------------------------------------------------
    738 %set(handles.Coord,'BackgroundColor',[1 1 0])
    739 % ListType=get(handles.Type,'String');
    740 % Type=ListType{get(handles.Type,'Value')};
    741 % switch Type
    742 %     % add lines if multi line input needed
    743 %     case{'points','polyline','polygon'}
    744 %         Input=str2num(eventdata.EditData);%pasted input
    745 %         Coord=get(handles.Coord,'Data');
    746 %         iline=eventdata.Indices(1);% selected line number
    747 %         if size(Coord,1)<iline+numel(Input)
    748 %             Coord=[Coord ; zeros(iline+numel(Input)-size(Coord,1),size(Coord,2))];% append zeros to fit the new column
    749 %         end
    750 %         Coord(iline:iline+numel(Input)-1,eventdata.Indices(2))=Input';
    751 %         set(handles.Coord,'Data',Coord)
    752 % end
    753 %------------------------------------------------------------------------
     716
     717%------------------------------------------------------------------------
    754718% --- Executes when selected cell(s) is changed in ListCoord.
    755 %------------------------------------------------------------------------
     719%------------------------------------------------------------------------ 
    756720function Coord_CellSelectionCallback(hObject, eventdata, handles)
    757 
    758721if ~isempty(eventdata.Indices)
    759722    iline=eventdata.Indices(1);% selected line number
    760     set(handles.Coord,'UserData',iline)% used possibly for line deletion or table extension, using key_press_fcn
     723    set(handles.CoordLine,'String',num2str(iline))
    761724end
    762725
     
    785748if ismember(xx,[127 31])% delete, or downward
    786749    Coord=get(handles.Coord,'Data');
    787     iline=get(handles.Coord,'UserData');
     750    iline=str2double(get(handles.CoordLine,'String'));
    788751            if isequal(xx, 31)
    789752                if isequal(iline,size(Coord,1))% arrow downward
     
    795758    set(handles.Coord,'Data',Coord);
    796759end
     760
     761%------------------------------------------------------------------------
     762% --- Executes on button press in clear_line.
     763%------------------------------------------------------------------------
     764function clear_line_Callback(hObject, eventdata, handles)
     765
     766Coord=get(handles.Coord,'Data');
     767iline=str2double(get(handles.CoordLine,'String'));
     768if isempty(iline)
     769    msgbox_uvmat('WARNING','no line suppressed, select a line in the table')
     770else
     771    Coord(iline,:)=[];
     772    set(handles.REFRESH,'BackgroundColor',[1 0 1])
     773    set(handles.Coord,'Data',Coord);
     774    set(handles.CoordLine,'String','')
     775    REFRESH_Callback(hObject,eventdata,handles)
     776end
Note: See TracChangeset for help on using the changeset viewer.