Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Images in Tables (SWT.Check)
Images in Tables (SWT.Check) [message #449454] Mon, 24 January 2005 18:41 Go to next message
Eclipse UserFriend
Originally posted by: shmoeaz.yahoo.com

I know that there have been discussions on images in tables in previous
threads. However, I was experimenting with a 'Row Height' hack and found
some interesting behavior that seems like a bug to me.

I develop on Linux and test on Windows. The problems below are on the
Windows platform. I do not see the problem on a Linux platform. (I'm using
Eclipse 3.0.1)

In another thread, a 'hack' was discussed for adjusting the row height in
a Table widget by placing an image in the table. I placed a 1x50 image in
the first cell of a table and it seem to work. When I placed that 1x50
image in a Table with the SWT.Check style bit set, the check box for each
row became a 1px dot (this was the same wether it was the first cell or
last cell). I then tried a 50x50 image and the check box looked normal. So
with this I started to experiment with different size images and found
that the checkbox started to shrink in size somewhere around a 20px-25px
image and progressively gets smaller until a 1px image causes a 1px
checkbox.

I then reversed and started to make the image wider and found that the
wider images affect the indentation of the checkbox. So if my column is
packed it first appears like it didn't paint the check box, but in reality
it did and you have to widen the column.

This does not seem like correct behavior. Can anyone explain, why on
windows my image size would affect the checkbox control? If this is
something new and unexplained, I'll be glade to post a bug.

shmoe

P.S. - below I've posted my test code.
<< code begin >>
public class SWTTableBugTest {


public static void main(String[] args) {

Display display = new Display ();
Shell shell = new Shell (display);
Table table = new Table (shell, SWT.CHECK | SWT.BORDER | SWT.V_SCROLL
| SWT.H_SCROLL);
table.setLinesVisible(true);
table.setHeaderVisible(true);
String[] titles = {"check", "text", "image"};
for (int i = 0; i < titles.length; i++) {
TableColumn column = new TableColumn(table, SWT.NONE);
column.setText(titles[i]);
column.pack();
};

Image img = new Image(display, "images/blank_100x50.gif");
// Image img = new Image(display, "images/blank_10x50.gif");
// Image img = new Image(display, "images/blank_15x50.gif");
// Image img = new Image(display, "images/blank_20x50.gif");
// Image img = new Image(display, "images/blank_25x50.gif");
// Image img = new Image(display, "images/blank_30x50.gif");
// Image img = new Image(display, "images/blank_35x50.gif");
// Image img = new Image(display, "images/blank_40x50.gif");
// Image img = new Image(display, "images/blank_50x50.gif");
// Image img = new Image(display, "images/blank_60x50.gif");

for (int i=0; i<12; i++) {
TableItem item = new TableItem (table, SWT.NONE);
TableEditor editor = new TableEditor(table);
Text text = new Text(table, SWT.NONE);
text.setText("Item "+ i);
editor.grabHorizontal = true;
editor.setEditor(text, item, 1);
item.setText (1, "Item " + i);
item.setImage(2,img);
}
table.setSize (300, 500);
table.addListener (SWT.Selection, new Listener () {
public void handleEvent (Event event) {
String string = event.detail == SWT.CHECK ? "Checked" : "Selected";
System.out.println (event.item + " " + string);
}
});
shell.setSize (350, 550);
shell.open ();
while (!shell.isDisposed()) {
if (!display.readAndDispatch ()) display.sleep ();
}
display.dispose ();
}
}
<< code end >>
Re: Images in Tables (SWT.Check) [message #449493 is a reply to message #449454] Tue, 25 January 2005 14:11 Go to previous message
Grant Gayed is currently offline Grant GayedFriend
Messages: 2150
Registered: July 2009
Senior Member
This seems like a bug, so I've logged
https://bugs.eclipse.org/bugs/show_bug.cgi?id=83608 . I tried to add you as
a CC but Bugzilla did not know of your email address.

Note that I reduced your description+snippet to a simplified case in order
to make investigation easier. If you think that there are issues which the
report does not cover then please either annotate this report or log
additional similar bug reports with Platform - SWT, thanks.

Grant

"shmoe" <shmoeaz@yahoo.com> wrote in message
news:ct3fgk$718$1@www.eclipse.org...
> I know that there have been discussions on images in tables in previous
> threads. However, I was experimenting with a 'Row Height' hack and found
> some interesting behavior that seems like a bug to me.
>
> I develop on Linux and test on Windows. The problems below are on the
> Windows platform. I do not see the problem on a Linux platform. (I'm using
> Eclipse 3.0.1)
>
> In another thread, a 'hack' was discussed for adjusting the row height in
> a Table widget by placing an image in the table. I placed a 1x50 image in
> the first cell of a table and it seem to work. When I placed that 1x50
> image in a Table with the SWT.Check style bit set, the check box for each
> row became a 1px dot (this was the same wether it was the first cell or
> last cell). I then tried a 50x50 image and the check box looked normal. So
> with this I started to experiment with different size images and found
> that the checkbox started to shrink in size somewhere around a 20px-25px
> image and progressively gets smaller until a 1px image causes a 1px
> checkbox.
>
> I then reversed and started to make the image wider and found that the
> wider images affect the indentation of the checkbox. So if my column is
> packed it first appears like it didn't paint the check box, but in reality
> it did and you have to widen the column.
>
> This does not seem like correct behavior. Can anyone explain, why on
> windows my image size would affect the checkbox control? If this is
> something new and unexplained, I'll be glade to post a bug.
>
> shmoe
>
> P.S. - below I've posted my test code.
> << code begin >>
> public class SWTTableBugTest {
>
>
> public static void main(String[] args) {
>
> Display display = new Display ();
> Shell shell = new Shell (display);
> Table table = new Table (shell, SWT.CHECK | SWT.BORDER | SWT.V_SCROLL
> | SWT.H_SCROLL);
> table.setLinesVisible(true);
> table.setHeaderVisible(true);
> String[] titles = {"check", "text", "image"};
> for (int i = 0; i < titles.length; i++) {
> TableColumn column = new TableColumn(table, SWT.NONE);
> column.setText(titles[i]);
> column.pack();
> };
>
> Image img = new Image(display, "images/blank_100x50.gif");
> // Image img = new Image(display, "images/blank_10x50.gif");
> // Image img = new Image(display, "images/blank_15x50.gif");
> // Image img = new Image(display, "images/blank_20x50.gif");
> // Image img = new Image(display, "images/blank_25x50.gif");
> // Image img = new Image(display, "images/blank_30x50.gif");
> // Image img = new Image(display, "images/blank_35x50.gif");
> // Image img = new Image(display, "images/blank_40x50.gif");
> // Image img = new Image(display, "images/blank_50x50.gif");
> // Image img = new Image(display, "images/blank_60x50.gif");
>
> for (int i=0; i<12; i++) {
> TableItem item = new TableItem (table, SWT.NONE);
> TableEditor editor = new TableEditor(table);
> Text text = new Text(table, SWT.NONE);
> text.setText("Item "+ i);
> editor.grabHorizontal = true;
> editor.setEditor(text, item, 1);
> item.setText (1, "Item " + i);
> item.setImage(2,img);
> }
> table.setSize (300, 500);
> table.addListener (SWT.Selection, new Listener () {
> public void handleEvent (Event event) {
> String string = event.detail == SWT.CHECK ? "Checked" : "Selected";
> System.out.println (event.item + " " + string);
> }
> });
> shell.setSize (350, 550);
> shell.open ();
> while (!shell.isDisposed()) {
> if (!display.readAndDispatch ()) display.sleep ();
> }
> display.dispose ();
> }
> }
> << code end >>
>
>
Previous Topic:SWT Font and AWT Font shows different size
Next Topic:button event delay
Goto Forum:
  


Current Time: Wed Nov 13 01:55:04 GMT 2019

Powered by FUDForum. Page generated in 0.04378 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top