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:
- Custom twinBASIC IDE Installation Guide (NOTE: the twinBASIC VSCode extension is under a feature freeze until 2023)
- GitHub Issue Tracker (report bugs)
- twinBASIC Discord Server (chat about the project)
- twinBASIC/VBx LinkedIn Group
Significant Bug Alert: Avoid BETA 264 - BETA 271
The "Debugger: Immediate Memory Invalidation" feature introduced in BETA 264 apparently had a nasty side effect: generated EXE/DLL builds often cannot be used on machines other than the one on which they were built. The feature was disabled in BETA 272 as a temporary measure to fix the bug and reintroduced in BETA 273 without the accompanying nasty side effect.
Last Position Feature
The one you've been waiting for... 'Last Position' feature is now available in BETA 274. Available via context menu or Ctrl+Shift+F2 (as per VB6).
Additionally, the "browser back" mouse button has also been mapped to trigger the "Last Position" command.
At this time, all the shortcut keys are hardcoded, but they will be configurable prior to the v1.0 release. Here's Wayne:
Before the v1 release we will have keyboard shortcut profiles. So for example, you'll be able to select 'Legacy' for typical VB6 shortcut keys, 'Modern' for typical modern VS shortcut keys, and 'Custom' of course.
Various IDE Improvements
- BUILD will now fail if the Startup Object is missing
- "Import file..." IDE feature is now "Import file(s)...", allowing for multi-select
- Toolbox icons are now available in 75%/100%/125%/150% dpi scales, for sharper renders
- Form designer position grid dots are now larger on high DPI systems
- IntelliSense/hover info for UDT members now correctly shows LongPtr rather than Long/LongLong when appropriate
- Cursor/Icon/Bitmap resources can now be previewed in the IDE, even if the file extension is not CUR/ICO/BMP
- Form PREVIEW feature stability, particularly around accessing of global variables
- 'Browser Back' mouse button now configured to trigger the 'Last Position' command (as mentioned earlier)
- Some toolbar tooltips were missing shortcut key info
- Better reliability of the debugger Break feature
- IDE options dialog is now shorter, with scroll
Marking Your Own Procedures "Unimplemented"
Among the many new procedure attributes introduced in twinBASIC is an
[Unimplemented] attribute. I believe Wayne has been using this internally to track what VB6 features remain to be completed, but fafalone discovered recently that this attribute is available to user code, too:
So apparently you can mark your own code Unimplemented.
I propose keeping this feature even after there are no more unimplemented VB6 things. 🙂
Improved Mouse Scroll Support for Controls
The following mouse scroll-related properties were added:
The following mouse scroll events were added:
For added context regarding the above properties and events, here's an excerpt from a conversation between Wayne and Ben Clothier in the twinBASIC Discord:
[Ben]: This might be just my ignorance since I don't recall working w/ controls that has both
MouseWheelScrollevents. How does it work when one uses the mouse wheel to scroll? Will both fire? Or would they be mutually exclusive (former firing only when I fiddle with the scrollbars with clicks or drags or keyboard while latter only for mouse wheels)?
WheelScrollEventsis a Boolean property, not an event, indicating whether the mouse wheel triggers
Scrollevents. In VB6, the wheel does not fire
Scrollevents, hence the new boolean property
On the topic of mouse events, adakordev asked about planned support for other new mouse events:
[adakordev]: We have the MouseMove event, but is something like MouseHover planned? Moving the cursor onto a label/control changes the BackColor to color2, but leaving the label with the cursor changes it back automatically to color1/ the settings before?
[Wayne]: MouseEnter and MouseLeave events are planned.
Around the Web
Summary of twinBASIC's "New" Features
With his head down working on the language itself, Wayne has not taken the time to compile a recent list of all the features beyond VB6 compatibility that are available in twinBASIC today. twinBASIC's main VB6 champion, fafalone, posted a current list of 60(!) new language features over on vbforums.com:
The WWW site for tB only lists a few of the new features, and there's no centralized list available yet. So I made a list of all the new features I could recall right now. These are all available *right now*...
Another week, another sample twinBASIC project from fafalone. Here's an excerpt from the project's GitHub readme:
Host an instance of Explorer itself with INamespaceTreeControl and IExplorerBrowser
This is a twinBASIC version of the following original VB6 project:
[VB6, Vista+] Host Windows Explorer on your form: navigation tree and/or folder
Here are the updates from the past week. You can also find this information by visiting the GitHub twinBASIC Releases page.
WARNING: The following issue is present in BETA builds 202 - 277 (the latest build as of publication):
- there are known memory leaks in these versions, so memory usage will be higher than normal
BETA 269 - do not use
- fixed: comments after #Region/#End Region didn't have correct syntax highlighting [ fafalone, discord ]
- improved: BUILD will now fail if the Startup Object is missing [ fafalone, discord ]
- fixed: setting UserControl.Height or UserControl.Width now only fires the Resize event if values have changed [ sokinkeso, discord ]
- fixed: KeyDown event was not firing for arrow keys in UserControls [ Tecman, discord ]
- improved: stability around global variables
- fixed: Label.Font object was not populated early enough in the creation process [ https://github.com//issues/1525 ]
- fixed: resolver ambiguity error when public procedure named same as public Enum, both in same component, referenced from a different component [ fafalone, discord ]
- fixed: passing implicit WithEvents fields as ByRef arguments sometimes caused a double-release of the COM object [ https://github.com//issues/1509 ]
- fixed: PictureBox.ForeColor property set at runtime was being ignored by PictureBox.Print calls [ https://github.com//issues/1508 ]
- fixed: OptionButton.Value property-let was not firing Click event appropriately
- fixed: UserControl.Move and Top/Left property-let not working correctly [ https://github.com//issues/1522 ]
BETA 270 - do not use
- fixed: (regression) modified-Dot indicator not always showing on the active document in the IDE code pane since BETA 267 [ Tecman, discord ]
- fixed: RES file cursor/icon parsing required the LCIDs of the individual bitmaps to match the group entry [ Tecman, discord ]
- fixed: (regression) INVALID VALUE shown for Settings file due to incorrect case-sensitivity of matching combobox items [ Tecman, discord ]
- fixed: (regression) IMPORT LOG contained a bogus warning of 'IMPORT FINISHED WITH 1 ERRORS/WARNINGS' for VBP projects containing a RES file [ Tecman, discord ]
BETA 271 - do not use
- fixed: problem opening Settings file in some instances in the last release
- fixed: Label control font DPI ratio was being set incorrectly due to changes in BETA 268
- improved: "Import file..." IDE feature is now "Import file(s)...", allowing for multi-select
- improved: toolbox icons are now available in 75%/100%/125%/150% dpi scales, for sharper renders
- fixed: (regression) error opening IDE (or no reaction to trying to open the EXE)
- NOTE: 'Immediate Memory Invalidation' debugger feature is disabled in this build
- improved: form designer position grid dots are now larger on high DPI systems
- fixed: 'Immediate Memory Invalidation' is now working again in this build
- fixed: workaround for SafeArrayAllocDescriptorEx API that doesn't set fFeatures flags appropriately (WebView2 sample would crash with 'Immediate Memory Invalidation' ON, highlighting the problem)
- fixed: lightweight controls rendered in backwards Zorder [ https://github.com//issues/1526 ]
- fixed: IDE now supports previews of .CUR (cursor image) files
- improved: 'Last Position' code editor feature, available via context menu or Ctrl+Shift+F2 [ Tecman, discord ]
- improved: intellisense/hover info for UDT members would show Long/LongLong rather than LongPtr [ fafalone, discord ]
- fixed: InternalCurrentBrush property being exposed in the form designer for some controls
- improved: Cursor/Icon/Bitmap resources can now be previewed in the IDE, even if the file extension is not CUR/ICO/BMP
- improved: form PREVIEW feature stability, particularly around accessing of global variables [ Tecman, discord ]
- improved: 'browser back' mouse button now configured to trigger the 'Last Position' command
- added: 'Export' feature to the file explorer context menu
- fixed: MouseUp events did not have the appropriate Buttons flag set [ Tecman, discord ]
- fixed: form designer multi-select (FontSize) issue [ fafalone, discord ]
- improved: some toolbar tooltips were missing shortcut key info [ Tecman, discord ]
- improved: reliability of the debugger Break feature
- added: shortcut Ctrl+Break for triggering debugger Break/Pause
- added: placeholder for 'More Components' feature in the form designer
- added: 'Editor tab space size' option to IDE options [ Tecnman, discord ]
- improved: IDE options dialog is now shorter, with scroll
- added: TextBox.Scroll event [ fafalone, discord ]
- added: TextBox.WheelScrollEvent property (default True) [ fafalone, discord ]
- added: TreeView.Scroll event [ fafalone, discord ]
- added: TreeView.WheelScrollEvent property (default True) [ fafalone, discord ]
- fixed: 'Tab Size' would not update all open editors immediately without restart (only the active editor) [ Tecman, discord ]