twinBASIC Update: July 16, 2023

Highlights include twinPACK publisher support in the new IDE, indenting of pasted code, inline code hints, and the release of a 64-bit tB version of Kr00l's FlexGrid control.

twinBASIC Update: July 16, 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

Package Publisher Features Added to the IDE

twinPACK packages–the twinBASIC equivalent of NuGet–can now be published from the new IDE.  

To this point, the only way to publish twinPACK packages was via the old VSCode twinBASIC extension.  This limited the number of public package publishers to a few hardcore users, namely:

  • Wayne Phillips
  • fafalone
  • Kr00l
  • FullValueRider

If you are interested in publishing your own twinBASIC projects as packages, check out the Packages section of the twinBASIC wiki for a brief introduction.

This was the last remaining VSCode-only feature from the early days of twinBASIC.  To my knowledge, there is no longer any good reason to be using the old VSCode twinBASIC extension, as it has not received feature updates in a very long time.

I don't expect VSCode to play much of a role in the twinBASIC ecosystem now until support for external files is added.  At that point, the .twinproj file could be treated like a .vbp file (if you so chose), meaning that you could more easily integrate any external code editor (VSCode, Notepad++, Notepad, etc.) into your twinBASIC workflow.

Automatic Indentation of Pasted Code

File this one under "Developer Quality of Life Improvements."

From Wayne:

It has previously been quite painful copy & pasting code inside the IDE, with having to adjust indentation manually.  Hopefully BETA 357 helps in that regard.  Feedback very welcome

Inline IDE Hints

If you've ever gotten lost trying to figure out which End blocks went with which opening blocks, the IDE hint feature added in BETA 358 and 359 should help with that:

By default, this feature only appears when holding down the [Ctrl] key.  However, you can change this via Tools > IDE Options... > Show IDE Inline Code Hints:

Len(Of {datatype}) Support Added

Wayne suggested this improvement more than a year and a half ago:

In many languages you can get the size of a datatype without needing to create a value of that datatype (whether it be a native type like LongPtr, or a custom UDT). VBx only provides Len/LenB that takes a value as its argument:
Dim myPointer As LongPtr
Debug.print "Len(myPointer): ", Len(myPointer)

Dim myUDT As SomeUDT
Debug.print "LenB(myUDT): ", LenB(myUDT)
It would be nice for there to be a generics version that allows passing just a datatype:
Debug.print "Len(Of LongPtr): ", Len(Of LongPtr)
Debug.print "LenB(Of SomeUDT): ", LenB(Of SomeUDT)

As of BETA 351, that syntax is now supported in twinBASIC.

LLVM Work Begins

Announcement from Wayne on Discord:

To mix things up a little, and to keep things interesting, this coming week I'll be diverging slightly and starting some work on the LLVM integration.
I appreciate that there are still some big ticket things remaining, such as MDI support, and Printers support, but I hope you'll agree with me when I say that I believe we've been making good progress lately and now feels about the right time to start experimenting with LLVM.
Let's allow the newer features settle in for a week or so whilst I go play with LLVM.  Significant bug reports will still be dealt with as per normal.

Around the Web

VB FlexGrid Control 1.6

A joint collaboration between VB6 FlexGrid creator Kr00l and VB6-to-twinBASIC migration maestro fafalone has culminated in the release of twinBASIC package "VB FlexGrid Control 1.6."  The package is experimental, but it can be used in both 32-bit and 64-bit projects.

Here's the announcement from Kr00l:

The tB package VBFLXGRD16 is now available. When you check the reference please ensure to move the "priority" at the top in the reference list as otherwise a lot of errors occurs related to "VB" package. It is marked as "Experimental" as property pages are not yet supported and there are some known bugs in tB still unresolved.

Wayne Phillips approves:

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.

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

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

BETA 351

  • fixed: (regression since BETA 350) hovering over a symbol that is declared an array without an explicit subtype would restart the compiler [ https://github.com//issues/1610 ]
  • fixed: ParamArray parameters declared without explicit Variant type no longer triggers warning TB0003 [ https://github.com//issues/1610 ]
  • added: support for LenB(Of datatype) and Len(Of datatype) [ https://github.com//issues/596 ]
  • improved: advanced hover information now shows dispatch IDs rather than zero-vtable offsets for dispinterfaces [ fafalone, discord ]

BETA 352

  • fixed: WinNativeCommonControls ListView/TreeView node keys now use binary compare mode, as per the native versions
  • fixed: WinNativeCommonControls ListView/TreeView node keys are now wrapped with CStr() to avoid Collection keys limitation
  • added: Package publisher features to the IDE (ported from the old VS Code version) [ Krool, discord ]

BETA 353

  • fixed: (regression since BETA 352) unable to open multiple instances of the IDE at the same time [ fafalone, discord ]

BETA 354

  • fixed: publisher login was failing for accounts that contain # characters [ fafalone, discord ]

BETA 355

  • fixed: package-publish confirmation message corrected format of version string from 'major.minor.revision.build' to 'major.minor.build.revision'

BETA 356

  • fixed: corrections to MousePointer vbDefault handling, in falling back to the window class HCURSOR, when set [ cjck, private ]
  • fixed: Form/PictureBox/UC DrawStyle property of dotted/dashed lines now disables dpi-scaling when pen width is 1, as GDI does not support them [ cjck, private ]
  • added: menu Project > Open Project Folder... [ fafalone, discord ]
  • added: menu Project > Open Build Output Folder... [ fafalone, discord ]
  • fixed: intellisense insertion of enum values that require square brackets [ sokinkeso, discord ]
  • fixed: intellisense insertion adding "$0" when auto-completing a RaiseEvent [ https://github.com//issues/1609 ]
  • fixed: possible misue of hexadecimal literal warning had incorrect value for the LongLong version [ https://github.com//issues/1613 ]

BETA 357

  • fixed: (regression) additional PROBLEMS panel toolwindows were not movable
  • improved: IDE copy/paste now tries to indent the newly pasted code appropriately

BETA 358

  • fixed: (regression) UserControl event 'ExperimentalLog' had accidentally been renamed 'ExperimentalLogUserControl' in recent builds
  • added: experimental inlined IDE hints (currently for end of procedures, and end of components)

BETA 359

  • improved: Select-Case Case statements now offer individual code folding blocks
  • improved: IDE hints now expanded to include all code blocks
  • added: IDE setting to control the visibility of IDE hints 'Show IDE Inline Code Hints' (default = when CTRL is pressed)
  • fixed: newer versions of the IDE no longer block opening of earlier versions (versions prior to BETA 353) [ fafalone, discord ]
  • fixed: Val() edge cases with hexadecimal input
  • fixed: taking reference (ByRef) of control elements could fail [ fafalone, discord ]

BETA 360

  • fixed: (initial fixes) support for builds that have dependencies on UserControls within packages [ sokinkeso, discord ]

BETA 361

  • fixed: IDE hints were interfering with the highlighting of selected code lines [ fafalone, discord ]

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