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 :

[msgbox] Apparition d'un msgbox en premier plan à l'ouverture d'une fenêtre.


Sujet :

Interfaces Graphiques

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Modérateur

    Homme Profil pro
    Ingénieur R&D
    Inscrit en
    Août 2014
    Messages
    1 295
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 34
    Localisation : France, Nord (Nord Pas de Calais)

    Informations professionnelles :
    Activité : Ingénieur R&D
    Secteur : High Tech - Électronique et micro-électronique

    Informations forums :
    Inscription : Août 2014
    Messages : 1 295
    Par défaut [msgbox] Apparition d'un msgbox en premier plan à l'ouverture d'une fenêtre.


    J'ai créé un programme associé à son IHM qui me permet de faire tout un tas de trucs qui ici n'ont pas d'importance. Certaines fenêtres de mon programme ne doivent pas être utilisables tant que certaines conditions n'ont pas été remplies. J'ai donc une structure handles.global.verif qui contient ces variables de vérification. A l'ouverture de chaque fenêtre de mon IHM, je vérifie le contenu de certaines de ces variables de vérification, et si une condition n'est pas remplie, j'affiche un message d'erreur/warning via une msgbox afin d'informer l'utilisateur de la raison de son incapacité à utiliser la fenêtre.

    Voici pour l'introduction, maintenant le problème. Lorsque j'affiche cette msgbox dans l'opening de ma fenêtre, elle a tendance à s'ouvrir en arrière plan. J'avais cru (à tort a priori) que l'utilisation d'un axes(handles.graph_01) avait résolu le problème. Donc en gros, sur certaines de mes fenêtres, la msgbox s'ouvre bien en premier plan, sur d'autres fenêtres non. J'aimerai comprendre pourquoi, et j'aimerai que la msgbox s'affiche toujours en premier plan. Petite info: toutes mes fenêtres sont composées d'axes.

    Je vous montre deux début de script différent, qui dans le premier cas ouvre la msgbox en premier plan, dans un second cas en arrière plan. (Vous constaterez que ces scripts sont très similaires, ce qui est très déroutant, car ils ne se comportent pas de la même façon...)

    Premier cas: la msgbox s'ouvre en premier plan.

    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
    function modelisation_extrinsic_inductor_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 modelisation_extrinsic_inductor (see VARARGIN)
     
    handles.global = varargin{1};
    set(gcf, 'Name', handles.global.nom_fenetre.extrinsic_inductor);
    modelisation_creation_menu('modelisation_extrinsic_inductor', handles.global.nom_fenetre.extrinsic_inductor, handles.global.nom_fenetre);
     
    handles.local.menu_graph = creation_menu_graph(hObject, handles);
    axes(handles.graph_Ls);
     
    %%% Initialisation des graph %%%
    set(handles.graph_Ls.Title,'String','Ls determination');
    set(handles.graph_Ls.XLabel,'String','Frequency² (GHz²)');
    set(handles.graph_Ls.YLabel,'String','Ls (pH²)');
    handles.graph_Ls.Box = 'On';
    handles.graph_Ls.XGrid = 'On';
    handles.graph_Ls.YGrid = 'On';
     
    set(handles.graph_Lg.Title,'String','Lg determination');
    set(handles.graph_Lg.XLabel,'String','Frequency² (GHz²)');
    set(handles.graph_Lg.YLabel,'String','Lg (pH²)');
    handles.graph_Lg.Box = 'On';
    handles.graph_Lg.XGrid = 'On';
    handles.graph_Lg.YGrid = 'On';
     
    set(handles.graph_Ld.Title,'String','Ld determination');
    set(handles.graph_Ld.XLabel,'String','Frequency² (GHz²)');
    set(handles.graph_Ld.YLabel,'String','Ld (pH²)');
    handles.graph_Ld.Box = 'On';
    handles.graph_Ld.XGrid = 'On';
    handles.graph_Ld.YGrid = 'On';
     
    handles.local.verif_affichage = 0;
    handles.affichage = [];
     
    handles.local.valeurs.Ls = [];
    handles.local.valeurs.Lg = [];
    handles.local.valeurs.Ld = [];
     
    handles.affichage.freq = [];
    handles.affichage.Ls = [];
    handles.affichage.Lg = [];
    handles.affichage.Ld = [];
     
    handles.local.valeurs.mini_Ls = [];
    handles.local.valeurs.maxi_Ls = [];
     
    handles.local.valeurs.mini_Lg = [];
    handles.local.valeurs.maxi_Lg = [];
     
    handles.local.valeurs.mini_Ld = [];
    handles.local.valeurs.maxi_Ld = [];
     
    handles.local.optimized(1) = 1;
    handles.local.optimized(2) = 1;
    handles.local.optimized(3) = 1;
     
    %%% Initialisation des variables %%%
    handles.local.affichage_listbox = [];
     
     
    %%% Initialisation du popup température %%%
    if handles.global.verif.import == 1
    % peu importe, car c'est le cas handles.global.verif.import = 0 qui me pose problème
     
    else
        rendre_panel_operationnel(handles,1,0);
        msgbox('You need to fill the basic parameters to continue the modelisation','Error','error', 'modal');
    end
     
     
    % Choose default command line output for modelisation_extrinsic_inductor
    handles.output = hObject;
     
    % Update handles structure
    guidata(hObject, handles);
    Deuxième cas, la msgbox s'ouvre en arrière plan:

    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
    function modelisation_extrinsic_capacity_determination_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 modelisation_extrinsic_capacity_determination (see VARARGIN)
     
    handles.global = varargin{1};
    set(gcf, 'Name', handles.global.nom_fenetre.extrinsic_capacity);
    modelisation_creation_menu('modelisation_extrinsic_capacity_determination', handles.global.nom_fenetre.extrinsic_capacity, handles.global.nom_fenetre);
     
    handles.local.menu_graph = creation_menu_graph(hObject, handles);
    axes(handles.graph_Cb);
     
    %%% Initialisation des graph %%%
    set(handles.graph_Cb.Title,'String','Cb determination');
    set(handles.graph_Cb.XLabel,'String','Frequency (GHz)');
    set(handles.graph_Cb.YLabel,'String','Cb (fF)');
    handles.graph_Cb.Box = 'On';
    handles.graph_Cb.XGrid = 'On';
    handles.graph_Cb.YGrid = 'On';
     
    set(handles.graph_Cpg.Title,'String','Cpg determination');
    set(handles.graph_Cpg.XLabel,'String','Frequency (GHz)');
    set(handles.graph_Cpg.YLabel,'String','Cpg (fF)');
    handles.graph_Cpg.Box = 'On';
    handles.graph_Cpg.XGrid = 'On';
    handles.graph_Cpg.YGrid = 'On';
     
    set(handles.graph_Cpd.Title,'String','Cpd + Cds determination');
    set(handles.graph_Cpd.XLabel,'String','Frequency (GHz)');
    set(handles.graph_Cpd.YLabel,'String','Cpd+Cds (fF)');
    handles.graph_Cpd.Box = 'On';
    handles.graph_Cpd.XGrid = 'On';
    handles.graph_Cpd.YGrid = 'On';
     
    handles.local.verif_affichage = 0;
    handles.affichage = [];
     
    handles.local.valeurs.Cb = [];
    handles.local.valeurs.Cpg = [];
    handles.local.valeurs.Cpd = [];
     
    handles.affichage.freq = [];
    handles.affichage.Cb = [];
    handles.affichage.Cpg = [];
    handles.affichage.Cpd = [];
     
    handles.local.current_temp = 1;
     
    %%% Initialisation des variables %%%
    handles.local.affichage_listbox = [];
     
     
    %%% Initialisation du popup température %%%
    if handles.global.verif.import == 1
    %peu importe car seul el cas handles.global.verif.import = 0 nous intéresse ici
     
    else
        rendre_panel_operationnel(handles,1,0);
        msgbox('You need to fill the basic parameters to continue the modelisation','Error','error');
    end
     
    % Choose default command line output for modelisation_extrinsic_capacity_determination
    handles.output = hObject;
     
    % Update handles structure
    guidata(hObject, handles);

    Si il vous manque des informations pour répondre à ma question, n'hésitez pas! Je n'ai pas décris les sous fonctions utilisées dans ces deux scripts, mais si ça s'avère nécessaire à la compréhension du phénomène, je suis disposé à vous les transmettre.

    Merci

  2. #2
    Membre émérite
    Avatar de soft001
    Homme Profil pro
    Ingénieur R&D
    Inscrit en
    Avril 2008
    Messages
    409
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 41
    Localisation : France, Savoie (Rhône Alpes)

    Informations professionnelles :
    Activité : Ingénieur R&D
    Secteur : Industrie

    Informations forums :
    Inscription : Avril 2008
    Messages : 409
    Par défaut
    sans regarder ton code, je te propose de créer un handle à ton msgbox et à la fin de ton code tu peux ajouter ça :

  3. #3
    Modérateur

    Homme Profil pro
    Ingénieur R&D
    Inscrit en
    Août 2014
    Messages
    1 295
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 34
    Localisation : France, Nord (Nord Pas de Calais)

    Informations professionnelles :
    Activité : Ingénieur R&D
    Secteur : High Tech - Électronique et micro-électronique

    Informations forums :
    Inscription : Août 2014
    Messages : 1 295
    Par défaut
    N'est stupide que la stupidité chef !
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    msgbox('You need to fill the basic parameters to continue the modelisation','Error','error', 'modal');
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    msgbox('You need to fill the basic parameters to continue the modelisation','Error','error');
    Je pense que j'ai trouvé j'avais oublié de mettre les modals, partout.

    Merci tout de même!

  4. #4
    Membre éclairé
    Homme Profil pro
    Stagiaire assistant ingénieur R&D
    Inscrit en
    Mai 2014
    Messages
    54
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 32
    Localisation : France, Drôme (Rhône Alpes)

    Informations professionnelles :
    Activité : Stagiaire assistant ingénieur R&D

    Informations forums :
    Inscription : Mai 2014
    Messages : 54
    Par défaut
    Pour mettre au premier plan un msgbox, il faut que tu enregistres ses propriétés et que tu utilises la fonction figure par la suite.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    h = msgbox('Bonjour');
    figure(h) %Pour mettre au premier plan

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Réponses: 1
    Dernier message: 02/03/2010, 23h54
  2. Griser l'arriere plan à l'ouverture d'une image
    Par kl_max dans le forum Balisage (X)HTML et validation W3C
    Réponses: 4
    Dernier message: 12/03/2009, 13h08
  3. Réponses: 4
    Dernier message: 18/08/2008, 09h45
  4. Afficher un msgbox au premier plan
    Par ceuce dans le forum VBA Access
    Réponses: 1
    Dernier message: 02/12/2007, 18h20
  5. MsgBox en premier plan ?
    Par oceanbigone dans le forum VBA Outlook
    Réponses: 3
    Dernier message: 05/10/2007, 15h38

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