Bonsoir,
voila je développe une petite application en C++ .A lexecution j'ai cette affichage..
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
 
mourad@Mourad:~/ihm-test$ ./drawtri
Erreur de segmentation (core dumped)
voici mon programme:
mainframe.cpp
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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
#include <stdio.h>

#include <stdlib.h>

#include <fstream>


#include "mainframe.h"

#include "dialogs.h"






BEGIN_EVENT_TABLE(CMainFrame, wxFrame)
	
	EVT_MENU(MENU_NEW, CMainFrame::OnNew)

	EVT_MENU(MENU_OPEN, CMainFrame::OnOpen)

	EVT_MENU(MENU_QUIT, CMainFrame::OnQuit)

	EVT_MENU(MENU_TOOLBAR, CMainFrame::OnToolbar)

	EVT_MENU(MENU_THICKNESS, CMainFrame::OnThickness) 

	EVT_MENU(MENU_COLOR, CMainFrame::OnColor) 

	EVT_MENU(MENU_MANAGE, CMainFrame::OnManage) 

	EVT_MENU(MENU_RELEASE, CMainFrame::OnRelease) 

	EVT_MENU(MENU_HELP,CMainFrame::OnHelp)

END_EVENT_TABLE()



//Le constructeur

CMainFrame::CMainFrame(const wxString& title, const wxPoint& pos, const wxSize& size)

: wxFrame((wxFrame *)NULL, -1, title, pos, size) 

{

	

} 





//Création de la toolbar

void CMainFrame::CreateMyToolbar(){

	wxToolBar *m_toolbar=CreateToolBar(wxNO_BORDER|wxTB_HORIZONTAL,TOOLBAR_TOOLS);

	wxBitmap toolBarBitmaps[4] ;

	toolBarBitmaps[0] = wxBitmap("new.bmp",wxBITMAP_TYPE_BMP) ;

	toolBarBitmaps[1] = wxBitmap("open.bmp",wxBITMAP_TYPE_BMP) ;

	toolBarBitmaps[2] = wxBitmap("save.bmp",wxBITMAP_TYPE_BMP) ;

	toolBarBitmaps[3] = wxBitmap("draw.bmp",wxBITMAP_TYPE_BMP) ;

	m_toolbar->SetToolBitmapSize(wxSize(toolBarBitmaps[0].GetWidth(),toolBarBitmaps[0].GetHeight()));

	m_toolbar->AddTool(MENU_NEW,"Nouveau",toolBarBitmaps[0],"Créer un nouveau fichier");

	m_toolbar->AddTool(MENU_OPEN,"Ouvrir",toolBarBitmaps[1],"Ouvrir un fichier");

	m_toolbar->AddTool(MENU_SAVE,"Sauvegarder",toolBarBitmaps[2],"Sauvegarder le fichier");

	m_toolbar->AddSeparator();

	m_toolbar->AddCheckTool(MENU_DRAW,"Dessiner",toolBarBitmaps[3]);
	SetToolBar(m_toolbar) ;
	m_toolbar->Realize();

	
	



}



//Implémentation des fonctions liées aux événements


void CMainFrame::OnNew(wxCommandEvent& event) {

	

}

void CMainFrame::OnOpen(wxCommandEvent& event){

	}

void CMainFrame::OnQuit(wxCommandEvent& event)  {

	Close(TRUE);

}


void CMainFrame::CMainFrame::OnToolbar(wxCommandEvent& event)  {
	if(m_toolbar->IsShown())

		m_toolbar->Show(false);
		

	else

		m_toolbar->Show(true);
		

	

	

	

}

void CMainFrame::OnThickness(wxCommandEvent& event){

	ThicknessDialog tdlg(this, -1, "Epaisseur trait");

	tdlg.ShowModal();
	

}

void  CMainFrame::OnColor(wxCommandEvent& event){
	
	ColourDialog cdlg(this, -1, "Couleur");

	cdlg.ShowModal();
	
}

void  CMainFrame::OnManage(wxCommandEvent& event){

	

	ManageDialog mdlg(this, -1, "Gestion des triangles");

	mdlg.ShowModal();
	
}





void CMainFrame::OnRelease(wxCommandEvent& event) {

	VersionDialog vdlg(this, -1, "Version");

	vdlg.ShowModal();

}


void CMainFrame::OnHelp(wxCommandEvent& event){
	help.DisplayContents();	

}
mainframe.h

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
 
#ifndef __MAINFRAME_H__
 
#define __MAINFRAME_H__
#include <string.h>
 
#include <wx/html/helpctrl.h>
 
#include <wx/wx.h>
 
 
 
 
 
class CMainFrame: public wxFrame {
 
public:
 
 
 
	CMainFrame(const wxString& title, const wxPoint& pos, const wxSize& size);
	int epaisseurtraitcourante;
	wxColour couleurcourante;
 
	bool is_drawing;// indique si le bouton sur la toolBar est enfoncée ou non
 
 
 
 
	wxHtmlHelpController help;
	void CreateMyToolbar();
 
	//les fonctions auxiliaires
 
 
 
 
private:
 
	wxToolBar *m_toolbar;
	wxMenuBar *menu_bar ;
 
	DECLARE_EVENT_TABLE();
 
 
 
	// les fonctions liées aux événements
 
	void OnNew(wxCommandEvent& event); 
 
	void OnOpen(wxCommandEvent& event) ;
 
	void OnSave(wxCommandEvent& event) ;
 
	void OnQuit(wxCommandEvent& event) ;
 
	void OnToolbar(wxCommandEvent& event) ;
 
	void OnThickness(wxCommandEvent& event) ;
 
	void OnColor(wxCommandEvent& event) ;
 
	void OnManage(wxCommandEvent& event) ;
 
	void OnRelease(wxCommandEvent& event) ;
 
	void OnDraw(wxCommandEvent& event) ;
 
	void OnHelp(wxCommandEvent& event);
 
 
 
}; //MyFrame
 
 
 
 
 
 
 
 
 
 
 
// l'énumération des ID
 
enum{
 
	MENU_NEW=0,
 
	MENU_OPEN=1,
 
	MENU_SAVE=2,
 
	MENU_QUIT=3,
 
	MENU_THICKNESS=4,
 
	MENU_COLOR=5,
 
	MENU_MANAGE=6,
 
	MENU_RELEASE=7,
 
	MENU_TOOLBAR=8,
 
	TOOLBAR_TOOLS=9,
 
	MENU_HELP=10,
 
	MENU_DRAW=11
 
 };
 
 
 
#endif
Quand je fait un dbuggage, j'ai une erreur sur cette methode

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
 
 
void CMainFrame::CMainFrame::OnToolbar(wxCommandEvent& event)  {
	if(m_toolbar->IsShown())
 
		m_toolbar->Show(false);
 
 
	else
 
		m_toolbar->Show(true);
Cette methode me permet d'afficher ou de cacher une barre d'outil.
merci d'avance