Hi Rob,
This is a great example…thanks for putting it out!!
Can you teach me a few things?
Re:
local deviceScale = (display.pixelWidth / display.contentWidth) * 0.5
field.textField.font = native.newFont( opt.font )
field.textField.size = opt.fontSize * deviceScale
Where did you get this math to set fontSize: opt.height * 0.67
And what’s the point of using “deviceScale” to modify the fontSize on the native field?
Also, is “finalize” something internally supported by Corona, or is that just your personal “cleanup” convention?
Also, I’m assuming you know that function args ARE local vars (ie equally fast), so I’m not sure what advantage you seek by doing this:
function widget.newTextField(options)
local customOptions = options or {}
local opt = {}
Can you illuminate?? For example, whats wrong with one table instead of 3 to set options on constructed objects?
Oh, I guess you are afraid of overwriting the source table with defaults you set (ie pass-by-reference artifacts & all that)…is that the point? Wouldn’t two tables suffice?
Thanks again for a great start here.
Dewey