Mark Erbaugh wrote:
What is the purpose of the name parameter in most component
constructors? Or rather, when would using it be useful?
It can be used to find a widget by name. It's really more of a convenience than anything else, and it is meant to be something you can use however you want in your code, or in 3rd party tools.
For example, I've found it useful when debugging. I can set the names of various widgets in my app and then when debugging I can make sure that the one I am looking at in the debugger is the one I think it is. There have been a few times that I've chased a bug for hours only to find out that I was looking at a different instance of some class than I thought I was. So now I assign names before starting to debug something like that. I've also made the widget inspection tool display the names of the widgets in the tree, so if you've given unique names they are easy to find there.
I think that XRC will assign the xrc id to the widgets as their name.
Chandler gives every widget a unique (within the current context at least) name, and then uses the names to tie into their persistence model, and also by the app's functional tests to help the test framework be able to "test drive" the app.
ยทยทยท
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!