twinBASIC Update: December 9, 2024
Highlights include a proof of concept Excel XLL add-in written in twinBASIC, the TBMAN toolkit twinPACK, and a successful port of the OrdoPdfReader OCX.
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 Monday week, 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, please leave a comment below.
Here are some links to get involved with the project:
- Custom twinBASIC IDE Installation Guide
- twinBASIC Discord Server (chat about the project)
- twinBASIC Wiki (list of new features not in VBx)
- GitHub Issue Tracker (report bugs)
- twinBASIC/VBx LinkedIn Group
Highlights
Excel XLL Add-in with twinBASIC: Proof of Concept
I normally list community twinBASIC sample projects in the "Around the Web" section, but I felt like I needed to highlight this effort above the fold.
Here's fafalone's announcement in Discord's show-and-tell channel:
Making XLL Excel Addins in tB - Hello World
This is a twinBASIC port of https://github.com/edparcell/HelloWorldXll, showing the basic concept of how to make an XLL addin using the same language VBA programmers are used to.
See the GitHub repo for the .twinproj, browsable source, and details on how the project was made– it's really not that hard! Especially since I ported the entire xlcall.h Excel SDK header to tB.
I'm familiar with the XLL concept from my limited experience implementing a VB.NET add-in via the incredible Excel-DNA project.
A twinBASIC project with the same features as Excel-DNA could be a huge coup for the language. Excel-DNA (via the XLL format) provides the following features:
- Create high-performance user-defined worksheet functions
- Include pop-up documentation when entering the functions (i.e., Excel IntelliSense)
- Create custom ribbon add-ins
- Supports COM automation to call the same underlying functions via VBA
To be clear, the above features are not available in fafalone's initial proof of concept. Excel-DNA is a mature project. Getting a tB equivalent to that level will take a great deal of work. However, fafalone's proof of concept is a critical first step. I included the above Excel-DNA features to demonstrate what is possible with XLL add-ins.
Why Is This Such a Big Deal?
One of twinBASIC's biggest adoption hurdles so far has been the lack of a clear use case outside of the relatively limited market of folks maintaining legacy VB6 projects.
An easy-to-implement path for building XLL files in twinBASIC would be a game changer for the following reasons:
- Excel has a MASSIVE user base
- Many Excel users have vast swaths of Excel VBA code
- Calling custom VBA functions from worksheet cells in VBA is incredibly inefficient relative to calling XLL functions
- tB has native support for multi-threading, zero runtime dependencies, and attributes that support low-level performance tweaking
A sample project allowing users to create a working XLL in under 10 minutes–complete with their own custom VBA functions–would get the attention of millions of Excel's "citizen developers."
Discord Chat Summary
* Auto-generated via Claude-3.5-Sonnet-200k on poe.com
Here's the structured summary of the twinBASIC Discord general channel discussions from December 3-9, 2024:
Overview
This week's discussions centered around several key areas including Excel integration capabilities, licensing options, and IDE development progress. The community showed particular interest in Excel XLL development possibilities and perpetual licensing options during the ongoing Black Friday sale. There was also significant technical discussion around interface compatibility and control implementations.
Bug Fixes & Improvements
- Wayne confirmed an interface method return type issue affecting UDT compatibility with VB6 will be addressed in the next release
- A fix for asterisk notation in UDT declarations within other UDTs was identified as needed
- The upcoming release will include significant ActiveX control compatibility improvements, with SSTab control support confirmed
Excel Integration Development
- @fafalone demonstrated the first-ever VB-style XLL development capability in twinBASIC with a proof-of-concept project
- The community identified XLL development as a potentially significant feature for Excel developers looking to migrate from VB6/VBA
- Discussion emerged around various Excel add-in approaches including XLL, COM add-ins, and XLAM integration options
Licensing & Business
- Wayne announced the Black Friday perpetual license sale continuation through Friday
- @mansellan proposed an innovative licensing model where continuous subscription through a major version could earn perpetual rights
- Wayne indicated openness to extending the sale offer to users waiting for the upcoming release
IDE & Development Progress
- @bclothier highlighted the significance of twinBASIC's IDE being written in twinBASIC itself
- Wayne clarified that the IDE performance is primarily dependent on WebView2 rather than the twinBASIC wrapper
- The upcoming release was confirmed to be substantial, described by @fafalone as one of only two times in tB's history with such an extended development cycle
Community Support
- Multiple community members shared success stories of corporate adoption and migration experiences
- Several workarounds for MultiPage control alternatives were discussed, including using PictureBox containers
- Active discussion around various approaches to Excel add-in development showed strong community engagement in enterprise solutions
Conclusion
The week demonstrated strong momentum in both technical development and community growth. The combination of the perpetual license offering and significant upcoming release has generated considerable interest from corporate users. The Excel integration capabilities being developed could represent a significant opportunity for VBA/VB6 migration paths. Wayne's commitment to quality over rushed releases, while maintaining transparent communication about progress, continues to build community confidence.
Around the Web
TBMAN: A Rapid Development Toolkit for TwinBasic Developers
As announced by @woeoio2 in the Discord show-and-tell channel:
TBMAN is a rapid development toolkit designed for TwinBasic developers. It defines a series of comprehensive functions and objects to reduce the amount of code developers need to write and improve reusability, enabling them to complete their projects faster and more efficiently. This project offers practical tools and continues to expand and upgrade.
The project is hosted on GitHub:
I have not tried the toolkit yet, but the JSON support shown in the sample animated GIF below looks intriguing:
Integrating the Toolkit
The recommended way to use the toolkit is via the twinPACK package manager:
- Project > References > "Available Packages" tab > Search for
toolkit
- Check the box next to the row with Library Symbol "TBMANLIB"
Behind the Scenes
Out of curiosity, I checked out the source code of the twinPACK package to see where the JSON code came from. As I suspected, it appears to be the de facto VBA JSON library, Tim Hall's cleverly named VBA-JSON:
OrdoPdfReader
From @fafalone in the General Discord chat:
Pleased to report that saturnian's OrdoPdfReader OCX compiles wonderfully with twinBASIC, making only the tiny change of commenting outIf CreateAsm Then
, replacingmIsSubclassed = SetWindowSubclass(hWnd, lpAsm, ObjPtr(Me), 0)
withmIsSubclassed = SetWindowSubclass(hWnd, AddressOf SUBCLASSPROC, ObjPtr(Me), 0)
, the same lpAsm->AddressOf inRemoveWindowSubclass
, then commenting out the wholeClass_Terminate
routine, all in clsTrickSubclass2.cls, switching the incompatible, complex, and large assembly thunk based subclassing with tB's simple native support forAddressOf
on class members. The test app has some parsing errors and failed to load the control automatically, but worked fine once the reference to the compiled ocx was added. I started, but haven't finished, a 64bit update
Looks to be yet another promising project from fafalone:
Cube & Hyper Cube Rotation: A twinBASIC Sample Project
@Flowesans posted the following in the Discord show-and-tell channel:
I had asked AI for something about Projection and 4D
The project's .twinproj
source file is available for download from Discord.
Changelog
Here are the updates from the past week. You can also find this information by visiting the GitHub twinBASIC Releases page.
No new releases this week.