[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [platform-swt-dev] Compound Widget computeSize() question
|
All,
No need to answer this question. The problem was that
in my Widget2 computeSize method I made a goofy rookie
did-you-just-learn-Java mistake. I use a the operator
=+ when I meant to use += right before I was to use
(returned) the value.
public Point computeSize(int wHint, int hHint,
boolean changed) {
checkWidget();
Point e = getTotalSize();
if (wHint != SWT.DEFAULT) {
e.x = wHint;
}
if (hHint != SWT.DEFAULT) {
e.y = hHint;
}
return e;
}
private Point getTotalSize() {
Point size = new Point(0, 0);
Rectangle ca = getClientArea();
size.x = ca.width;
Point titleSize =
title.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
size.y = titleSize.y;
if (content != null) {
Point contentSize =
content.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
if (!folded) {
if (drawBorder) {
// oops! size.y =+ contentSize.y +
1;
size.y += contentSize.y + 1;
} else {
// size.y =+ contentSize.y;
size.y += contentSize.y;
}
}
}
System.out.println("getTotalSize = " + size);
return size;
}
Thanks anyways,
Brian