twinBASIC Update: June 12, 2022

Highlights include ActiveX control support on twinBASIC forms and a discussion about the (accidental?) interface constructor language feature.

twinBASIC Update: June 12, 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:


ActiveX Control Support on twinBASIC Forms

As of BETA 51, there is now experimental support for adding ActiveX controls to twinBASIC forms.

There are some known limitations that will be addressed shortly:

  • not all controls working yet (e.g. Windows Media Player, causes a crash)
  • full control alignment not yet supported so things like ToolBars/StatusBars do not anchor properly
  • property pages not yet supported
  • handling of unregistered / 'missing' controls is not graceful
  • frame (containers) not yet supported
  • toolbox icons transparency not yet supported
  • setting object properties like Font / Pictures not yet possible in the form designer
  • there is no 'Components' dialog yet

Despite the current limitations, this is a big step forward–especially for those VB6 programmers who have real-world applications they are looking to compile in twinBASIC.

To get started with ActiveX controls, just add a normal COM reference to the type library in the project settings, and the form designer should then automatically detect any ActiveX controls that are included in the referenced libraries and make them available to use.

Around the Web

Feature or Bug: Constructors in Interfaces

Over on GitHub, Ben Clothier opened a discussion about the inclusion of constructors in twinBASIC interfaces:

Private Interface IFoo
  Sub New(Stuff As Long)
End Interface

There's no prior art to consider in VBx as this (potential) feature draws on two concepts that are new in twinBASIC:

  1. Explicitly defined interfaces using the Interface keyword ("interfaces" in VBx are nothing more than classes, identified only by naming convention)
  2. Class constructors with parameters via the New() subroutine (VBx only has Class_Initialize, which does not accept parameters)

The discussion gets deep quickly as the potential implications of the feature touch on many different topics:

To quote Ben:

"The subject of constructors and inheritance is huge and complicated..."

Interestingly, neither C# nor Java supports constructors in interfaces.  The typical explanation offered for the omission is that "constructors are an implementation detail."

There's a bit of discussion around this topic with regard to C# over at StackOverflow from none other than Jon Skeet himself:

"Useful or not, it's certainly not available today. I suspect if this feature were ever to show up, it would require rather more careful design than we can do in comments :)"

"There are plenty of places where I've wanted this - almost always with generic constraints. Basically, you want to be able to call a constructor within a generic method, to create an instance of the generic type implementing some interface. It really would be useful."

Performance Benchmark Testing (help wanted!)

A request from Wayne:

"I wanted to ask if there are members of the community here that would be interested in building a performance test suite that we can use to compare the tB compiler to VB6 (and VBA)?"

If interested, follow the link above and leave a comment on the Github post.


Here are the updates from the past week.  You can also find this information by visiting the GitHub twinBASIC IDE issues page.

twinBASIC IDE -- BETA RELEASE · Issue #772 · WaynePhillipsEA/twinbasic
As discussed in #763, I've been busy working for the last few weeks on a new IDE, specifically designed for the twinBASIC compiler. Here are the details for installing the current BETA release ...

NOTE: Development of the twinBASIC VSCode extension is paused until 2023 so that efforts can be focused on the new IDE.  


BETA 52 is now available:

  • fixed: Implements-Via feature was not always correctly proxying procedures in dispinterfaces [ IDE -- BETA RELEASE #772#issuecomment-1152507161]
  • fixed: Implements-WithEvents-Via feature now allows for coclasses that do not expose any events, allowing for easier use in generics
  • fixed: 'Client Site is unavailable' message box from some VB6 ActiveX controls during window destruction
  • improved: window destruction sequence to try to avoid runtime errors of 9402/9403


BETA 51 is now available:

  • added: experimental support for consuming ActiveX controls in twinBASIC forms
  • improved: WinNativeForms control Top/Left/Width/Height are now settable at runtime and are kept in sync with anchoring and docking
  • added: WinNativeForms control Move() method
  • improved: Implements-Via now supports type library based coclasses
  • improved: Implements-Via can now forward events by using Implements WithEvents ... syntax
  • improved: using Generic classes from referenced packages is now possible
  • improved: IsDesignMode property now moved to the SerializationInfo object so that the property is available earlier (needed for Ax)
  • improved: ContainerHWND property now moved to the SerializationInfo object so that the property is available earlier (needed for Ax)
  • fixed: TabStop control property-getter had inversed logic
  • fixed: TabIndex and TabStop is now working correctly on all controls