twinBASIC Update: September 3, 2023

Highlights include two new twinBASIC IDE Addin samples, a Property Sheet demo project from fafalone, and a brief discussion of DPI scaling.

twinBASIC Update: September 3, 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

twinBASIC IDE Addin Samples Added

There are now five sample twinBASIC projects dedicated to creating addins for the twinBASIC IDE

  1. Basic addin
  2. Chart sample
  3. Monaco sample
  4. ListView sample (just added)
  5. VirtualListView sample (just added)

Below is a gallery of the various tool windows you can create in the twinBASIC IDE using these five sample projects.

Sample 10. Basic Addin

Sample 11. Chart

Sample 12. Monaco

Sample 13. ListView in a ToolWindow

Sample 14. Virtual List View

Discord Chat Summary

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

Here are some key highlights from the Discord conversation about twinBASIC:

  • fafalone was having issues using property sheets in twinBASIC, but found it has the same issues as VB6. The Debug.Print statement won't fire from a callback unless you return the right value.
  • fafalone is working on implementing a property sheet dialog as a control panel applet in twinBASIC using standard DLLs without dependency on WinNativeForms.
  • There was discussion around some odd bugs in twinBASIC like sudden high RAM usage, compiler only able to compile once before needing to restart, and delays needed before running a project after reloading. These are expected issues in a beta.
  • fafalone shared screenshots of implementing a property page dialog with tabs, text boxes, images, etc using the twinBASIC IDE.
  • There was clarification provided on what property sheets are - dialog windows like those used for file properties in Windows, defined via a resource script rather than designed visually like a form.

Overall, developers are exploring capabilities and pushing limits of the new twinBASIC language and IDE, while encountering expected bugs and quirks during the beta development process. Excitement and progress on niche features like property sheets.

Around the Web

Property Sheet Demo

fafalone has a new sample project on GitHub demonstrating how to create Property Sheets using Dialog resources rather than standard forms:

Here's an excerpt from fafalone's description of the project on the twinBASIC Discord server:

My new project using Property Sheets (like what pops up when you right click a file and select Properties in Explorer) is up. These use Dialog resources rather than standard forms. ...

The project repository on GitHub has a fairly detailed writeup on how to create a dialog resource and import it into tB, and explaining the basics of how to write the code to call it. There's code to interact with the pages, including getting and setting values and signaling changes to enable Apply, and handling events like the link and about commands on Page 2: overall, it's fairly similar to subclassing, if you have experience with that you'll feel right at home.

DPI Scaling Explained

This Q&A appeared in the off-topic channel of the twinBASIC Discord.  

[AdmiralGrandPa]: Could someone please summarize the whole DPI-Awareness thing in a simple sentence or 20?

[fafalone]: people with high resolution monitors apply scaling, because the same number of pixels in size compared to a normal screen becomes super tiny. So sizes of forms, controls, images, etc, have to be scaled. This can either be done automatically by the OS, or manually by the application. twinBASIC forms/controls, unlike VB6 controls, do manual scaling themselves, and turn on manual dpi aware for your program by default. This can create a lot of issues when using API controls and calls, because tB doesn't know about those so won't apply scaling, you have to do it yourself. I'd say 99.9% of VB6 apps don't do this, and it's a lot of extra work and can be quite difficult at times, particularly when you need to provide multiple sizes of images. Automatic OS scaling was pretty bad in the XP days, but has since gotten a lot better, so often it's fine to just turn it off and let Windows deal with it. The exception is if you have a lot of graphics that scale poorly.

While not necessarily twinBASIC-specific, I thought it was an interesting topic.

DPI scaling was not an issue back in the VB6 days, since pixel sizes didn't vary much among monitors.  Generally speaking, physical monitor size and pixel count were strongly correlated: bigger monitors had more pixels.

These days individual pixel sizes can vary quite a bit among monitors.  Operating systems compensate by providing settings to scale text and images, but it's not a perfect solution.

twinBASIC provides the PictureDpiScaling property to give the developer full control over how images are scaled within a tB application.  

Here's Wayne's explanation:

PictureDpiScaling property allows us to turn off DPI scaling of images so that they display at 1:1 rather than allowing the OS to stretch them.  The idea being that the developer may want to choose a different bitmap manually, rather than apply the somewhat limited OS-stretching.

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 Summary

* Auto-generated via ChatGPT, sorted in order of ChatGPT's opinion of "most impactful changes."

Here is a concise summary of notable updates in twinBASIC, a Beta development programming language:

  • Improved addin extensibility by using shadowDOM to isolate CSS in ToolWindows.
  • Added ToolWindow.ApplyCss method for enhanced customization (samples 13 and 14).
  • Introduced support for 'listview' and 'virtuallistview' elements with virtual list view implementation for improved UI performance (samples 13 and 14).
  • Fixed clipboard issues during cut/copy in the IDE.
  • Resolved intellisense problems related to variable initializers in specific scenarios.
  • Addressed issues with Static fixed-length array bounds evaluation in class modules.
  • Fixed intellisense not displaying for qualified enumerations declared as Private.

These updates aim to enhance the development experience and compatibility while integrating modern programming concepts into twinBASIC.


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

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

BETA 384

  • improved: (addin extensibility) Addin ToolWindows now use shadowDOM to isolate CSS
  • added: (addin extensibility) ToolWindow.ApplyCss method (see samples 13 and 14)
  • added: (addin extensibility) support for 'listview' and 'virtuallistview' elements that are backed by a virtual list view implementation for UI performance (see samples 13 and 14)

BETA 385

  • fixed: (IDE) cut/copy no longer empties the clipboard if there is no selection in the editor [ https://github.com//issues/1675 ]
  • fixed: (IDE) incorrect intellisense in some scenarios involving variable initializers [ https://github.com//issues/1672 ]
  • fixed: issue with Static fixed-length array bound evaluation in class modules [ https://github.com//issues/1668 ]
  • fixed: (IDE) intellisense not showing for qualified enumerations when the enumeration is declared Private
  • fixed: form/UC/PictureBox Scale property was not correctly updating internal cached values [ https://github.com//issues/1666 ]

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