Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-swt-dev] Snippet77 simplification

The reason this must work in my situation (under win2k) is because I
am not using horizontal scrolling, in which case I don't get any
flashing artifacts even when resizing horizontally.
Typically the only adjustment would be a user increasing the window
size to see more information vertically, rather then having to scroll
horizontally to see further cell data.

Thanks for the heads up,
Benjamin

-- 
/*  http://www.benjaminranck.com */

The reason the listener is added to the parent of the table and not to the 
table itself is because by the time the table Resize event is sent, the 
scrollbars for the table have already appeared.  You want to adjust the 
column widths before the table is resized to avoid the flash caused by 
scrollbars.  On some platforms where the scrollbars are always present 
(just disabled when not required) you will not see this flash.

Here is the bad scenario we wish to avoid:

Shell is made smaller causing the parent composite to make the table 
smaller horizontally.
When the table is made smaller, before the resize callback is sent, the 
columns are too wide to fully display horizontally so a horizontal 
scrollbar appears.

With the code change you suggest, on Windows XP, I see the horizontal 
scrollbar appearing and disappearing like crazy as I resize the shell 
horizontally.





Benjamin Ranck <benjaminranck@xxxxxxxxx> 
Sent by: platform-swt-dev-bounces@xxxxxxxxxxx
08/09/2005 02:18 PM
Please respond to
"Eclipse Platform SWT component developers list."


To
platform-swt-dev@xxxxxxxxxxx
cc

Subject
[platform-swt-dev] Snippet77 simplification






I've been playing around with tables and I have found a much simpler
way to get the same effect as Snippet77, instead of adding to the
composite I added the listener directly to the table:

                                 table.addControlListener(new 
ControlAdapter() {
                                                 public void 
controlResized(ControlEvent e) {
                                                                 Rectangle 
area = table.getClientArea();
 column1.setWidth(area.width / 2 - 2*table.getBorderWidth());
 column2.setWidth(area.width / 2 - 2*table.getBorderWidth());
                                                 }
                                 });

seems to work automatically with or without the scroll bar.

Cheers,
Benjamin

-- 
/*  http://www.benjaminranck.com */
_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/platform-swt-dev


Back to the top