IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Interfaces Graphiques Discussion :

UI et paramétres


Sujet :

Interfaces Graphiques

  1. #1
    Membre averti
    Inscrit en
    Novembre 2008
    Messages
    19
    Détails du profil
    Informations forums :
    Inscription : Novembre 2008
    Messages : 19
    Par défaut UI et paramétres
    Bonjour a tous ,

    Je réalise en ce moment même une interface graphique qui devrait être appelé lors de l'exécution de ma fonction principal et qui devrait me retourné des valeur dans la fonction principal.

    Code de la fonction principal qui appelle ma GUI (elle s appelle choix...original n'est ce pas^^)

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    [lastFrameNumber,firstFrameNumber,oeil]=choix(firstFrameNumber,lastFrameNumber);
    Donc je lui passe 2 variable avec le Varargin (ce qui fonction sans problème), mais impossible de retrouvé mes variable en sortie

    Comment dois je faire?
    code de la fonction Choix
    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
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    function varargout = Choix(varargin)
    % CHOIX M-file for Choix.fig
    %      CHOIX, by itself, creates a new CHOIX or raises the existing
    %      singleton*.
    %
    %      H = CHOIX returns the handle to a new CHOIX or the handle to
    %      the existing singleton*.
    %
    %      CHOIX('CALLBACK',hObject,eventData,handles,...) calls the local
    %      function named CALLBACK in CHOIX.M with the given input arguments.
    %
    %      CHOIX('Property','Value',...) creates a new CHOIX or raises the
    %      existing singleton*.  Starting from the left, property value pairs are
    %      applied to the GUI before Choix_OpeningFunction gets called.  An
    %      unrecognized property name or invalid value makes property application
    %      stop.  All inputs are passed to Choix_OpeningFcn via varargin.
    %
    %      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
    %      instance to run (singleton)".
    %
    % See also: GUIDE, GUIDATA, GUIHANDLES
     
    % Edit the above text to modify the response to help Choix
     
    % Last Modified by GUIDE v2.5 23-Mar-2009 14:42:25
     
    % Begin initialization code - DO NOT EDIT
    gui_Singleton = 1;
    gui_State = struct('gui_Name',       mfilename, ...
                       'gui_Singleton',  gui_Singleton, ...
                       'gui_OpeningFcn', @Choix_OpeningFcn, ...
                       'gui_OutputFcn',  @Choix_OutputFcn, ...
                       'gui_LayoutFcn',  [] , ...
                       'gui_Callback',   []);
    if nargin & isstr(varargin{1})
        gui_State.gui_Callback = str2func(varargin{1});
    end
     
    if nargout
        [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
    else
        gui_mainfcn(gui_State, varargin{:});
    end
    % End initialization code - DO NOT EDIT
     
     
    % --- Executes just before Choix is made visible.
    function Choix_OpeningFcn(hObject, eventdata, handles, varargin)
    % This function has no output args, see OutputFcn.
    % hObject    handle to figure
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    % varargin   command line arguments to Choix (see VARARGIN)
     
    % Choose default command line output for Choix
    handles.output = hObject;
     
     
    handles.first=varargin{1};
    handles.last=varargin{2};
    % Update handles structure
    guidata(hObject, handles);
     
    % UIWAIT makes Choix wait for user response (see UIRESUME)
    % uiwait(handles.figure1);
    set(handles.edit1,'String', handles.first)
    set(handles.edit2,'String', handles.last)
     
    % --- Outputs from this function are returned to the command line.
    function varargout = Choix_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
    varargout{1} = handles.output;
    varargout{2} = handles.first;
     
    varargout{3} =handles.last;
    varargout{4} = handles.oeil;
     
    % --- Executes during object creation, after setting all properties.
    function edit1_CreateFcn(hObject, eventdata, handles)
    % hObject    handle to edit1 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    empty - handles not created until after all CreateFcns called
     
    % Hint: edit controls usually have a white background on Windows.
    %       See ISPC and COMPUTER.
    if ispc
        set(hObject,'BackgroundColor','white');
    else
        set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
    end
     
     
     
    function edit1_Callback(hObject, eventdata, handles)
    % hObject    handle to edit1 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    % Hints: get(hObject,'String') returns contents of edit1 as text
    %        str2double(get(hObject,'String')) returns contents of edit1 as a
    %        double
    handles.first =get(hObject,'String')
    guidata(hObject, handles);
    % --- Executes during object creation, after setting all properties.
    function edit2_CreateFcn(hObject, eventdata, handles)
    % hObject    handle to edit2 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    empty - handles not created until after all CreateFcns called
     
    % Hint: edit controls usually have a white background on Windows.
    %       See ISPC and COMPUTER.
    if ispc
        set(hObject,'BackgroundColor','white');
    else
        set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
    end
     
     
     
    function edit2_Callback(hObject, eventdata, handles)
    % hObject    handle to edit2 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
     
    % Hints: get(hObject,'String') returns contents of edit2 as text
    %        str2double(get(hObject,'String')) returns contents of edit2 as a double
    handles.last =get(hObject,'String')
    guidata(hObject, handles);
    % --- Executes on button press in radiobutton1.
    function radiobutton1_Callback(hObject, eventdata, handles)
    % hObject    handle to radiobutton1 (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 radiobutton1
    get(handles.radiobutton1,'Value');
    guidata(hObject, handles);
     
    % --- Executes on button press in radiobutton2.
    function radiobutton2_Callback(hObject, eventdata, handles)
    % hObject    handle to radiobutton2 (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 radiobutton2
     
    get(handles.radiobutton2,'Value');
    guidata(hObject, handles);
    % --- 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)
     
    a=get(handles.radiobutton1,'Value');
    b =get(handles.radiobutton2,'Value');
    handles.oeil=a+b;
    handles.first=get(handles.edit1,'Value');
    handles.last=get(handles.edit2,'Value');
    guidata(hObject, handles);
    close(handles.figure1);
    Comme vous le constaterez j'ai essayer d'utiliser les varargout mais ça ne fonctionne pas magnifiquement bien ...Ce qui ne m'etonne pas vu le peu d info que j ai trouvé la dessu

    Donc je viens demander votre aide afin de m'aide à faire sortir ces 3 valeurs...

    Merci d'avance
    Fichiers attachés Fichiers attachés

  2. #2
    Rédacteur/Modérateur

    Avatar de Jerome Briot
    Homme Profil pro
    Freelance mécatronique - Conseil, conception et formation
    Inscrit en
    Novembre 2006
    Messages
    20 317
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations professionnelles :
    Activité : Freelance mécatronique - Conseil, conception et formation

    Informations forums :
    Inscription : Novembre 2006
    Messages : 20 317
    Par défaut
    Tu pourrais attacher le fichier choix.fig dans une archive zip ou rar (comme demandé ici Nouveaux membres, débutants : lisez attentivement ceci)

  3. #3
    Membre averti
    Inscrit en
    Novembre 2008
    Messages
    19
    Détails du profil
    Informations forums :
    Inscription : Novembre 2008
    Messages : 19
    Par défaut
    Voila qui est fait

  4. #4
    Expert confirmé
    Avatar de duf42
    Homme Profil pro
    Formateur en informatique
    Inscrit en
    Novembre 2007
    Messages
    3 111
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 41
    Localisation : France

    Informations professionnelles :
    Activité : Formateur en informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Novembre 2007
    Messages : 3 111
    Par défaut
    Bonjour,

    Essaie de décommenter la ligne suivante (à la fin de l'Opening function) :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    % uiwait(handles.figure1);
    Et rajoute cela à la fin de l'OutputFcn :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    uiresume(handles.figure1);
    Tu devrais réussir à avoir quelquechose en sortie, après à toi de mettre ce que tu veux...

    Bon courage,
    Duf

  5. #5
    Membre averti
    Inscrit en
    Novembre 2008
    Messages
    19
    Détails du profil
    Informations forums :
    Inscription : Novembre 2008
    Messages : 19
    Par défaut
    oké merci de vos conseil...

    Ceci dit ma question etait plutot genre est ce que j'utilise correctement les varargout ?
    et sinon comment les utilises t ont?

  6. #6
    Membre averti
    Inscrit en
    Novembre 2008
    Messages
    19
    Détails du profil
    Informations forums :
    Inscription : Novembre 2008
    Messages : 19
    Par défaut
    Bon j ai compris ce qui n allais pas :

    ma structure handles était remis a 0 par la fonction gui_mainfct

    j ai corrigé cela en mettant
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    handles=guidata(gco(choix));
    avant les varargout mais maintenant c est pire ....voila l erreur rencontré

    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
    ??? Index exceeds matrix dimensions.
     
    Error in ==> C:\Documents and Settings\...\Choix.m (Choix_OpeningFcn)
    On line 57  ==> varargin{1}
     
    Error in ==> C:\MATLAB6p5\toolbox\matlab\uitools\gui_mainfcn.m
    On line 141  ==>     feval(gui_State.gui_OpeningFcn, gui_hFigure, [], guidata(gui_hFigure), varargin{:});
     
    Error in ==> C:\Documents and Settings\...\Choix.m
    On line 40  ==>     [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
     
    Error in ==> C:\Documents and Settings\...\Choix.m (Choix_OutputFcn)
    On line 85  ==> handles=guidata(gco(choix));
     
    Error in ==> C:\MATLAB6p5\toolbox\matlab\uitools\gui_mainfcn.m
    On line 172  ==>         [varargout{1:nargout}] = feval(gui_State.gui_OutputFcn, gui_hFigure, [], gui_Handles);
     
    Error in ==> C:\Documents and Settings\...\Choix.m
    On line 40  ==>     [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
     
    Error in ==> C:\Documents and Settings\...\MainP.M
    On line 26  ==> [lastFrameNumber,firstFrameNumber,oeil]=choix(firstFrameNum,lastFrameNum);
     
    Error in ==> C:\Documents and Settings\...\IntUI.m (pushbutton2_Callback)
    On line 329  ==> [ImListL,CenterListL,FramList,SPL,DPL,SP_BL,DP_BL,ImListR,CenterListR,SPR,DPR,SP_BR,DP_BR,ImFul,CoordLeft,CoordRight]=eyeTrackerMainP(handles.firstTemp,handles.lastTemp,handles.pathImTemp,handles.ext
    Error in ==> C:\MATLAB6p5\toolbox\matlab\uitools\gui_mainfcn.m
    On line 66  ==>         feval(varargin{:});
     
    Error in ==> C:\Documents and Settings\...\IntUI.m
    On line 42  ==>     gui_mainfcn(gui_State, varargin{:});
     
    ??? Error while evaluating uicontrol Callback.
    Quelqu'un sait il me venir en aide ... ??

  7. #7
    Expert confirmé
    Avatar de Caro-Line
    Profil pro
    Inscrit en
    Mars 2007
    Messages
    9 458
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2007
    Messages : 9 458
    Par défaut
    Euh...
    Ce bout de code est faux.
    Il va d'bord réappeler ta fonction choix puis...en fait s'arrêter là parce qu'il ne doit pas aimer l'appel récursif.
    Que voulais-tu faire exactement avec cette ligne ?

    Essayes plutôt :Et encore je ne suis pas sure que ça marche.

  8. #8
    Membre averti
    Inscrit en
    Novembre 2008
    Messages
    19
    Détails du profil
    Informations forums :
    Inscription : Novembre 2008
    Messages : 19
    Par défaut
    c'est bon j'ai trouvé d'ou venais mon problème

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    close(handles.figure1);
    ça détruit le Handles et donc ça plantait

Discussions similaires

  1. créer un noeuds avec des paramétres
    Par Toxine77 dans le forum XMLRAD
    Réponses: 5
    Dernier message: 21/01/2003, 16h11
  2. [xmlrad] Pb de paramètre ?
    Par Pm dans le forum XMLRAD
    Réponses: 7
    Dernier message: 07/01/2003, 14h37
  3. [SWT] Problème de paramètre GridData
    Par yolepro dans le forum SWT/JFace
    Réponses: 4
    Dernier message: 06/12/2002, 10h37
  4. passage en paramètre d'un array dynamique 2D
    Par Guigui_ dans le forum Langage
    Réponses: 4
    Dernier message: 27/11/2002, 19h47
  5. Paramètre requete SQL (ADOQuery)
    Par GaL dans le forum C++Builder
    Réponses: 3
    Dernier message: 30/07/2002, 11h24

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo