twinBASIC Update: April 10, 2022

Highlights include 7 (!) new releases of the twinBASIC IDE and twinBASIC solving a difficult problem for a popular MS Access open-source addin.

twinBASIC Update: April 10, 2022

On April 23, 2021, I helped Wayne Phillips introduce the world to twinBASIC at the Access DevCon Vienna conference.  I boldly predicted that twinBASIC (along with the Monaco editor) would replace VBA and its outdated development environment by 2025.  With that goal in mind, this weekly update is my attempt to keep the project fresh in the minds of the VBA development community.

Every Sunday, I will be providing updates on the status of the project, linking to new articles discussing twinBASIC, and generally trying to increase engagement with the project.  If you come across items that should be included here, tweet me @NoLongerSet or email me at mike at nolongerset dot com.

Here are some links to get involved with the project:


IDE Changes Coming Fast and Furious

Since my last weekly update article, there have been seven (!) new releases of the rapidly developing twinBASIC IDE.  For you Naval Academy grads, that works out to one release per day!  

I haven't had a chance to use the new versions yet, but the feedback on GitHub has been very positive.  Wayne's even managed to change some hearts in the process:

The new IDE is looking good, I apologise because a while ago I suggested that this could be a distraction from tB development, but it really does feel much better.

For a list of all the improvements, refer to the changelog below.

Around the Web

twinBASIC to the Rescue

Adam Waller's fork of the msaccess-vcs-integration project on GitHub (which I wrote about previously on this blog) is using twinBASIC to provide a new ribbon interface in both 32-bit and 64-bit versions of Microsoft Access.

A Quick, Free Way to Try Version Control with Microsoft Access
Curious about getting started with version control in Microsoft Access, but don’t want to commit a lot of time or money? This could be just the solution for you.

The new feature is currently implemented in the dev branch of the project.  Here's a link to the twinBASIC source code.

A Story in Four Parts

What I found more interesting than the source code was following along with the arc of the story to see how twinBASIC can provide simple solutions for otherwise difficult-to-solve problems.

Here are some key excerpts from the relevant GitHub issue:

Part 1. The Problem
Adam Waller [2021-01-28]:
I still think it may be possible to implement a ribbon tab in the main application ribbon using a VSTO COM add-in as a wrapper to the Access add-in. See:
Part 2. The Possibility
A9G-Data-Droid [2021-04-30]:
Note: The author of twinBasic, Wayne, has given us promise that tB will allow us to easily create 64-bit Access Plugins. This will be one of my first tB efforts: to make a lightweight wrapper that passes off to our existing ribbon code. Allowing us to load a ribbon from any project. This generic ribbon wrapper could then be used for anything. So I plan on making it a standalone GH repo.
Part 3. The Promise
Adam Waller [2022-02-26]:
Some exciting news on this front! TwinBasic has matured enough for me to build out a basic proof of concept implementation of a ribbon interface! This will allow us to have a more user-friendly launching point for the add-in and should work in both 32 and 64 bit versions of Office, which was a major limitation on the VSTO approach.
Part 4. The Payoff
Adam Waller [2022-04-05]:
To summarize the approach I took on this, I created a COM add-in using TwinBasic, and embedded the compiled DLLs and Ribbon.xml in a resource table in the Access add-in. These automatically update from the GitHub project source folders when the add-in is opened.

During the installation, the Access add-in runs regsvr32 on the COM dll, which generates the necessary COM registrations in the registry. The TwinBasic project also includes some (VBA) code to add the registry entries that Microsoft Access uses to show and activate the COM add-in.


Here are the updates from the past week.  You can also find this information by installing the twinBASIC VS Code extension and clicking on the Changelog tab of the extension page:

Nothing in the VSCode change log this week.

The VS Code twinBASIC extension is currently running v0.14.36 of the twinBASIC compiler.  Compiler updates will start getting pushed to the VS Code extension sometime in the next 1 - 2 weeks, according to Wayne.

In the meantime, I'm going to list the changes to the IDE beta releases as detailed in GitHub.


BETA 12 is now available:

  • added: Outline panel alphabetical sort option (via the ellipses menu)
  • fixed: context menu position will now be repositioned if it extends past the bottom or right edge of the viewport


BETA 11 is now available:

  • fixed: Settings 'Startup Object' now doesn't show '(none)' option if the build type is 'Standard EXE'
  • improved: Outline panel now offers filtering options via the ellipses button (filters: Class Fields/Module Variables/Enumerations/User Defined Types/DLL Declares/Constructors/Properties/Procedures/Variables/Parameters)


BETA 10 is now available:

  • added: IDE option of 'File Explorer: Single-Click Preview' (default: true)
  • added: 'Run the code at the cursor position / Preview the form' toolbar button (running man) to match the F6 function key
  • improved: 'Standard EXE' renamed form 'MyForm' to 'Form1' to match VBx
  • fixed: clicking the Save toolbar button after creating a new project without making any changes did not prompt to save the project
  • fixed: 'startup object' set to '(none)' not working correctly with F5/Start button
  • fixed: 'startup object' set to 'Sub Main' not working correctly with F5/Start button
  • fixed: 'startup object' will now use the PredeclaredId instance, if that attribute is set on the Form
  • improved: error handling and notification around project file saving


BETA 9 is now available:

  • fixed: the Save dialog before opening a new project now offers a 'Discard Changes' option [ BETA 7 - Can start a new project #786 ]
  • improved: all modal dialogs now accept ESCAPE key to cancel or close
  • improved: verbized modal dialog action buttons
  • added: (WinNativeForms) Form.Unload event
  • fixed: closing the IDE now checks the project dirty state and requests to save changes if necessary


BETA 8 is now available:

  • fixed: undo/redo buttons on the toolbar were not properly visible with the LIGHT theme active
  • fixed: regression, internal form Create event not firing, leading to Form.Load event being lost [EduardoVB]
  • improved: tweaked the front page opening dialog
  • added: IDE option of 'Focus The Recent Tab On IDE Startup' (default: false)
  • improved: 'New Project' / 'Open Project' / 'Open Recent' / 'Close Project' menu options are now implemented


BETA 7 is now available:

  • added: project setting of 'Startup Object'
  • changed: F5 key behaviour to match VBx, invoking the designated Startup Object
  • changed: F6 key now executes the code under the cursor when in the code editor, or previews the active form in the form designer
  • removed: MainModule from 'Standard EXE' project, as we no longer require the Sub Main bootstrap
  • improved: full screen mode (F4) now includes a titlebar with min/max/close and exit full screen buttons
  • improved: rearranged toolbar icons and added undo/redo buttons
  • fixed: global variables were not always reset by the debugger when a debug session was terminated [ variable not reset between runs #778 ]
  • fixed: (WinNativeForms) Form.Refresh now includes the RDW_ERASE flag in call to RedrawWindow
  • fixed: RaiseEvent argument validation too strict [ "cannot coerce type 'Collection' to [ByRef] 'Object'" #773 ]
  • fixed: missing Optional attribute on ListBox.AddItem and CheckBox.AddItem from original VB6.OLB [ ListBox.AddItem Method Signature is Incompatible with VB6 ListBox.AddItem Method Signature #776 ]


BETA 6 is now available:

  • improved: added IDE option of 'Restore State Of Code Editors On Opening Project'
  • improved: added keybinding for CTRL+K: Comment Selection
  • improved: added keybinding for SHIFT+CTRL+K: Uncomment Selection
  • improved: added keybinding for SHIFT+CTRL+F: Find in files (project)
  • fixed: Escape key not working in Find popup monaco dialog
  • fixed: Enter key not working in Find popup monaco dialog
  • improved: reduced the effect of the dimmed overlay when menus are visible
  • improved: form designer control selector dropdown was glitching when focused
  • fixed: problems with library references were not being reported
  • fixed: unimplemented DAP message of "custom/buildUnregisterFailed" on DllUnregister failure
  • added: experimental FULL SCREEN mode for the code/designer area, using F4 key to toggle

All original code samples by Mike Wolfe are licensed under CC BY 4.0