Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-swt-dev] Problem with getting scrollbars to showup on a Table.

Title: Problem with getting scrollbars to showup on a Table.

Hi,

I am developing a new ViewPart which will needs to have three Group widgets. The first group widget will have a table. The second group will have a few buttons, the third group will have a List widget. I can get each of the groups to be displayed but I can't get the table or the list to show scroll bars. My table ends up being longer than the view window, so I need it to scroll.  I would like the table and list to scroll separately.

The source code is below for my ViewPart. Can anyone tell me what I need to do to get the scroll bars??

Thanks
Bob

public void createPartControl(Composite parent) {
                GridLayout gridLayout = new GridLayout ();
                gridLayout.numColumns = 3;
                parent.setLayout (gridLayout);

                createGroup1(parent);
                createGroup2(parent);
                createGroup3(parent);          
        }
       
        private void createGroup1(Composite parent) {
                GridData data;
                GridLayout layout;
               
                Group group = new Group(parent, SWT.NONE);
                group.setText("Page Format");
                data = new GridData();
                data.verticalSpan = 1;
                data.verticalAlignment = GridData.VERTICAL_ALIGN_FILL;
                group.setLayoutData(data);
                layout = new GridLayout();
                layout.numColumns = 1;
                group.setLayout(layout);
       


                Table table = new Table (group, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
                table.setLinesVisible (true);
                table.setSize(300,300);
               
                TCEClassItem item = tceModel.findClass("Assembly");
                tceModel.synchronizeClass(item);
                TCEClassItem dlog = tceModel.getDialogClass(item, "UpdateDialogC");
                Vector v = dlog.getAttributeNames();
                for(Iterator iterator = v.iterator(); iterator.hasNext();) {
                String str = (String)iterator.next();
                TableItem tableItem = new TableItem (table, SWT.NONE);
                        tableItem.setText (str);
                }
               
               

        }
       
        private void createGroup2(Composite parent) {
                GridData data;
                GridLayout layout;
               
                Composite composite = new Composite(parent, SWT.NONE);         
                RowLayout rowLayout = new RowLayout ();
                rowLayout.type = SWT.VERTICAL;
                composite.setLayout (rowLayout);

                Button button0 = new Button (composite, SWT.PUSH);
                button0.setImage(WebTierPlugin.getImageDescriptor("uparrow.gif").createImage());

                Button button1 = new Button (composite, SWT.PUSH);
                button1.setImage(WebTierPlugin.getImageDescriptor("downarrow.gif").createImage());
               
                /* spacer */
                Label label = new Label(composite, SWT.NONE);
                label.setText("");

                Button button2 = new Button (composite, SWT.PUSH);
                button2.setImage(WebTierPlugin.getImageDescriptor("leftarrow.gif").createImage());
               
                Button button3 = new Button (composite, SWT.PUSH);
                button3.setImage(WebTierPlugin.getImageDescriptor("rightarrow.gif").createImage());

        }
       
        private void createGroup3(Composite parent) {
                GridData data;
                GridLayout layout;
               
                Group group = new Group(parent, SWT.NONE);
                group.setText("Attribute Pick List");
                data = new GridData();
                data.verticalSpan = 1;
                data.verticalAlignment = GridData.VERTICAL_ALIGN_FILL;
                group.setLayoutData(data);
                layout = new GridLayout();
                layout.numColumns = 1;
                group.setLayout(layout);
       

                ListViewer listViewer = new ListViewer(group, SWT.FULL_SELECTION | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);

                listViewer.setContentProvider(new ViewContentProvider());
                listViewer.setLabelProvider(new ViewLabelProvider());
                listViewer.setInput(viewerData);
        }


Back to the top