twinBASIC Update: February 19, 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

Customize the Font in the IDE

IDE and Code Editor fonts can now be set in the IDE options dialog (Tools menu > IDE Options):

OLE Drag-Drop Methods and Events

BETA 251 added "initial implementations of all OLE drag-drop methods/events for all control types."  


The following methods and events were added...

  • Methods: OLEDrag
  • Events: OLECompleteDrag, OLEGiveFeedback, OLESetData, OLEStartDrag

...for the following controls:

  • Form
  • PictureBox
  • Label
  • TextBox
  • Frame
  • Command Button
  • Checkbox
  • Option Button
  • Combo Box
  • List Box
  • DriveListBox (NOTE: OLEDrag method only; no events)
  • DirListBox
  • FileListBox
  • Image

The following designer property was added...

  • Designer Property: OLEDragMode

...for the following controls:

  • Combo Box
  • List Box
  • Image

Wayne opened an issue in GitHub to track some remaining known issues:

OLE drag-drop support is now mostly in place for all controls.  There are some known issues:

1. When dropping text into a TextBox/ComboBox, we don't currently allowing dropping it at a particular character position, and instead the whole target TextBox text content is replaced rather than inserted.
2. When dropping a picture into an Image control, the target control does not resize according to the picture that was dropped when Stretch=False (unlike VB6, which does resize)
3. Each drag-drop operation currently leaks memory and potentially GDI objects

If you find other differences to VB6, please add them here and I will add them to the list.

The current list of unimplemented properties, methods, and events for all GUI controls is available here: List of ALL missing / unimplemented intrinsic control properties and methods.  The list is getting shorter.

Slider and UpDown Controls Added

  • WinNativeCommonCtls.Slider is feature-complete as of BETA 255
  • WinNativeCommonCtls.UpDown is currently experimental as of BETA 255

vbNullPtr Constant Added

As suggested by wqweto in the twinBASIC Discord, tB now has a built-in vbNullPtr constant:

Might by useful to have a Const vbNullPtr = CLngPtr(0) predeclared the way vbNullString and vbNull intrinsics are available

Honestly, much of the context surrounding the need for the constant went over my head, but it seemed to be something one would use when making certain API calls. More specifically, it appears to be most useful when dealing with API calls where an optional parameter is followed by one or more required parameters.  

VB6 and VBA do not allow creating a procedure where required parameters follow optional parameters.  However, this is apparently allowed in certain APIs that can be called from twinBASIC and VB6/VBA via the Declare keyword.  It comes up regularly in certain libraries, such as DirectX.  

Here's an early comment from fafalone that eventually led to wqweto's suggestion:

I'm worried about an error in COM interfaces
and I need it because I don't make the definitions, just try to implement them. DirectX has a ton of middle optionals followed by non-optional
when it's a type, i can't just pass 0

Around the Web

gotBASIC.com

Cory Smith (aka, DualBrain) recently expanded his website gotBASIC.com to include a page on twinBASIC.

He also maintains a Discord server for every language and developer in the BASIC family.  Be sure to drop by and check it out.

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 - 255 (the latest build as of publication):

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

BETA 250

  • fixed: UserControl import from VBP had issues with generating correct MiscStatus flags when compiled to ActiveX control, causing crashes in VBCCR-AX builds
  • fixed: some UserControl issues, due to a quirky, non-standard IDispatch implementation in VB6's VBControlExtender

BETA 251

  • fixed: TypeOf  now correctly supports non-Object runtime values [ https://github.com//issues/1488 ]
  • improved: stability of DoEvents when used inside compiled ActiveX controls (e.g. VBCCR.DTPicker)
  • added: support for UserControl.Size method
  • added: initial implementations of all OLE drag-drop methods/events for all control types (OLEDrag, OLEDragMode, OLECompleteDrag, OLEGiveFeedback, OLESetData, OLEStartDrag) [ https://github.com//issues/1188 ]
  • fixed: UserControl.SetFocus was marked as Unimplemented, despite being implemented
  • fixed: Form.Initialize event not firing

BETA 252

  • improved: compiler now gives the IDE better array-element assignment datatype hints for improved intellisense [ fafalone, discord ]
  • fixed: duplicate warnings about suspicious hex literals used in constants [ https://github.com//issues/1495 ]
  • fixed: (regression) modal form closure problem, since BETA 235 [ https://github.com//issues/1499 ]
  • improved: added a 'copy to clipboard' option when bad JSON is received in the IDE to help with problem diagnosis [ bclothier, discord ]

BETA 253

  • fixed: 'memory is locked' error, to match VBx behaviours [ https://github.com//issues/1492 ]
  • added: 'IDE Font' and 'Code Editor Font' options ( Tools menu > IDE Options ) [ Texman, discord ]
  • fixed: property-let is now implemented for MouseIcon property on all controls [ Tecman, discord ]

BETA 254

  • improved: ProgressBar and TreeView controls have now been decoupled from WinNativeForms into a separate package, WinNativeCommonCtls [ https://github.com//issues/1497 ]
  • added: new internal constant of vbNullPtr, equivalent to CLngPtr(0) [ wqweto, discord ]
  • added: ListBox.SelectedIndices collection
  • added: FileListBox.SelectedIndices collection
  • added: (EXPERIMENTAL PROTOTYPE) WinNativeCommonCtls.Slider control

BETA 255

  • improved: WinNativeCommonCtls.Slider control is now considered non-experimental, with all expected properties and events now added
  • added: (EXPERIMENTAL PROTOTYPE) WinNativeCommonCtls.UpDown control