Bonjour à tous,
Je travaille actuellement sur une interface graphique qui sera composée de plusieurs fenêtres. Je souhaiterais rentrer dans la première fenêtre avec des données, et lorsque j'appuie sur un des pushbuttons, je ferme la première fenêtre et une seconde apparaît. Cependant je ne sais pas trop comment passer les données d'une interface à une autre. Je pensais à priori (et pour plus de facilité) créer une actualisation d'une variable lorsque je presse un bouton, sortir cette variable lorsque la première fenêtre se ferme et ainsi ouvrir la seconde fenêtre (qui dépendra donc du bouton appuyé). Malheureusement, je ne parviens pas à sortir cette variable actualisée (qui correspond à varargout{2} dans mon code)
Voici mon code:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13 % --- Outputs from this function are returned to the command line. function varargout = menu_principal_OutputFcn(hObject, eventdata, handles) % varargout cell array for returning output args (see VARARGOUT); % hObject handle to figure % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Get default command line output from handles structure % structure.nomchoc=handles.output; varargout{1} = get(handles.edit1,'String'); choix1=getappdata(handles.choix); varargout{2} = choix1; close(hObject)Merci d'avance pour votre aide
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 % --- Executes on button press in pushbutton1. function pushbutton1_Callback(hObject, eventdata, handles) % hObject handle to pushbutton1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % choix_profilmenu; handles.choix=1; uiresume(gcbf); % --- Executes on button press in pushbutton2. function pushbutton2_Callback(hObject, eventdata, handles) % hObject handle to pushbutton2 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % encodage; handles.choix=2; uiresume(gcbf);
Partager