When openening the drop down window of the
DatePickerCombo the size is not correctly calculated. It is
either to short (at the begining) or to large (with a green
background after a few selections).
I have the same problem. When I resize the window some times
then the DatePlane becomes higher and higher after each
resize. Could perhaps the author give me a hint where to
look for the problem in the source code.
Thanks
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
int max = cal_.getActualMaximum(Calendar.DAY_OF_MONTH);
int factor = (firstDay == Calendar.SATURDAY && max == 31)
|| (firstDay == Calendar.SUNDAY && max >= 30) ? 8 : 7;
return new Point(colSize * 7, rowSize * factor);
}
CAUTION -- There is one open task:
The drop down menu of the combo box is not refreshed
correctly (but the size is correct).
The refresh should happen after each 'updateDate();' method
in the constructor of the DatePicker. (But because I'm new
to SWT I don't know at the moment how to refresh the drop
down menu. (layout() and pack() doesn't worked for me...)
- Daniel
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
First click
Logged In: YES
user_id=1126808
Hi!
I have the same problem. When I resize the window some times
then the DatePlane becomes higher and higher after each
resize. Could perhaps the author give me a hint where to
look for the problem in the source code.
Thanks
Logged In: YES
user_id=1126808
I made a small correction in DatePickerCombo.java, so it
works for me at the moment. In the internalLayout() function
I replaced the two lines
Point listSize = dp.computeSize(SWT.DEFAULT, itemHeight);
dp.setBounds(1, 1, Math.max(size.x - 2, listSize.x),
listSize.y);
by these one
Point listSize = dp.computeSize(SWT.DEFAULT, SWT.DEFAULT);
dp.setBounds(1, 1, Math.max(size.x - 2, listSize.x),
listSize.y+10);
Logged In: YES
user_id=1276492
To compute the size correctly just replace the
DatePicker#DatePanel.computeSize(int, int, boolean) method
with this one:
public Point computeSize(int wHint, int hHint, boolean
changed) {
Calendar cal_ = Calendar.getInstance();
cal_.set(cal.get(Calendar.YEAR),
cal.get(Calendar.MONTH), 1);
int firstDay = cal_.get(Calendar.DAY_OF_WEEK);
int max = cal_.getActualMaximum(Calendar.DAY_OF_MONTH);
int factor = (firstDay == Calendar.SATURDAY && max == 31)
|| (firstDay == Calendar.SUNDAY && max >= 30) ? 8 : 7;
return new Point(colSize * 7, rowSize * factor);
}
CAUTION -- There is one open task:
The drop down menu of the combo box is not refreshed
correctly (but the size is correct).
The refresh should happen after each 'updateDate();' method
in the constructor of the DatePicker. (But because I'm new
to SWT I don't know at the moment how to refresh the drop
down menu. (layout() and pack() doesn't worked for me...)
- Daniel
Logged In: NO
The solution is maybe in the computeSize of the Date Picker.
Replace :
int y = (pSize.y < (labelSize.y + 20) ? labelSize.y + 20 :
pSize.y);
By:
int y = pSize.y + labelSize.y + 20;