Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Nebula » Grid - DefaultCellRenderer
Grid - DefaultCellRenderer [message #570820] Fri, 01 December 2006 10:33
Naren is currently offline Naren
Messages: 8
Registered: July 2009
Junior Member
Chris,

I noticed this code from defaultcellrenderer while I was trying to do
custom cell renderer, looks like a mistake to me

method -- paint -- notice the cellfocus section -- why 2 ifs

if (isCellFocus) {
.........
}
else if (isCellFocus) {
.................
}

Anyways, my objective is to decrease the cell ht , when the shell ht is
decreased, iam trying to decrease the font ht when the shell ht is
decreased.

Thanks

Naren


-------------------------------------------
public void paint(GC gc, Object value) {

.............

if (isCellFocus())
{
Rectangle focusRect = new Rectangle(getBounds().x -1,
getBounds().y - 1, getBounds().width,
getBounds().height + 1);


gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_LIST_ FOREGROUND));
gc.drawRectangle(focusRect);

if (isFocus())
{
focusRect.x ++;
focusRect.width -= 2;
focusRect.y ++;
focusRect.height -= 2;

gc.drawRectangle(focusRect);

}
}
else if (isCellFocus())
{
Rectangle focusRect = new Rectangle(getBounds().x -1,
getBounds().y - 1, getBounds().width,
getBounds().height + 1);


gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_WIDGE T_DARK_SHADOW));

gc.drawLine(focusRect.x,focusRect.y,focusRect.x +
focusRect.width,focusRect.y);
gc.drawLine(focusRect.x,focusRect.y +
focusRect.height,focusRect.x + focusRect.width,focusRect.y +
focusRect.height);
gc.drawLine(focusRect.x,focusRect.y,focusRect.x,focusRect.y +
focusRect.height);
gc.drawLine(focusRect.x +
focusRect.width,focusRect.y,focusRect.x + focusRect.width,focusRect.y +
focusRect.height);

if (isFocus())
{
gc.drawLine(focusRect.x,focusRect.y + 1,focusRect.x +
focusRect.width,focusRect.y + 1);
gc.drawLine(focusRect.x,focusRect.y + focusRect.height
-1,focusRect.x + focusRect.width,focusRect.y + focusRect.height -1);
gc.drawLine(focusRect.x + 1,focusRect.y,focusRect.x +
1,focusRect.y + focusRect.height);
gc.drawLine(focusRect.x + focusRect.width
-1,focusRect.y,focusRect.x + focusRect.width -1,focusRect.y +
focusRect.height);
}
}


}
Previous Topic:How to use individual widgets
Next Topic:Grid - DefaultCellRenderer
Goto Forum:
  


Current Time: Mon Apr 21 05:53:20 EDT 2014

Powered by FUDForum. Page generated in 0.14168 seconds