Re: Control question
- Posted by DerekParnell (admin) Apr 20, 2012
- 1313 views
What I want to know is which EditText control eg. EditText557, EditText558, EditText559 etc...
By default, each control as it is created is given a name based on the 'caption text' for it. This is 'sort of' okay but not very precise. However, you can give any control its own name and later, given a control id, get the name for it.
EditText557 = createEx(EditText, "", win, ...) setIdName(EditText557, "SurName") ... if equal( getNameId(someid), "SurName") then ...
Also note that the name given to a control will be stripped of any non-alphabetic characters except the underscore. Thus setIdName(x, "My great name!") causes getNameId(x) to return "Mygreatname".
Another potential issue is that it is quite possible to have duplicate ID names. Win32lib doesn't really care if you give two different controls that same ID name. That's up to you to monitor.
If it would be useful, I could update the IDE to automatically set each control's name to the name used by the IDE, such that it would generate code like ...
constant EditText557 = createEx(EditText, "", win, ...) setIdName(EditText557, "EditText557")