Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: RE: [platform-swt-dev] org.eclipse.swt.SWT

>>>> And the change only occurs when layout is called.

Not true. I didn't call layout() and it still happened.

The story of "change occurring only later", is related to the processing of
the event loop. All these things only happen when the processing of the
event loop resumes, unless you force the processing of the event loop to
happen right away through (a forced) "update()". That's how I understood it.

In your example code, control returns to the event loop almost immediately
(inviting the user to perform a new find). You don't need to force this to
happen in any way. So, sending "pack()" to the label's container is
sufficient. Just try it, if you don't believe it.

>>>>> And I would have been perfectly happy with it if the call to layout
didn't also undo my
>>>>> setTextWidth on my text field, resizing my text field.

By using a layout manager, you agree to release direct control over size and
location to the layout manager and to work (almost) exclusively through its
API. If you don't want that, use the null layout and take full control over
size and location by yourself.

>>>>>  Now, I can do that by adding a GridData object to the text field, but
why didn't I need one to
>>>>>  set the INITIAL width of the text field?

I'm against setting the initial width.

Just tell both righthand side Text and Label to grab excess horizontal
space, and to fill remaining width. (I guess both properties actually mean
the same, soit!). And make sure not to tell this to the lefthand side
widgets! The only thing you have to do is then to set the initial bounds of
the Shell, if you don't like the default size; and all widgets automatically
fall into place.



Back to the top