Page 1 of 1

adding names by default

PostPosted: Sun Feb 13, 2011 11:41 am
by Boudewijn
When I add objects to the form they receive NO name.
That has to be added manually.
Quite a burden if you want to access them in code.

when adding textboxes that are not bound to fields in a table the automagically assigned names could be text1, text2 etc
If the developer wishes to reference them he has at least something available.

Re: adding names by default

PostPosted: Mon Feb 14, 2011 10:00 pm
by jgarfield
By that same token if I have a lot of elements on my form that I don't want to access in code, then not automatically filling in incremental default names keeps my auto-complete code and element namespace nice and neat, only filled with values which I have decided are important.

It also has the added benefit of making a developer think about what to name things so that they have names that make sense and hopefully make it easier to know what is going on in the code. What future developer is going to know what elements.text1 is? elements.searchBox however, is at least indicative of about what this thing is.

Re: adding names by default

PostPosted: Mon Feb 28, 2011 9:50 am
by Boudewijn
what I mean is that if I add a field from a table to a form (as an example) and this field is a textfield the automatic assigned name could be like txtFieldName.
At the same time a label will be displayed (telling what the textbox is about) and that label could be lblFieldName.
FieldName is of course the name of the field from the table.

If that field contains dates the name could be like datFieldName
Containing a memo field the automatic name could be memFieldName
I guess you see where I am thinking of.

Other, not directly related controls on a form should have an incremented name (command1, command2 etc.)
Those names can then be changed by the developer (cmdOK, cmdCancel, ...)