How to adjust the width of master details screen ratio in Eclipse RCP?
-
07-07-2019 - |
Question
I am using MasterDetailsBlock on my FormPage. I would like to adjust the screen width for the master and details part of the form. I had been searching around and haven't found a way to do it. The documentation seems to suggest it is doable through the SashForm, but I do not see how.
It will be great if I can use percentage ratio, like the FormAttachment style, but if that is not possible..I'm ok to fix the master and details to specific pixel also.
Solution
Just use SashForm.setWeights(int[]) to modify the weights of the master and the detail in the MasterDetailsBlock.
The weights describe the size ratio of the SashForm's parts. {1, 2} for examble would make the detail twice as wide as the master.
OTHER TIPS
In your MasterDetailBlock class, override the registerPage()
method, set your all detail pages, then call sashform.setweights(int [])
Example:
protected void registerPages(DetailsPart part) {
part.registerPage(MemoryBudgetImpl.class, new MemoryBudgetDetailPage());
sashForm.setWeights(new int[]{1,3});
}