• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 15. Layout > Assigning Width and Height Hints

15.9. Assigning Width and Height Hints

Recall from Control Fundamentals that the preferred size of a control is the smallest possible size that best displays its content. For controls such as buttons, labels, sliders, and scales, this is almost always the size that you want these controls to have in a layout. For other controls that can contain a great amount of content, the preferred size can be undesirable because it is too large. For example, the preferred height of a table that contains 1,000 items is almost certainly too tall and not useful in a layout.[12] Any control that uses scroll bars to make more content available is suspect. This means that you will probably need to assign width and height hints for these controls. In SWT, tables, trees, lists, and text controls almost always require width and height hints.

[12] If the table is contained with a scrolling window, a table that is this tall might be appropriate.

Because SWT sizes are always measured in pixels, computing a good size for a control typically entails converting from some natural units (such as the number of characters) to pixel units.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint