Custom Sashform widget not retaining its width after closing the tab [message #1797249] |
Mon, 29 October 2018 08:03 |
Shankha P Messages: 1 Registered: October 2018 |
Junior Member |
|
|
Hi ,
I am having a custom SSashform whose default layout creates a vertical sash. This vertical sash is a combination of 3 parts - sashpart[0], collapsebutton and sashpart[1]. To either side of this vertical sash, I have rectangle composite objects. Now, when i try to drag the sash and change its position and close the tab. And I try to re-open the tab again, my last made changes in the sash position is not retained and the default layout(sash position) open each time.
I tried to handle the SashDrag event of the sash and allowed the container-data to be set for that model-element of the sash , so that when we reopen the tab again, the sash comes back to the position where I last positioned it.
Below is the code :
//c1 and c2 are controls to handle rectangle b1 and b2 on either side of the sash
Object data1 = c1.getLayoutData();
System.out.println("data1 : "+data1);
if (data1 == null || !(data1 instanceof SashFormData)) {
data1 = new SashFormData();
c1.setLayoutData(data1);
}
Object data2 = c2.getLayoutData();
System.out.println("data2 : "+data2);
if (data2 == null || !(data2 instanceof SashFormData)) {
data2 = new SashFormData();
c2.setLayoutData(data2);
}
((SashFormData) data1).weight = (((long) b1.width << 16)
+ area.width - 1)
/ area.width;
((SashFormData) data2).weight = (((long) b2.width << 16)
+ area.width - 1)
/ area.width;
Would really appreciate for your time and help/suggestion in this
Regards
Shankha
|
|
|
Powered by
FUDForum. Page generated in 0.08879 seconds