Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [platform-swt-dev] ordering problem adding buttons to a GridL ayout

Title: Message
 
Thanks for the code.  I'm aware of this technique, and in fact your code gives a really good example to be discussed.  Here's some questions that illustrate the issues with imposing the lack of zero-arg constructors for Controls:
 
1.  In order to create the button instance, you absolutely have to have carnal knowledge of the constructor and class you are working with.  Otherwise, you don't know which Constructor to use, or how to address it.
 
2.  This code makes the assumption that the final parent shell instance is available at the time the button instance needs to be created.  This shouldn't always have to be the case.
 
3. From a previous thread, it is apparent that a control cannot be added / removed from a composite at runtime, but only associated with a single parent via its constructor argument on creation.  So rather than builder being able to add / remove Controls from parents, they have to be continually disposed and recreated (with all of its children).   
It's worse than that.  Some things that builders like to treat as properties really are style bits on the constructor (because that's how Windows works).  So whenever the user changes one of those "properties", you have to dispose and recreate the control (and its children).
 
But think about it: Visual Basic, Delphi, C++ Builder, and any other Windows-based GUI builder that manipulates Windows controls has exactly the same problem to solve.  If they can do it, we can too.  (Hope to see you over at the Sweet project.)  :-)
 
 
Dave
 

Back to the top