Hi, I'm having difficulty kicking off the horizontal scrollbar for my treegrid. I've included bare-bones code down below, but basically I have a treegrid in a nesting layout inside of a tab layout. I have also included an expand tree button.
First I make the window small (small enough to cut off horizontal text), then I click on the expand button, and the vertical scrollbar automatically appears, but the horizontal bar does not (for me at least).
I've tried the commented out code right below, and I forgot the combinations, but sometimes I create a huge scrollbar vertically and/or horizontally for the whole layout. I would like the scrollbars to appear surrounding the treegrid and not include the expand button.
Please take a look when you have a chance. Sorry for messy coding!
First I make the window small (small enough to cut off horizontal text), then I click on the expand button, and the vertical scrollbar automatically appears, but the horizontal bar does not (for me at least).
I've tried the commented out code right below, and I forgot the combinations, but sometimes I create a huge scrollbar vertically and/or horizontally for the whole layout. I would like the scrollbars to appear surrounding the treegrid and not include the expand button.
Please take a look when you have a chance. Sorry for messy coding!
Code:
public void onModuleLoad() { final TabSet menuTabs = new TabSet(); menuTabs.setTabBarPosition(Side.TOP); menuTabs.setWidth100(); menuTabs.setHeight100(); // Test Tab ====================================================================== Tab builderTab = new Tab("Test"); HLayout mainLayout = new HLayout(); mainLayout.setWidth100(); mainLayout.setHeight100(); // Left Pane------------------------------------------------- // Assembling Tree final Tree testTree = new Tree(); testTree.setRoot(treeData); final TreeGrid treeGrid = new TreeGrid(); treeGrid.setData(testTree); treeGrid.setWidth("100%"); treeGrid.setHeight("100%"); treeGrid.setFields(new TreeGridField("Name", "100%")); // treeGrid.setOverflow(Overflow.AUTO); // this doesn't appear to do anything extra // treeGrid.setAutoFitData(Autofit.BOTH); // this makes a huge scrollbar to the right and scrolls button // treeGrid.setAutoFitData(Autofit.HORIZONTAL); // this doesn't appear to do anything extra // treeGrid.setAutoFitData(Autofit.VERTICAL); // this makes a huge scrollbar to the right and scrolls button Label testTreePane = new Label(); testTreePane.setWidth("50%"); testTreePane.setHeight("100%"); // expand button final IButton expandButton = new IButton("Expand"); expandButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { treeGrid.getTree().openAll(); treeGrid.redraw(); } }); // End left pane --------------------------------------------- // Right Pane --------------------------------------------- // Top Pane VStack verticalLayout = new VStack(); verticalLayout.setWidth("50%"); Label rightTopPane = new Label(); rightTopPane.setHeight("50%"); rightTopPane.setContents("other stuff goes in here"); rightTopPane.setBorder("1px solid #000000"); // Bottom Pane final Label rightBottomPane = new Label(); rightBottomPane.setHeight("50%"); rightBottomPane.setBorder("1px solid #000000"); rightBottomPane.setContents("and here"); // End right pane ------------------------------------------ // Assemble layout --------------------------------------------- HLayout treeButtonsLayout = new HLayout(); treeButtonsLayout.addMember(expandButton); VLayout leftPaneLayout = new VLayout(); leftPaneLayout.setWidth("100%"); leftPaneLayout.setHeight("100%"); leftPaneLayout.addMember(treeGrid); leftPaneLayout.addMember(treeButtonsLayout); testTreePane.addChild(leftPaneLayout); mainLayout.addMember(testTreePane); verticalLayout.addMember(rightTopPane); verticalLayout.addMember(rightBottomPane); mainLayout.addMember(verticalLayout); builderTab.setPane(mainLayout); menuTabs.addTab(builderTab); menuTabs.draw(); } public static class PartsTreeNode extends TreeNode { public PartsTreeNode(String name, String icon) { this(name, icon, new PartsTreeNode[] {}); } public PartsTreeNode(String name, PartsTreeNode... children) { this(name, null, children); } public PartsTreeNode(String name, String icon, PartsTreeNode... children) { setAttribute("Name", name); setAttribute("children", children); if (icon != null) setAttribute("icon", icon); } } PartsTreeNode treeData = new PartsTreeNode("Root", new PartsTreeNode("Welcome message ima cranky old yank in a clanky old tank in the streets of yokohama with mmy honolulu mama singing seato seato flat on my feato hirohito blues"), new PartsTreeNode("Choice A", new PartsTreeNode("What type of sandwich would you like?", new PartsTreeNode("Are you a good witch or a bad witch? "), new PartsTreeNode("Choice A", new PartsTreeNode("What type of sandwich would you like?", new PartsTreeNode("Are you a good witch or a bad witch? This is the song that never ends. Yes it goes on and on my friends. Some people started singing it not knowing what it was...")), new PartsTreeNode("Choice A", new PartsTreeNode("What type of sandwich would you like?", new PartsTreeNode("Are you a good witch or a bad witch? ")), new PartsTreeNode("Choice A", new PartsTreeNode("What type of sandwich would you like?", new PartsTreeNode("Are you a good witch or a bad witch? ")), new PartsTreeNode("Choice A", new PartsTreeNode("What type of sandwich would you like?", new PartsTreeNode("Are you a good witch or a bad witch? ")), new PartsTreeNode("Choice A", new PartsTreeNode("What type of sandwich would you like?", new PartsTreeNode("Are you a good witch or a bad witch? ")), new PartsTreeNode("Choice A", new PartsTreeNode("What type of sandwich would you like?", new PartsTreeNode("Are you a good witch or a bad witch? ")), new PartsTreeNode("Choice A", new PartsTreeNode("What type of sandwich would you like?", new PartsTreeNode("Are you a good witch or a bad witch? ")), new PartsTreeNode("Choice A", new PartsTreeNode("What type of sandwich would you like?", new PartsTreeNode("Are you a good witch or a bad witch? ")), new PartsTreeNode("Choice A", new PartsTreeNode("What type of sandwich would you like?", new PartsTreeNode("Are you a good witch or a bad witch? ")) ))))))))))));
Comment