}]]>2006-12-01T15:33:22-00:00Re: Grid - DefaultCellRenderer
https://www.eclipse.org/forums/index.php/mv/msg/6300/18962/#msg_18962
different. isCellFocus returns whether the cell is the focused cell
within the grid. isFocus returns whether the grid is the focused widget.
As to what you're trying to do, thats currently not possible. The row
height is determined by the cell renderer, but it is only done once when
the first row is created. You cannot dynamically change the row height.
You can add a bugzilla issue for that feature if its important to you.
Regards,
-Chris
Naren wrote:
> 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);
> }
> }
>
>
> }
>]]>Chris Gross2006-12-01T16:27:24-00:00Re: Grid - DefaultCellRenderer
https://www.eclipse.org/forums/index.php/mv/msg/6300/570867/#msg_570867
different. isCellFocus returns whether the cell is the focused cell
within the grid. isFocus returns whether the grid is the focused widget.
As to what you're trying to do, thats currently not possible. The row
height is determined by the cell renderer, but it is only done once when
the first row is created. You cannot dynamically change the row height.
You can add a bugzilla issue for that feature if its important to you.
Regards,
-Chris
Naren wrote:
> 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);
> }
> }
>
>
> }
>]]>Chris Gross2006-12-01T16:27:24-00:00Re: Grid - DefaultCellRenderer
https://www.eclipse.org/forums/index.php/mv/msg/6300/19027/#msg_19027
Originally posted by: x_naren.hotmail.com
I found that the hard way. computeRowHeight does that. only when first row
is created.
I tried the similar thing with SWT - Table, font ht works there except
that it does not many other features
we are looking for a
table with no scroll bars
customizable cells
different cell borders / colors
multiple colors in cells
multiple fonts in cells
resize table when the shell is resized
fixed columns widths
resize cell ht when shell is resized
I was able to do most of the requirements except resize Heights. Looks
like that I need to work towards a CUSTOM table.
Thanks
Naren
Chris Gross wrote:
> The two if's are different. Its isCellFocus and isFocus and they are
> different. isCellFocus returns whether the cell is the focused cell
> within the grid. isFocus returns whether the grid is the focused widget.
> As to what you're trying to do, thats currently not possible. The row
> height is determined by the cell renderer, but it is only done once when
> the first row is created. You cannot dynamically change the row height.
> You can add a bugzilla issue for that feature if its important to you.
> Regards,
> -Chris
> Naren wrote:
>> 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);
>> }
>> }
>>
>>
>> }
>>]]>2006-12-01T17:49:39-00:00Re: Grid - DefaultCellRenderer
https://www.eclipse.org/forums/index.php/mv/msg/6300/570997/#msg_570997
is created.
I tried the similar thing with SWT - Table, font ht works there except
that it does not many other features
we are looking for a
table with no scroll bars
customizable cells
different cell borders / colors
multiple colors in cells
multiple fonts in cells
resize table when the shell is resized
fixed columns widths
resize cell ht when shell is resized
I was able to do most of the requirements except resize Heights. Looks
like that I need to work towards a CUSTOM table.
Thanks
Naren
Chris Gross wrote:
> The two if's are different. Its isCellFocus and isFocus and they are
> different. isCellFocus returns whether the cell is the focused cell
> within the grid. isFocus returns whether the grid is the focused widget.
> As to what you're trying to do, thats currently not possible. The row
> height is determined by the cell renderer, but it is only done once when
> the first row is created. You cannot dynamically change the row height.
> You can add a bugzilla issue for that feature if its important to you.
> Regards,
> -Chris
> Naren wrote:
>> 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);
>> }
>> }
>>
>>
>> }
>>]]>Naren2006-12-01T17:49:39-00:00