![]()
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.
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
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);
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
Partager