twinBASIC Update: September 17, 2023

Highlights include inline editor widget support for tB IDE addins, a sample TODO addin, keyboard shortcut registration, and a preview of a UserControl Builder addin.

twinBASIC Update: September 17, 2023

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:


Highlights

Inline Editor Widgets

Another week, another IDE addin sample from Wayne Phillips.

This is Sample 16, a TODO manager, which demonstrates how to create inline editor widgets.  Here are the comments from the top of the MainModule:

' This addin demonstrates how to make inline widgets in the monaco editor, via the tB addin extensibility model 
' Created TODO node information is persisted to the twinproj file, using the Host.CurrentProject.SaveMetaData feature
' DEMO LIMITATION: if a document gets renamed, it will lose associations with any todo nodes
' DEMO LIMITATION: if a document is deleted, it will leave todo nodes in the 'Show TODOs' list

Here's a screen recording from Wayne showing the addin in action:

If all this recent work with twinBASIC IDE add-ins seemed like a diversion from the project roadmap, Wayne's follow-up comment to the TODO manager add-in shines some light on the true purpose of this recent branch of development:

This is in preparation for unit test integration, which will be reporting results back live in the editor, like the old VS Code version.

Keyboard Shortcut Registration

Here's the announcement from Wayne in Discord:

In BETA 393, you can now register keyboard shortcuts, e.g.:

With Host.KeyboardShortcuts
    .Add "{CTRL}{SHIFT}d", AddressOf ShowTodoItemsButton_OnClick
End With

Private Sub ShowTodoItemsButton_OnClick()
    ...

{CTRL}, {SHIFT} and {ALT} are recognized (and in that order).

The key value comes from the JS keyup event, so you would use real names for the special keys. e.g. "Enter", "ArrowUp" etc

It is planned that the user will have a convenient way of changing all keyboard shortcuts (including built-in ones), so don't be too concerned about conflicts with other addins at this stage.

Discord Chat Summary

* Auto-generated via Claude-2-100k on poe.com

twinBASIC is a new BASIC language that aims to be highly compatible with VB6 while adding many modern features. Over the past week, the conversations focused on bug fixes, new features, and comparisons to other languages.

  • A textbox character limit bug was fixed to properly support up to 2^31-2 characters like VB6. Binary and octal literal support was added.

  • File I/O and Open statement bugs were fixed. App.Path issues were resolved.

  • Arrays can now be declared with bounds set to variables, enabling dynamic array allocation. However, this was found to be a bug, not a feature, so it will be removed.

  • Additional IDE differences from VB6 were noted, like the behavior when copying controls on a form. More IDE parity with VB6 is planned.

  • Error handling compatibility is not yet complete, so error numbers differ from VB6. This will be improved over time.

  • New WebEx features will allow serving embedded HTML/CSS/JS files without writing them to disk first.

  • Multi-project editing and debugging is not likely for v1.0, but support is planned later.

Overall, rapid progress is being made on twinBASIC. It already rivals VB6 for many use cases, with more VB6 compatibility fixes and new features continuing to be added weekly. The conversations illustrate the high level of community interest and involvement in shaping twinBASIC's ongoing development.

Around the Web

UserControl Builder Add-in Preview

Over on the twinBASIC Discord show-and-tell channel, sokinkeso posted the following teaser:

Back in 90's when I was doing my first steps with vb6, ActiveX Control Interface Wizard was my favorite addin .. Thanks to Wayne , and the new Add-in subsystem of TwinBasic, I started creating my "Usercontrol Builder" addin. It is not completed yet, but it has the basic functionality , and a new  more polished interface , in comparison with vb6's addin.

To see a preview of the in-progress UserControl Builder, click on the image below to open sokinkeso's 2-minute screen recording of the utility in action.

Changelog

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

Releases · WaynePhillipsEA/twinbasic
Contribute to WaynePhillipsEA/twinbasic development by creating an account on GitHub.

ChatGPT Changelog Summary

* Auto-generated via ChatGPT, sorted in order of ChatGPT's opinion of "most impactful changes."

Here's a concise summary of the notable updates in twinBASIC:

  • Improved IntelliSense Performance: Significant enhancements to IntelliSense performance for larger projects, streamlining code writing and editing.
  • Addin Extensibility Enhancements: Several new features have been added to extend addin capabilities, including:
    • Host.ChangedActiveEditor event, HtmlElement.Remove() method, CodeEditor.AddMonacoWidget(), and Project.LoadMetaData/SaveMetaData methods.
    • Enhanced HtmlElement.AddEventListener now takes an optional data argument for event callbacks.
    • New CSS variables for widgets and CodeEditor.GetSelectionInfo for selection details.
    • Global IDE shortcut registration with the Host.KeyboardShortcuts.Add method.
  • ActiveX Control Persistence Fixes: Resolved an issue with ActiveX control persistence incorrectly calculating ExtentX/Y values in certain circumstances.
  • Resolved Issues with tb Built Ax Controls in MS Access: Fixed 'Automation Error' in some instances when using tb Built Ax controls in MS Access.
  • Fixed TextBox Max Length: Adjusted the TextBox max length to match VB6, ensuring compatibility.

WARNING: The following issue is present in BETA builds 202 - 3xx (the latest build as of publication):

  • there are known memory leaks in these versions, so memory usage will be higher than normal

BETA 391

  • fixed: TextBox max length to match VB6 [ sokinkeso, discord ]
  • fixed: ActiveX control persistence would sometimes calculate wrong ExtentX/Y values if the border of the UC had been changed via API methods, causing black bars in design mode [ Tecman, discord ]
  • fixed: 'Automation Error' in some instances when using tb Built Ax controls in MS Access [ Tecman, discord ]
  • fixed: unable to turn off compiler warning TB0016 'implicit creation of variable via ReDim' [ Tecman, discord ]
  • added: (addin extensibility) Host.ChangedActiveEditor event
  • added: (addin extensibility) HtmlElement.Remove() method for removing an HTML element from its parent container
  • added: (addin extensibility) monaco widgets support via CodeEditor.AddMonacoWidget(), see sample 16
  • added: (addin extensibility) CSS variables for use inside widgets: --monacoFontFamily, --monacoFontSize, --monacoGutterWidth
  • added: (addin extensibility) CodeEditor.GetSelectionInfo(StartLine, StartColumn, EndLine, EndColumn)
  • improved: (addin extensibility) HtmlElement.AddEventListener now takes an optional Data argument, accessible in the event callback via eventInfo.data
  • added: (addin extensibility) Project.LoadMetaData/SaveMetaData methods for persisting state or other data from your addin inside the twinproj file
  • added: (addin extensibility) Sample 16: TODO manager addin (monaco inline widgets)

BETA 392

  • improved: overall intellisense performance in larger projects
  • fixed: final statement return-value optimization edge case, causing a final self-assignment (MyFunc = MyFunc) to incorrectly clear itself [ GCUser99, discord ]

BETA 393

  • fixed: fixed-length arrays trying to use non-constant values in array bounds is now flagged as an error [ Tecman, discord ]
  • fixed: (regression since BETA 356) mouse pointer caret cursor not showing when hovering over a textbox [ sokinkeso, discord ]
  • added: (addin extensibility) Host.KeyboardShortcuts.Add(keyString, Callback) method for registering global IDE shortcuts

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