Here’s a tip for defaulting TextField Values for debugging purposes only.
Often when debugging an application, you’ll need to enter the same data in the same fields over and over. There is a temptation to set the value of the field to the test data. The downside of this is that you need to remove all those defaults before deploying your application. What if some of those default values gives admin access to your database?
I add an Open event handler for those fields and use pragmas to keep the data secure. For example, in a text field open event handler I’ll put the code:
Sub Open() Handles Open #If DebugBuild me.Value = "wayneg@axisdirect.nz" #EndIf End Sub
When building a deployable version of the application an empty event hander method will be included and my email address will be kept private. Now, I don’t need to remove private data from the project and it will still be there for the next release cycle.
Wayne Golding has been a Xojo developer since 2005 and is a Xojo MVP. He operates the IT Company Axis Direct Ltd which primarily develops applications using Xojo that integrate with Xero www.xero.com. Wayne’s hobby is robotics where he uses Xojo to build applications for his Raspberry Pi, often implementing IoT for remote control.