SmartClient Version: v8.3p_2012-12-08/Pro Deployment (built 2012-12-08)
I have a number of VStacks in a HStack and layouts in the VStacks that can be dragged between the different VStacks.
My problem is when the height of a VStack gets above the initial height of the HStack, the height of the other VStacks remain the same and dont expand toghter with the HStack.
I have tried to add a ResizedHandler to the HStack and setting the height of the VStacks there, but that didn't work.
Test case to show the problem:
Is there any way for all the VStacks to always have the full height of the HStack?
I have added a picture that shows the problem in the test case.
/Futtegud
I have a number of VStacks in a HStack and layouts in the VStacks that can be dragged between the different VStacks.
My problem is when the height of a VStack gets above the initial height of the HStack, the height of the other VStacks remain the same and dont expand toghter with the HStack.
I have tried to add a ResizedHandler to the HStack and setting the height of the VStacks there, but that didn't work.
Test case to show the problem:
Code:
VLayout mainLayout = new VLayout();
mainLayout.setHeight(200);
mainLayout.setWidth(221);
final VStack vStack1 = new VStack(10);
vStack1.setWidth(100);
vStack1.setHeight100();
vStack1.setBackgroundColor("red");
vStack1.setCanAcceptDrop(true);
vStack1.setDropTypes("test");
final VStack vStack2 = new VStack(10);
vStack2.setWidth(100);
vStack2.setHeight100();
vStack2.setBackgroundColor("green");
vStack2.setCanAcceptDrop(true);
vStack2.setDropTypes("test");
final HStack hStack = new HStack();
hStack.setBorder("2px solid black");
hStack.addResizedHandler(new ResizedHandler() {
@Override
public void onResized(ResizedEvent event) {
System.out.println("RESIZED EVENT FIRED!");
int maxHeight = 0;
// Finds the height of the highest vStack
for (Canvas member : hStack.getMembers()) {
maxHeight = Math.max(maxHeight, member.getHeight());
}
// Sets height of other vStacks if they are smaller
for (Canvas member : hStack.getMembers()) {
if(member.getHeight() < maxHeight)
{
member.setHeight(maxHeight);
member.redraw();
}
}
}
});
Layout layout1 = new Layout();
layout1.setBackgroundColor("grey");
layout1.setWidth("90%");
layout1.setHeight(100);
layout1.setLayoutAlign(Alignment.CENTER);
layout1.setBorder("1px solid black");
layout1.setCanDragReposition(true);
layout1.setCanDrop(true);
layout1.setDragType("test");
Layout layout2 = new Layout();
layout2.setBackgroundColor("grey");
layout2.setWidth("90%");
layout2.setHeight(100);
layout2.setLayoutAlign(Alignment.CENTER);
layout2.setBorder("1px solid black");
layout2.setCanDragReposition(true);
layout2.setCanDrop(true);
layout2.setDragType("test");
Layout layout3 = new Layout();
layout3.setBackgroundColor("grey");
layout3.setWidth("90%");
layout3.setHeight(100);
layout3.setLayoutAlign(Alignment.CENTER);
layout3.setBorder("1px solid black");
layout3.setCanDragReposition(true);
layout3.setCanDrop(true);
layout3.setDragType("test");
Layout layout4 = new Layout();
layout4.setBackgroundColor("grey");
layout4.setWidth("90%");
layout4.setHeight(80);
layout4.setLayoutAlign(Alignment.CENTER);
layout4.setBorder("1px solid black");
layout4.setCanDragReposition(true);
layout4.setCanDrop(true);
layout4.setDragType("test");
vStack1.setMembers(layout1, layout2);
vStack2.setMembers(layout3, layout4);
hStack.setMembers(vStack1, vStack2);
mainLayout.addMember(hStack);
I have added a picture that shows the problem in the test case.
/Futtegud