java - Horizontal Scrollbar is not working under composite inside a CTabItem -


i have ctabitem inside which, there composite widget. then, have added few components inside it. code goes -

composite composite = new composite(tabfolder, swt.h_scroll);      tabitem.setcontrol(composite);       label lblname = new label(composite, swt.none);     lblname.setbounds(10, 28, 55, 15);     lblname.settext("name");      textname = new styledtext(composite, swt.border);     string mytext = tree.getselection()[0].gettext();     textname.settext(mytext);     point textnamesize = textname.computesize(swt.default, swt.default);     textname.setbounds(76, 28, textnamesize.x, 21);      label lblpath = new label(composite, swt.none);     lblpath.setbounds(10, 83, 55, 15);     lblpath.settext("path");      textpath = new styledtext(composite, swt.read_only);     textpath.setbackground(new color(d, 240, 240, 240));       button savebutton = new button(composite, swt.none);     savebutton.setbounds(456, 134, 75, 25);     savebutton.settext("save");       button cancelbutton = new button(composite, swt.none);     cancelbutton.setbounds(548, 134, 75, 25);     cancelbutton.settext("cancel"); 

but, when displaying tab, scrolls present, but, when scrolling composite, scroll bar moves , elements on other side of scroll not showing any, idea why not working ?

thanks!

from ggrec's answer created snippet you. have used scrolledcomposite gridlayout. hope make task easier.

 final scrolledcomposite scrolledcomposite = new scrolledcomposite(parent, swt.border | swt.h_scroll | swt.v_scroll);             scrolledcomposite.setexpandhorizontal(true);             scrolledcomposite.setexpandvertical(true);              final composite composite_parent = new composite(scrolledcomposite, swt.none);             composite_parent.setlayout(new gridlayout(3, false));             scrolledcomposite.setcontent(composite_parent);             scrolledcomposite.setsize(composite_parent.computesize(swt.default, swt.default));              final composite composite_child = new composite(composite_parent, swt.none);             composite_child.setlayout(new gridlayout(2, false));              final label lbldefault1 = new label(composite_child, swt.none);             lbldefault1.setlayoutdata(new griddata(swt.right, swt.center, false, false, 1, 1));             lbldefault1.settext("name");              final styledtext textstyled = new styledtext(composite_child, swt.none);             textstyled.setlayoutdata(new griddata(swt.left, swt.center, true, false, 1, 1));              label lblnewlabel_1 = new label(composite_child, swt.none);             lblnewlabel_1.setlayoutdata(new griddata(swt.right, swt.center, false, false, 1, 1));             lblnewlabel_1.settext("path");              text = new text(composite_child, swt.border);             text.setlayoutdata(new griddata(swt.fill, swt.center, true, false, 1, 1));              scrolledcomposite.setminsize(composite_parent.computesize(swt.default, swt.default)); 

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -