twinBASIC Update: May 29, 2024

Highlights include a new ImageList control, Opacity and TransparencyKey properties, and a new Sample Project demonstrating these added features.

twinBASIC Update: May 29, 2024

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 Monday (and occasionally on some Wednesdays, apparently), 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, please leave a comment below.

Here are some links to get involved with the project:


Highlights

ImageList Control Released

From Wayne via Discord:

We now have an ImageList control, as of BETA 539, plus the necessary adjustments to TreeView and ListView to support it.   I've included PNG transparency support for the ImageList (which works will all ColorDepths, though 32-bit is advised and the default).
And with BETA 540, you've now got an experimental RenderPictureAsIcon property for PictureBox/Image that should allow transparent PNGs (and possibly 32-bit bitmaps) to render properly once you've turned it on

In response to Wayne's follow-up comment, GCUser99 asked about the possibility of adding the RenderPictureAsIcon property to "other controls that take Picture inputs such as CommandButton and CheckBox."

Wayne replied as follows:

Here's how to convert a general picture into an icon picture, if you want to try it out in other contexts:

Dim picWidth As Long
Dim picHeight As Long
VB.ScaleOLEPictureDimensionsToPixels(vbPicTypeNone, inPicture.Width, picWidth, inPicture.Height, picHeight)
Dim outPicture As StdPicture = RuntimeCreateScaledPicture(inPicture, picWidth, picHeight, True, True)

Let me know your findings.
(the pic width/height are passed because the function is designed to do scaling for a particular icon size, but you can pass in the original width/height as above to perform without scaling)

Opacity and TransparencyKey Properties

From Wayne:

In BETA 543, all child controls now have 'Opacity' and 'TransparencyKey' properties (as Form already had).  These features are only effective when targetting OS 6.2 (Win8+), and so you need to set the target OS appropriately in the project settings.    Additionally, as the compiler background services (inc debugger) currently targets OS 5.1 (WinXP+), the properties will not be effective until you build the EXE.

New Sample Project: TreeView + ListView + ImageList

BETA 539 came with a new Sample Project, Sample 20, that demonstrates how to incorporate the new ImageList control into the existing TreeView and ListView controls:

Discord Chat Summary

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

Weekly Update on twinBASIC Development (May 18 - May 24, 2024)

This week in the twinBASIC Discord server, the general channel saw a variety of discussions ranging from new feature implementations to bug fixes and future directions for the language. Below are the key points summarized from the last seven days:

  • Printer Object Implementation:

    • ucPrinterComboEx: A user inquired about this control, which is used for selecting a printer and getting additional info, but not for managing print jobs.
    • BSPrinter: Eduardo's work on BSPrinter was highlighted as a significant contribution, making the implementation of the Printer object easier.
  • ImageList Control:

    • Release: Wayne announced that the ImageList control is nearly ready, with adjustments to TreeView and ListView to support it.
    • PNG Transparency: The new control includes PNG transparency support, recommended at 32-bit color depth.
  • 64-bit Compilation:

    • VB6 to 64-bit: Discussions clarified that twinBASIC can upgrade VB6 code to 64-bit, but VB.NET is incompatible and requires rewriting.
    • API Modifications: Users were advised on modifying external API calls for 64-bit compatibility using LongPtr and PtrSafe.
  • TabIndex Property:

    • Setting TabIndex: Users discussed the need for an easier way to set TabIndex values at design time. An add-in for this purpose is in development.
  • UTF-8 File Handling:

    • Encoding Option: An encoding option for the Open statement was discussed, allowing files to be read in UTF-8. This feature is experimental.
  • RenderPictureAsIcon Property:

    • Transparency: An experimental property was introduced to allow transparent PNGs to render properly in PictureBox/Image controls.
  • Bug Fixes and Known Issues:

    • Mouse Event Signatures: Known issues with method signatures for mouse events were acknowledged, with fixes expected next week.
    • StdPicture Rendering: Issues with StdPicture rendering 32-bpp icons were discussed, with a fix implemented in BETA 541.
  • New Attributes in Custom AX Development:

    • Internal Use: New attributes like [CustomDesigner] and [Serialize] were found in the ImageList control source code, though they are currently for internal use only.
  • Community Engagement:

    • Bus-Factor Concerns: Wayne humorously addressed concerns about the project's continuity if something were to happen to him, indicating a growing interest and investment in twinBASIC's future.

Conclusion

This week’s discussions highlighted significant progress in twinBASIC's development, including the near completion of the ImageList control, enhancements in 64-bit compilation support, and new experimental features like UTF-8 file handling and transparency rendering. The community continues to be actively engaged, providing feedback and suggestions that drive the project forward. With ongoing bug fixes and feature implementations, twinBASIC is steadily evolving to meet the needs of its users.

Around the Web

Video Thumbnails Project

From fafalone in the show-and-tell Discord channel:

I've posted a port of a project by VBF user -Franky- that shows a video and lets you seek to any time in the video to make a thumbnail of that point, instead of just the first frame like normal thumbnail generators. It's been converted to use my WinDevLib project for the interfaces instead of DispCallFunc calls, which IMO results in much more readable and maintainable source (not to mention, a tB bug prevents the original from working right now). The original Invoke lines are left in as comments to show how it's easily to simplify them into normal interface calls. And of course, I've made it 64bit compatible.
GitHub - fafalone/VideoThumbnails: Using Media Foundation and GDI+ to create a thumbnail of any point of a video
Using Media Foundation and GDI+ to create a thumbnail of any point of a video - fafalone/VideoThumbnails

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: Introduced the ImageList native control within the WinNativeCommonControls package, featuring PNG transparency support. This enhancement is pivotal for modern UI development.
  • Improved: ListView and TreeView controls can now be seamlessly associated with ImageList controls, enhancing their functionality and visual appeal.
  • Improved: All windowed controls now include 'Opacity' and 'TransparencyKey' properties, enabling better visual customization, though these properties are only effective in compiled files and require Windows 8 or higher.
  • Improved: Transitioned from using IPicture.Render to DrawIconEx for rendering icons, leading to better performance and consistency across the codebase.
  • Improved: Global.LoadPicture now supports 32-bit BMPs, expanding the range of image formats that can be utilized.
  • Added: Provided a new sample (Sample 20) showcasing the integration of TreeView, ListView, and ImageList controls, aiding developers in understanding and utilizing these features.

WARNING: The following issues are present in BETA builds 424 - 545 (the latest build as of publication):

BETA 539

  • added: ImageList native control, in WinNativeCommonControls package (inc PNG transparency support)
  • improved: ListView/TreeView can now be associated with ImageList controls
  • added: Sample 20.  TreeView + ListView + ImageList example (WIP)

BETA 540

  • fixed: minor bug in ImageList transparency algo for 32-bit RGBA rendering, causing slight ghosting in fully transparent areas
  • added: RenderPictureAsIcon boolean property for Form/PictureBox/Image controls, to allow for PNG transparency (experimental)

BETA 541

  • improved: avoiding IPicture.Render for icons throughout the tB codebase, using DrawIconEx instead [ wqweto, discord ]

BETA 542

  • improved: Global.LoadPicture now supports 32-bit BMPs
  • removed: RenderPictureAsIcon experimental property.  no longer needed - changed method for rendering StdPicture bitmaps instead [ Krool, discord ]

BETA 543

  • improved: all windowed controls now offer 'Opacity' and 'TransparencyKey' properties.  Requires project target OS of 6.2+ (Win8+).  Only effective in compiled files, not running in the IDE.

BETA 544

  • fixed: (regression) unable to load some bitmaps and jpgs

BETA 545

  • fixed: Form_Initialize event now allows for form-loading to occur within it, e.g. by touching a control property.  [ Tecman, discord (Combobox issue)]
  • fixed: (regression) project 'Add ' menu could fail to open in some instances [ fafalone, discord ]
  • fixed: cached font metrics problems affecting TextWidth/TextHeight properties [ vbuser, discord ]
  • fixed: project meta data could be sometimes be lost, causing things like open editors to not re-open automatically when opening a project [ fafalone, discord ]

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