Page MenuHomePhabricator

Size Hints
Updated 1,343 Days AgoPublic

Does the above happen to you?

  • Tired of constantly having your objects appear in unexpected locations and sizes?
  • Too lazy to learn and do layouts in EDC?
  • Hungry and need a sandwich?

Read on! But beware, the words of an embittered and sarcastic developer are ahead!
Side effects of reading may include:

  • Anger
  • Resentment
  • Frustration
  • Bewilderment
  • Nausea
  • Defenestration

Still here, eh? Well then, excelsior!

This diagram explains weight hints. Assuming that the canvas size begins at the size of the smallest icon, this is what your image will probably (depending on aspect ratios and a million other variables) look like as the container INCREASES in size. Three points are shown:

  • WEIGHT(0,0) - The object is never given more space and remains the same size regardless of container size '''DEFAULT'''
  • WEIGHT(0.5,0.5) - The object is given 50% of the total container size and scales linearly in both directions as the container size increases
  • WEIGHT(EXPAND,EXPAND) - The object is given all possible space and fills as much of the container as possible

ALIGN HINTS DO NOT CHANGE THE SIZE OF AN OBJECT.

Seen here is an object which takes up the entire space shown. As displayed, changing align hints will NOT change the total size of the object. At most, it may change the amount of space that the object takes up within its calculated area. Still clueless?

  • Use ALIGN(FILL,FILL) if you don't know what you're doing, then start from the top of this page again
  • Use combinations of 0 and 1 to align an object with the corners of its allotted space as in the diagram
  • Use ALIGN(0.5,0.5) to locate it only in the center '''DEFAULT'''
Last Author
jpeg
Last Edited
Apr 13 2015, 4:02 AM
Projects
None
Subscribers
oz