twinBASIC Update: October 16, 2022

Highlights include two new ways to open the twinBASIC IDE (via .twinproj files and Windows shortcuts), better performance for IDE panels, and more GUI progress.

twinBASIC Update: October 16, 2022

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

IDE Sets Itself as .twinproj File Handler

Wayne has incorporated Ben Clothier's registry script that makes the twinBASIC IDE the default application for .twinproj functions (for the current user only).  It's currently only available for the latest release (BETA 149), but I assume that subsequent releases (BETA 150, 151, etc.) will automatically update the registry to point to whatever the currently running *.exe is.

Major Performance Improvements to IDE Panels

The following IDE panels were updated to use virtual lists to significantly improve performance when displaying thousands of entries:

  • PROBLEMS panel
  • OUTLINE panel

According to Wayne,

"The new virtual treeview is tested with 1 million nodes, and the performance is excellent."

New GUI Properties, Methods, and Events Implemented

Listed below are all the newly implemented form and control properties, methods, and events:

  • Label.Backstyle
  • Form., TextBox.TabFocusAutoSelect
  • ComboBox.SelStart, .SelLength, .SelText

Around the Web

Quick Tip for Joining the twinBASIC Discord Server

From Wayne:

For anyone having trouble joining our discord server, apparently creating a discord account and logging in to it before clicking our discord link should fix it.

Shortcut to Launch the Latest twinBASIC

Desktop shortcut to always open the latest IDE version (courtesy of Greedquest)

Subclassing Controls Discussion

For years, VB6 power users have relied on low-level "subclassing" of windowed form controls to change properties and handle events that the VB6 form designer kept hidden.  As I understand it, form controls in Access are not windowed, so subclassing isn't even an option.  It sounds like twinBASIC might be bringing those extended capabilities to the masses at some point down the line.

Wayne weighed in on the topic with a possible preview of things to come:

Allowing to handle window messages of a control without further subclassing would be great, but requires a bit more thought on the implementation to ensure we don't hinder the performance by raising those events unnecessarily for the 99% of cases where we don't need to handle them manually.  Perhaps a filtered registration would work... e.g. Text1.RegisterWndProcBefore(WM_BLAH, AddressOf HandleBlah), which would pass all WM_BLAH messages to your desired callback before the normal handler (and of course the complimentary RegisterWndProcAfter).

Eval() in Future Versions of twinBASIC?

Microsoft Access has an Eval() function that allows you to execute arbitrary strings of code at runtime.  This is NOT a generic VBA function.  In fact, all calls pass through the Access expression service which has some interesting implications–most notably the treatment of IIf.

The vbWatchdog Addin does not do any complicated codegen... it just generates simple expression trees and evaluates everything by passing values to the OS provided Variant functions. Sure, this means everything gets treated as a Variant, so performance is not great.  But it's simple, and it works well.  Performance is never a big concern for Eval() anyway, given that you're parsing sourcecode from text in the first place.

It will need some refinement, but re-using the expression evaluator from the vbWatchdog VBE Addin, I believe, is the best way forward for this.

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.

BETA 146

  • improved: Label control has now been re-implemented as a lightweight control
  • improved: Image control has now been re-implemented as a lightweight control
  • improved: Label.BackStyle is now implemented
  • fixed: Image control events are now working [ https://github.com//issues/1103 ]
  • improved: WebView2 control now includes a BackColor property to allow changing the color that appears whilst the WebView2 control is loading [ msFaktura, private ]
  • improved: VBP ActiveX Control projects now don't show 'unsupported project type' error when importing [ fafalone, discord ]
  • improved: _#InternalArray members no longer appear in intellisense for control arrays
  • fixed: couldn't access the default-member property-let in control arrays [ https://github.com//issues/1240 ]
  • fixed: MsgBox/Input large text arguments are now truncated, to match VBx [ https://github.com//issues/1041#issuecomment-1272938069 ]
  • fixed: c-style arrays now outputted correctly in type library viewer [ https://github.com//issues/1241 ]
  • fixed: resizing a form that has controls with coordinates outside of the client area caused incorrect movement of controls [ https://github.com//issues/1242 ]
  • fixed: Frame/PictureBox redrawing of internal controls when ClipControls property is True
  • fixed: AddressOf on a class member, where the class host object is a WithEvents field caused codegen crash [ fafalone, discord ]

BETA 147

  • fixed: Image control font GDI leak
  • fixed: internal caching of Image/Label positions not working properly [ sokinkeso, discord ]
  • fixed: Label.BackStyle was not importing from VBPs correctly [ https://github.com//issues/1249 ]
  • fixed: MsgBox Title sometimes blank issue [ https://github.com//issues/1041 ]
  • improved: swapped internal drawing of Image/Label borders to the DrawEdge API [ https://github.com//issues/706#issuecomment-1275693171 ]
  • added: [ PreserveSig ] attribute support for interface members [ fafalone, discord ]
  • fixed: Image.PictureDpiScaling now ignored for metafiles [ wqweto, discord ]
  • fixed: Frame control back color rendering [ https://github.com//issues/1188#issuecomment-1275926019 ]
  • improved: control screenshots are now stored in PNG format for faster IPC
  • improved: form designer loading speed for forms with many lightweight controls

BETA 148

  • fixed: Label.BackStyle now defaults to Opaque to match VB6 [ https://github.com//issues/1249#issuecomment-1276450459 ]
  • fixed: (regression) Label.BackStyle was ignored and forcefully transparent when BorderStyle was Fixed-Single [ sokinkeso, discord ]

BETA 149

  • fixed: changed use of BF_FLAT to BF_MONO with the DrawEdge API [ https://github.com//issues/706#issuecomment-1277045816 ]
  • added: Form and TextBox TabFocusAutoSelect boolean property [ https://github.com//issues/1250#issuecomment-1277328282 ]
  • improved: ComboBox now supports SelStart, SelLength, SelText properties
  • improved: redesigned the PROBLEMS panel to use a virtual list, offering significantly better performance when displaying thousands of entries [ https://github.com//issues/1247 ]
  • improved: redesigned the OUTLINE panel to use a virtual list, offering significantly better performance when displaying thousands of entries
  • improved: removed the unicode character 'could be confused with' warnings issued by Monaco, due to being broken with Cyrillic text [ wqweto, discord ]
  • improved: the IDE will now attempt to set itself up as the shell handler for TWINPROJ files at startup (HKEY_CURRENT_USER) [ https://github.com//issues/1003 ]

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