Article Preview
Buy Now
FEATURE
Xojo 2022 Release 1
Code Assistants, iOS Debugging, New Docs, and More
Issue: 20.3 (May/June 2022)
Author: Marc Zeedar
Author Bio: Marc taught himself programming in high school when he bought his first computer but had no money for software. He's had fun learning ever since.
Article Description: No description available.
Article Length (in bytes): 13,605
Starting Page Number: 26
Article Number: 20304
Resource File(s):
project20304.zip Updated: 2022-05-05 14:15:59
Related Web Link(s):
http://www.xdevmag.com/browse/19.3/19302/
Excerpt of article text...
In April, Xojo 2022R1 was made available and it offers significant improvements in a variety of areas including documentation, iOS debugging, deployment, PDF improvements, and many bug fixes.
Code Assistants
My favorite new feature are Code Assistants. These are XojoScripts you can install in Xojo's
Scripts
folder and execute on code within the IDE to make changes to the selected text. You access these via a contextual menu when the selected text is appropriate (see Figure 1).A lot of code is tedious busywork, so you can use these scripts to automate certain tasks. Bundled in Xojo's Example Projects folder (
Advanced > IDE Scripting > Code Assistants
) are several sample scripts, plus a template you can copy and modify for your own scripts.While you can open and edit scripts in Xojo's IDE Script Editor, there's no support there for autocomplete, debugging, or even checking for syntax errors. If you need those, you can write and test your code in the Code Assistant Tester project (see Figure 2). Once it's working there, you can copy the code to a separate Code Assistant script file to actually use it.
What can you do with Code Assistants? Lots of things. One of the samples wraps the selected text within an
if IsDarkMode
construct, while another converts quoted text to a series of CHR calls. (I can imagine a variation that obfuscates strings like serial numbers you don't want visible in the app binary.) Another script expands comments.
...End of Excerpt. Please purchase the magazine to read the full article.