Bonjour,

Voila mon code
Il y a sûrement plus facile mais

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
function pushbuttonRemove_Callback(hObject, eventdata, handles)
rowData= get(handles.listboxData,'Value');
listBoxData=get(handles.listboxData,'String');  %[nb,1]
 
%...   
 
temp=get(handles.listboxData,'String');  %[nb,1]
lengthData=length(temp);
 
if lengthData~=1 && rowData~=lengthData && rowData~=1
        listBoxData=cell(lengthData-1,1);  %new size
        listBoxData(1:rowData-1,1)=temp(1:rowData-1,1);
        listBoxData(rowData:end,1)=temp(rowData+1:end,1);
else
 
    %removed the first element 
    if rowData==1
            listBoxData=cell(lengthData-1,1);
            listBoxData(1:end,1)=temp(2:end,1)
    end
 
    %blank list
        if lengthData==1
            listBoxData(1,1)=cellstr('');
        end
 
        %removed the last element 
        if lengthData==rowData
            listBoxData=cell(lengthData-1,1);
            listBoxData(1:end,1)=temp(1:end-1,1);
        end
 
end
set(handles.listboxData, 'String',listBoxData(:,1));
Donc ça marche sauf quand je passe dans la condition "removed the last element "
Un disp avant le set, me donne bien la liste que je veux. Mais j'ai un Warning, la listBox devient grise ...

le Warning:
Warning: single-selection listbox control requires that Value be an integer within String range
Control will not be rendered until all of its parameter values are valid.
Mais pourquoi le reste marche et pas ça!
J'ai bien vérifié de rentrer dans une seule condition à la fois!



merci