Bonjour,

J'ai un dialog dans lequel j'ai plusieurs section.
Lorsque j'expand ou collapse ces sections j'aimerais retailler le dialog en conséquence. Mais j'y arrive pas...
Un problème du type de dialog que j'utilise ?
Dois-je implémenter qqchose ?

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
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
 
public class BranchRunnerDialog extends SelectionDialog{
 
	private Section sectionMain;
	private Section sectionBuild;
	private Section sectionArguments;
	private Section sectionEnvironment;
	private Section sectionRunner;
	private Section sectionRun;
 
	private int dialogHeightDefaut = 0;
	private int dialogWidthDefaut = 0;
 
	protected BranchRunnerDialog(Shell parentShell) {
		super(parentShell);
	}
 
 
	protected Control createDialogArea(Composite parent) {
 
		final Composite dialogArea = (Composite) super.createDialogArea(parent);
		dialogArea.addControlListener(new ControlAdapter() {
			public void controlResized(ControlEvent e) {
				Rectangle area = dialogArea.getClientArea();
	                        // ????
				}
			}
		});
 
		dialogArea.setLayout(new GridLayout(2,false));
 
		// test toolbar
		ToolBar toolbar = new ToolBar(dialogArea, SWT.VERTICAL|SWT.FLAT);
		toolbar.setSize(35, dialogArea.getSize().y);
		toolbar.setLocation(0, 0);
 
		//Image imageBtn1 = new Image(display, "btn1.bmp");
		ToolItem lButExpanded = new ToolItem(toolbar, SWT.PUSH);
		lButExpanded.setImage(expandImage.createImage());
		lButExpanded.addSelectionListener(new SelectionListener() {
			@Override
			public void widgetDefaultSelected(SelectionEvent e) {
			}
			@Override
			public void widgetSelected(SelectionEvent e) {
				//sectionMain.setExpanded(true);
				sectionArguments.setExpanded(true);
				sectionEnvironment.setExpanded(true);
				sectionRunner.setExpanded(true);
				sectionRun.setExpanded(true);
				sectionBuild.setExpanded(true);
				int IsArgExp = (sectionArguments.isExpanded()? 110:0);
				int IsEnvExp = (sectionEnvironment.isExpanded()? 150:0);
				int IsRunExp = (sectionRunner.isExpanded()? 210:0);
				dialogHeightResize = dialogHeightDefaut + 80 + IsArgExp + IsEnvExp + IsRunExp;
				dialogArea.notifyListeners(SWT.Resize, new Event());
			}
		});
 
		ToolItem lButCollapsed = new ToolItem(toolbar, SWT.PUSH);
		lButCollapsed.setImage(collapseImage.createImage());
		lButCollapsed.addSelectionListener(new SelectionListener() {
		@Override
		public void widgetDefaultSelected(SelectionEvent e) {
		}
		@Override
		public void widgetSelected(SelectionEvent e) {
			//sectionMain.setExpanded(false);
			sectionArguments.setExpanded(false);
			sectionEnvironment.setExpanded(false);
			sectionRunner.setExpanded(false);
			sectionBuild.setExpanded(false);
			sectionRun.setExpanded(false);
			dialogArea.notifyListeners(SWT.Resize, new Event());
		}
	});
 
 
		toolkit = new FormToolkit(parent.getDisplay());
 
/* 1ere section : MAIN */		
		sectionMain = toolkit.createSection(dialogArea,Section.TITLE_BAR|Section.TWISTIE|Section.EXPANDED);
		// TODO à recup
		sectionMain.addExpansionListener(new ExpansionAdapter() {
			public void expansionStateChanged(ExpansionEvent e) {
				sectionMain.setExpanded(true);
			}});
		sectionMain.setText("Main");
		sectionMain.marginWidth = 10;
		sectionMain.marginHeight = 5;
		sectionMain.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
		GridData data = new GridData(GridData.FILL_HORIZONTAL);
		sectionMain.setLayoutData(data);
.....
D'avance merci
chris