twinBASIC Update: October 1, 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

No major new releases this week.  See changelog below for details.

Discord Chat Summary

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

General Channel

Here is a summary of the key points from the Discord chat transcript about the development of twinBASIC over the past week:

twinBASIC is an open-source BASIC language and IDE that aims to modernize and extend the Visual Basic 6.0 language. The project is under active development, with new beta releases coming out frequently.

  • Recent beta releases have focused on bug fixes, including resolving issues with truncating code and problems with maximized windows. Beta 399 in particular seems to have improved window maximize/restore behavior.

  • An interesting technique was discovered to resolve crashing when porting callback code from twinBASIC to 64-bit VBA. Calling a dummy sub in the .bas module from Class_Initialize fixes the issue through some low-level magic. This could have broader implications for portability and stability.

  • Progress continues on getting basic OpenGL code samples working in twinBASIC. Some samples now render output, but limitations around hDC initialization are blocking more complex demos for now.

  • The user control builder tool saw its second beta release this week, enabling easier creation of custom twinBASIC controls.

  • Discussions covered improvements to COMCTL32 for greater ListView compatibility with v6 features. This needs to be finalized before twinBASIC 1.0.

Overall, development remains highly active with steady enhancements. The community continues troubleshooting issues, building companion tools, and testing portability of VB6 code to twinBASIC. The project maintains strong momentum as it marches toward the 1.0 milestone.

twinBASIC IDE Add-ins Channel

Here is a summary of the key points from the Discord chat transcript about twinBASIC IDE add-ins development over the past week:

  • Wayne provided sample code demonstrating how to create a ListView with columns using add-ins. This wraps each column's data in divs for CSS styling flexibility.

  • The FileUIDESIGNER constant currently covers .tbform, .tbcontrol, and in the future property pages.

  • Fafalone suggested it would be better to have separate constants for each instead of lumping together, so they can be handled differently by add-ins if needed.

  • Wayne agreed this change could be made to split them up.

  • Overall, the discussion focused on enhancements to IDE add-in capabilities related to UI designers like forms and custom controls. Sample code and suggestions were provided to help extend what's possible for add-in developers.

Around the Web

cTaskDialog Now Works with 64-bit VBA

fafalone's released a new update to his cTaskDialog project.  Here's his announcement on Discord:

nThe cTaskDialog repository has been updated with an (actually) universally working version. The class, including features relying on the callbacks, now works in VB6, 32bit tB, 64bit tB, 32bit VBA, and 64bit VBA. If you have existing projects with this, note that you'll need to update the helper .bas as well (mTDHelper.bas).  

The update implements a workaround developed by @The trick for an apparent bug he's identified in VBA 64 where the addresses of module functions are uninitialized until first called from code within VBA (as opposed to the Windows system DLL hosting the task dialog).

This likely has broader applicability, if your projects are experiencing crashing from callbacks or wndprocs in standard modules, if you haven't called anything in the module before the outside DLL does, this will likely be the fix for you to. Will be quite helpful for anyone developing code meant to work in both tB and VBA64 (or VBA64 alone).

UserControl Builder Addin Released

Today is a historic day for twinBASIC.

Today, sokinkeso released the first community-built twinBASIC IDE Add-in.  

The add-in can be downloaded from the twinBASIC Discord server at the bottom of the announcement post, reproduced between the horizontal lines below:


Usercontrol Builder addin BETA #2 , for TwinBasic -----------------------------------------------------

Release notes:

Wizard includes 6 pages (steps):

  • Page_1: Select one of the available usercontrols in your project. You can use the filters above the list for finding the desired members (if no usercontrols exist, the wizard will not open)
  • Page_2: Select from the list on the left, the built-in members that you want to include in your UC.
  • Page_3: Create your custom members. Write the name of the member in the text box, select its type and press [Add Member]. You can also edit or delete any of your custom members.
  • Page_4: Map any of the selected members (built-in or custom) with members of included controls in the Usercontrol.
  • Page_5: Fill in any extra info for the unmapped members.
  • Page_6: Pressing [Finish], the generated code will be inserted in the UC's codeEditor, at the top lines. You can see a summary or the generated code (and copy it to the clipboard), before pressing the [Finish].

About mapping:
if you map a built-in member with the same member of a control, your UC will use the implementation of the included control. if you map a custom member, with an existing member of a control, your UC will use the implementation of the included control but will be exposed with a different name (the name of the custom member) if you map a built-in member with a different member on a control, the implementation of the control's member will be used. In this case the wizard will also generate a warning, to avoid wrong mapping.

*** New feature: Continuous mapping. Holding down the Ctrl key, you can map members to the last successful mapped control.

  • You can press the [Finish] button at any page of the wizard.
  • Important note: The Builder does not read (for now) any pre-existing code. It works one way (only generating code, not replacing)
  • Supported controls for mapping (until now):
    Usercontrol, Checkbox, ComboBox, CommandButton, DirList, DriveList, FileList, Frame, HScrollBar, Image, Label, Line, ListBox, OptionButton, PictureBox, Shape, TextBox, VScrollBar
  • The UC Builder, includes tB's new data types (LongLong, LongPtr, Decimal)
  • There are some known issues (like tabIndex) that will be solved in the future.

Any comments/suggestions/bug reports,  are always welcome!


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."

  • Added Modern String Handling: Improved compiler and IDE handling of ANSI, BSTR, and UTF8 conversions to support modern string handling and document processing, increasing compatibility with non-ASCII characters.

  • Enhanced IDE User Experience: Fixed issues where min/max/restore/close buttons could disappear if the IDE was resized small, and moved 'ADMIN' status and license edition information to less intrusive locations. This results in a cleaner, more user-friendly interface.

  • Improved Class Event Handling: IConnectionPointContainer is now implemented for all twinBASIC (tb) Classes, even those without exposed events. This brings twinBASIC closer to Visual Basic Extended (VBx) behavior, increasing compatibility.

  • Fixed UserForm Display Issues: Addressed a visual bug where black bars could appear in twinBASIC UserControls hosted in VBA UserForms due to 'Zoom' feature. This ensures a smoother visual experience when integrating twinBASIC elements into VBA UserForms.


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 398

  • fixed: some compiler/IDE edge cases around ANSI/BSTR/UTF8 conversions when handling documents [ nextKast, discord ]
  • fixed: (IDE) min/max/restore/close buttons could disappear if the IDE is resized small [ DinyaZ, discord ]
  • fixed: IConnectionPointContainer is now implemented for all tb Classes, even when no events are exposed by the class, to match VBx behaviour [ https://github.com//issues/1685 ]

BETA 399

  • fixed: black bars could appear in tB-UserControls hosted in VBA UserForms due to 'Zoom' feature [ Tecman, discord ]
  • improved: 'ADMIN' status in the title bar is now smaller
  • improved: tB Licence edition information now moved to the status bar rather than the titlebar