Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » How do I convert screen percentages in to containerData(I am trying to make sure that the RCP application displays same way no matter what the resolution of the monitor is so I want to define how much % does an element take.)
How do I convert screen percentages in to containerData [message #1764985] Mon, 05 June 2017 14:29 Go to next message
Ankush Pandit is currently offline Ankush PanditFriend
Messages: 1
Registered: June 2017
Junior Member
I am trying to make sure that the RCP application displays same way no matter what the resolution of the monitor is so I want to define how much % does an element take. I want to understand how can I get a containerData Value for say 20% of the screen?

What have I done so far?

I have tried multiplying 200 to the percentage number and the resulting value is good if I am trying to setup a height and I multiply 100 with the percentage value to setup width of the element. This seems to work but I do not understand why? Also what I don't understand is why I need to * 200 for height and 100 for width.

Please help me understand how containerData works or point to any documentation that will be helpful.

Thanks in advance.
Re: How do I convert screen percentages in to containerData [message #1764998 is a reply to message #1764985] Mon, 05 June 2017 16:06 Go to previous message
Eclipse UserFriend
The algorithm is defines in org.eclipse.e4.ui.workbench.renderers.swt.SashLayout.tileSubNodes(). Basically when laying out the set of nodes within a tile area (MGenericTile), the algorithm sums up the weights as encoded in the containerData, and then parcels out the available pixels in accordance to each node's weight / total-weight, subject to some minimum amount. Those weights (containerData) are updated as the user changes the sash location too.

So if you define your initial model with a MPartSashContainer with 3 MPartStacks, and set the containerData values for each MPartStack to 300, then the total weight will be 900, and each MPartStack will be allocated 300/900 = 1/3 of the available pixels for that MPartSashContainer.

Brian.
Previous Topic:Opening E3.x and E4.x in the same place
Next Topic:Duplicate PopupMenu-Items for HandledMenuItem with DynamicMenuContribution
Goto Forum:
  


Current Time: Fri Mar 29 13:53:50 GMT 2024

Powered by FUDForum. Page generated in 0.02272 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top