Developer forums (C::B DEVELOPMENT STRICTLY!) > Development
wxSmith: control construction lines don't set control's name
(1/1)
mandrav:
I noticed that the control constructors in the generated code don't use all the arguments.
For example, here's a wxTextCtrl's ctor generated by wxSmith:
--- Code: ("cpp") ---txtFolder = new wxTextCtrl(this,ID_TEXTCTRL1,_("Text"),wxDefaultPosition,wxDefaultSize,0);
--- End code ---
It's missing the validator and name arguments. For the validator, I don't care. wxSmith can't work with validators anyway. But the name is important, I think. I 'd expect this ctor to be generated:
--- Code: ("cpp") ---txtFolder = new wxTextCtrl(this,ID_TEXTCTRL1,_("Text"),wxDefaultPosition,wxDefaultSize,0,wxDefaultValidator,_T("txtFolder"));
--- End code ---
Notice that it's setting the control's name too. Without this, calls to wxWindow::FindWindowByName() fail.
Is this intentional? Can this be fixed easily?
byo:
It shouldn't be hard to add. Of course with name, validators won't be supported in near future ;). I haven't added support for name because it could be little bit confusing for new users. There's variable name, identifier and widget name. All those can be used to identify and find widget.
The easiest solution would be to use variable name as widget name too. Hope this would be enough ;)
(I don't want to add any other standard properties do the "confusing" problem won't appear)
I'll try code it tomorrow.
mandrav:
--- Quote from: byo on July 02, 2006, 12:21:38 pm ---The easiest solution would be to use variable name as widget name too. Hope this would be enough ;)
--- End quote ---
It' s the correct thing to do, too :)
That's what other XRC editors do...
It's no big deal, take your time. It just struk me today why my calls to wxWindow::FindWindowByName() would fail ;)
byo:
Ok, one small change. I've looked into xrc sourcecode and it uses id for setting up name. So it will be better to do it the same way. So in wxSmith, name won't be initialized with variable name but with string representation of identifier.
mandrav:
Just as good :)
Navigation
[0] Message Index
Go to full version