01-20-2010 06:15 AM - edited 01-20-2010 06:18 AM
Hi,
i use a TreeField to display my items. In the treefieldcallback i do the painting stuff, but the treefield is acting really strange.
Heres the TreeFieldCallback Code:
public void drawTreeItem(TreeField treeField, Graphics graphics, int node,
int y, int width, int indent) {
Task item = (Task) treeField.getCookie(node);
int tmp = graphics.getColor();
if (treeField.getCurrentNode() == node) {
graphics.setColor(Color.BLUE);
graphics.fillRect(0, y, Display.getWidth(), treeField.getRowHeight());
if (item.getType() == 0) {
if (treeField.getExpanded(node)) {
graphics.drawBitmap(3, y + 3, 15, 15, minus_icon, 0, 0);
} else {
graphics.drawBitmap(3, y + 3, 15, 15, plus_icon, 0, 0);
}
}
} else {
switch (item.getType()) {
case 1:
graphics.setColor(Color.BEIGE);
graphics.fillRect(0, y, Display.getWidth(), treeField.getRowHeight());
break;
case 0:
graphics.setColor(Color.ROSYBROWN);
graphics.fillRect(0, y, Display.getWidth(), treeField.getRowHeight());
if (treeField.getExpanded(node)) {
graphics.drawBitmap(3, y + 3, 15, 15, minus_icon, 0, 0);
} else {
graphics.drawBitmap(3, y + 3, 15, 15, plus_icon, 0, 0);
}
break;
default:
break;
}
}
graphics.setColor(tmp);
graphics.drawText(item.getTaskname(), indent, y);
}
Which leeds to the following screen:
As you can see, in the top screenshot, the whole item is focused with a blue background. In the second screen, only a part of the row gets highligthed with the blue color. Which is strange, because the blue rect is painted at the same line of code.
Seems like i cant draw more left then the indent of the row. Is there a way to override this an color the full row?
Regards,
Grinarn
02-16-2010 02:52 PM - edited 02-16-2010 03:29 PM
I have the same issue, does anyone know how to fix this?
EDIT:
I think it's due to the clipping rigions during the drawing, however i don't see a method anything in Graphics to expand the clipping region, only to reduce the size thereof.....any clues how to do that?
07-07-2010 12:45 PM
Would you please provide the Task class and its methods?
08-05-2010 06:59 AM
Hi Grinarn,
Can you share the Task Class, please?
08-10-2010 02:30 AM