twinBASIC Update: April 2, 2023
Highlights include an experimental ListView control, read-only JSON view for tbform and tbcontrol files, and a mention of twinBASIC in The Register.
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:
- Custom twinBASIC IDE Installation Guide (NOTE: the twinBASIC VSCode extension is under a feature freeze until 2023)
- GitHub Issue Tracker (report bugs)
- twinBASIC Discord Server (chat about the project)
- twinBASIC/VBx LinkedIn Group
Highlights
ListView Control Added
An experimental ListView control has been added to the WinNativeCommonCtls toolbox. To use the control:
- Left-click to select the control from the WinNativeCommonCtls toolbox
- Click and drag to add the control to the form
- Switch to the code-behind to add code to populate the list box (see sample code below)
- Run the project
- Test the output
I've never used the ListView control (I'm much more familiar with Microsoft Access's native Listbox control). However, some quick Googling turned up some sample code that I was able to use to test the basic functionality:
Private Sub Form_Load()
' Set the View
ListView1.View = lvwReport
' Add the columns
With ListView1.ColumnHeaders
.Add , , "Name"
.Add , , "Surname"
.Add , , "Address"
End With
With ListView1.ListItems
' Add the normal text
.Add , , "Fred"
.Add , , "Sarah"
.Add , , "Paul"
End With
With ListView1
' Add a value to the second column to the first item on the list ("Fred")
' (1) = First item on list
.ListItems(1).SubItems(1) = "Crowley"
.ListItems(2).SubItems(1) = "Ives"
.ListItems(3).SubItems(1) = "Smith"
' Add a value to the third column to the first item on the list ("Fred")
' (1) = First item on list
.ListItems(1).SubItems(2) = "16 Liverpool Lane"
.ListItems(2).SubItems(2) = "102 England Street"
.ListItems(3).SubItems(2) = "1 Baker Street"
End With
End Sub
View As JSON for tbForm and tbControl designer files
If you use File > Export Project... or the Project: Export Path and Project: Export After Save settings for version control with twinBASIC, you're likely familiar with the text-based JSON format that the tbForm designer files get exported into. With this new shortcut menu command, you can new see a read-only view of this JSON directly in the IDE.
Added IDE Option to Show Memory and Resource Usage
From Wayne in Discord:
In BETA 284, there's a new IDE option: "Show memory and resource usage"
This is mostly for my benefit for when I'm tackling the memory leaks soon. But others might also find it useful:
(these should be the same figures you can find in the Task Manager, by selecting columnsMemory (active private working set)
,User objects
andGDI objects
, and looking at the twinBASIC_WinXX.exe process)
Various IDE Improvements
- form designer dropdown list of controls is now alphabetically sorted
- F6 shortcut key for launching form preview now works when behind-form code editing
- after a UserControl change, other form designers will now auto-refresh without requiring a click on 'RESYNC' button
- when resizing a control on the form designer, the IDE no longer tries to render it until the mouse is released
- hover/intellisense now shows more pertinent information for procedures and API declares (such as procedure type, DeclareWide, CDecl)
Around the Web
twinBASIC Gets a Mention in The Register
In the article, Nostalgic for VB? BASIC is anything but dead, author Liam Proven mentions twinBASIC alongside RAD Basic near the top of the article as two small-team projects seeking to "recreate" Visual Basic "or something like it":
Perhaps because VB started off as a one-man project, multiple people and small teams have sought to recreate it, or something like it. The Reg has covered one of these, RAD Basic, a couple of times: first when it attempted to crowdfund its development, and later when it released its third alpha version.
Closely comparable is twinBASIC, which publishes weekly updates so you can track its progress. That's good, as there's as little to see on twinBASIC's Github as there is on the RAD Basic one. We reckon that the two projects should talk: they might benefit from teaming up.
RAD Basic vs. twinBASIC, Revisited
Changelog
Here are the updates from the past week. You can also find this information by visiting the GitHub twinBASIC Releases page.
WARNING: The following issue is present in BETA builds 202 - 286 (the latest build as of publication):
- there are known memory leaks in these versions, so memory usage will be higher than normal
BETA 282
- WARNING: there are known memory leaks in this version, so memory usage will be higher than normal
- added: (EXPERIMENTAL/INCOMPLETE) WinNativeCommonCtls.ListView control
BETA 283
- WARNING: there are known memory leaks in this version, so memory usage will be higher than normal
- changed: default IDE setting for Single-Click Preview is now OFF by default
- improved: form designer dropdown list of controls is now alphabetically sorted [ DannyB, discord ]
- improved: F6 shortcut key for launching form preview now works when behind-form code editing [ Tecman, discord ]
- improved: after a UserControl change, other form designers will now auto-refresh without requiring a click on 'RESYNC' button
- improved: when resizing a control on the form designer, the IDE no longer tries to render it until the mouse is released [ fafalone, discord ]
- improved: hover/intellisense now shows more pertinent information for procedures and API declares (such as procedure type, DeclareWide, CDecl) [ fafalone, discord ]
- fixed: (regression since BETA 275) decompiled type library documents in the References project folder were not showing any syntax highlighting
- fixed: when importing a VBP, form controls that are internal UserControls are now stripped of their hardcoded project name references, allowing for renaming of the project without interfering with UserControl imports [ fafalone, discord ]
BETA 284
- WARNING: there are known memory leaks in this version, so memory usage will be higher than normal
- added: 'View As JSON' context menu option in the IDE file explorer, for tbform and tbcontrol designer files
- fixed: (regression since BETA 283) moving a control in the form designer caused a momentary flicker whilst the control was redrawn [ sokinkeso, discord ]
- fixed: intellisense sometimes showed duplicate, and sometimes invalid OnPropertyGet/OnPropertyLet/OnPropertySet Handles events [ fafalone, discord ]
- added: IDE option of 'IDE: Show memory and resource usage' (default False, accessed via Tools > IDE Options dialog)
BETA 285
- WARNING: there are known memory leaks in this version, so memory usage will be higher than normal
- fixed: VBP import of Ax/UserControl properties, tB was converting tabs inside strings into spaces [ Tecman, discord ]
- fixed: PictureBox and Image controls now responds to direct interface requests for IPicture/IPictureDisp [ Tecman, discord ]
- fixed: ActiveX events that fire during deactivation are now muted
BETA 286
- WARNING: there are known memory leaks in this version, so memory usage will be higher than normal
- added: discord/twitter/github/kofi links within the IDE
- fixed: (regression) Timer control events could fire twice [ sokinkeso, discord ]