Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-swt-dev] Mac OS X port: Tree/MacUtil question

Martin,

Today I started looking over the DataBrowser again.
Browsing both the Carbon API and the SWT hierarchy I found you use the Carbon function "newControl()" to create and embed new controls in "MacUtil.newControl()". The Carbon API says using the native function "newControl()" is not recommended but instead use "GetNewControl()"
Do you use "newControl()" by purpose or by *accident* ?
I think we should try to migrate to using the _new_ method "GetNewControl()" except you know any reason why not.

I use NewControl on purpose. Here is why:

GetNewControl() expects all initial arguments in a resource.
NewControl() takes the arguments directly.

The former makes only sense if you are using a tool like a graphical UI builder that
stores all parameters for a control in a resource file.
The latter is used when creating the control programatically.

Since SWT lets you create controls only programatically it would not make much sense to have to store the arguments in a resource file first.

Where do you find the statement that "using the native function 'NewControl()' is not recommended"?

--andre



Back to the top