twinBASIC Update: April 21, 2024

Highlights include word wrap toggling, twinBASIC returns to Vienna, a WinDevLib quick start guide, and a major milestone as twinBASIC now runs PhotoDemon!

twinBASIC Update: April 21, 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, 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

Toggle Word Wrap Command Added

The IDE now has commands for enabling, disabling, or toggling Word Wrap when writing code.

The default shortcut key to toggle word wrap is [Alt] + [Z].

ActiveX and User Control Improvements

Detailed work continues on improving ActiveX and User Control functionality.

These sorts of incremental improvements can make it difficult for outside observers to see tangible progress on the project.  However, the steady accumulation of improvements can occasionally lead to monumental breakthroughs.  (← In the literary world, we call this "foreshadowing."  Keep reading...)

12-Month RoadMap Update

If you've been following the project closely the past few months, it should come as little surprise that the official v1 launch date was moved back 3 months from July 1 to October 1, 2024.  Wayne ran into some unexpectedly thorny issues with ActiveX and UserControl support recently.  The result is the entire roadmap got pushed back about three months.  Check out the current roadmap here:

twinBASIC 12-MONTH ROADMAP · Issue #335 · twinbasic/twinbasic
twinBASIC ROADMAP Dates given are tentative and subject to change. Only the major issues are listed here. Smaller feature requests will be implemented when most appropriate (usually when we are alr...

Discord Chat Summary

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

Here is a summary of the General channel transcript:

twinBASIC Weekly Development Update

This past week, the twinBASIC Discord server saw a lot of activity and progress on the development of this new BASIC programming language. Here are some of the key highlights from the conversations:

  • The upcoming release of twinBASIC is getting very close, with the popular open source VB6 application PhotoDemon now able to run under the twinBASIC IDE. While there are still a few issues to work out, most basic functionality seems to be working well.

  • Importing VB6 projects into twinBASIC was a common topic. Forms need to be imported as part of a .vbp project file. There was also a bug identified and reported where having a command button named "Refresh" caused compile errors.

  • The old VB6 GoSub/Return syntax is supported in twinBASIC for compatibility. There was discussion on the challenges of also supporting a new Return x function syntax without breaking GoSub functionality.

  • Questions arose on how to properly change GUIDs when updating an ActiveX control to be seen as an entirely new control that doesn't conflict with previous versions. Changing the ClassId, InterfaceId and EventInterfaceId is recommended.

  • Compiling the open source VB6 app PhotoDemon as a 64-bit app in twinBASIC would be a major undertaking, requiring not just VB code changes but also compiling 64-bit versions of all the C/C++ DLLs it depends on. But it could be a great way to promote twinBASIC if achieved before the v1 release.

  • ListView and ImageList controls are slated to be fully supported by the twinBASIC v1 release, though no specific timeline was given.

In summary, twinBASIC made exciting strides this week with the ability to run a substantial real-world VB6 app in PhotoDemon. While more work remains to fully support it, especially in 64-bit, this is a major milestone. Importing VB6 projects and maintaining backward compatibility while adding new language features continues to be an ongoing focus. Overall, twinBASIC feels tantalizingly close to a very functional initial release that will start to realize its full potential.


Here is a summary of the key points from the Addins channel transcript:

twinBASIC Weekly Addins Development Update

This week, the twinBASIC addins channel on Discord focused on discussing workflows for developing addins and some potential instabilities in the CodeEditor class. Here's a summary of the key points:

  • The recommended workflow for editing a twinBASIC addin project is:

    1. Make and save changes to the addin code
    2. Restart the twinBASIC compiler while holding down the Shift key to unload the addin
    3. Compile the updated addin
    4. If needed, press and release Shift key to clear any false detection of Shift being pressed
    5. Restart the compiler normally (without Shift) to reload the updated addin
  • This avoids having to completely exit and relaunch twinBASIC each time you want to test an addin change. In previous betas, holding Shift while opening a project would also prevent loading addins.

  • There was a discussion about potential instabilities in the SetSelectionInfo method of the CodeEditor class. One user reported the method sometimes selects the target and other times selects end-of-file in a seemingly random way.

    • However, another user noted they are using this method in their "String Converter" addin without issue so far.
    • The original reporter plans to create a minimal reproduction project to help isolate the issue.

In summary, the twinBASIC addin development experience continues to be refined, with a streamlined workflow now available to quickly iterate on addin changes. The community is also actively testing the addin API and reporting any potential issues to help improve stability and reliability. Overall, addin development looks to be progressing smoothly as twinBASIC nears its v1 release.

Around the Web

PhotoDemon Now Runs in twinBASIC

From Wayne Phillips:

As noted earlier today, with BETA 515 it should now be possible to get the popular VB6 open source project, PhotoDemon, to actually run with twinBASIC. Some quick notes:

  • after importing the VBP, immediately save the twinproj to the same folder as the VBP file!
  • compiled EXE not working. only working under the IDE debugger presently
  • currently you MUST turn on LargeAddressAware for the IDE (Tools > IDE options)
    (on that note - just opening the project in tB is consuming 1.6GB by the compiler, hence the need for LAA)
  • editing anything in the project is currently causing a restart of the compiler. you will need to shift to 'Safe Mode' to do edits.
  • obviously make sure you're testing in Win32, as Win64 is most definitely not going to work
  • if you start hitting problems, close everything down and delete the Data folder that gets created alongside the twinproj file


    Looks like compiled EXE is actually working, but you may need to delete the Data folder before running it to start afresh, and make sure the EXE is in the same folder as the VBP/twinproj

What Does This Mean for twinBASIC?

I'm not personally familiar with PhotoDemon, so I asked Claude-3-Opus an (admittedly-leading) question about it:


[Mike]: Tell me about the PhotoDemon project.  Why is it such a big deal that a new programming language (whose primary goal is to maintain 100% backward compatibility with VB6) can compile and run this program?

[Claude-3-Opus]: PhotoDemon is a popular open source photo editor written in VB6. It's a substantial, real-world application with over 50,000 lines of code that utilizes many VB6 features and relies on several external DLLs and components.

The fact that twinBASIC, a new programming language still in development, is able to compile and run PhotoDemon is a significant milestone for several reasons:

  1. Compatibility: One of twinBASIC's primary goals is to maintain near 100% compatibility with VB6 code. Successfully running PhotoDemon demonstrates that twinBASIC is delivering on this promise and can handle complex, real-world VB6 applications, not just toy programs.

  2. Language Maturity: PhotoDemon exercises a wide range of VB6 language features and programming patterns. Being able to compile it suggests twinBASIC's implementation of the VB6 language is nearing completion and is robust enough for serious use.

  3. Ecosystem Compatibility: PhotoDemon relies on several external DLLs and components. Compiling it successfully in twinBASIC shows that twinBASIC can interface with existing VB6 ecosystem components, which is crucial for adoption.

  4. Performance: As a photo editing application, PhotoDemon has higher performance requirements than typical business apps. Running well in twinBASIC suggests that twinBASIC's compiler generates efficient code on par with VB6.

  5. Confidence Booster: For VB6 developers considering twinBASIC, seeing a well-known application like PhotoDemon run in twinBASIC gives them confidence that their own applications can likely be ported successfully with minimal changes.

While there is still work to be done, especially to support 64-bit compilation of PhotoDemon, this milestone demonstrates twinBASIC is well on its way to being a practical, production-ready successor to VB6. It's a major proof point for the project and a compelling reason for VB6 developers to start considering twinBASIC for their own projects.


WinDevLib Intro

I finally took the time to try out fafalone's excellent Windows Development Library twinPACK package.  It's pretty mind-blowing.  If you haven't tried it yet, I suggest you do.  

If you're not sure how to start, here's a quick guide I put together:

WinDevLib: A Better Way to Call Windows API Functions in twinBASIC
Stop struggling to declare your Windows API calls in twinBASIC. Use the Windows Development Library twinPACK and let fafalone do all the hard work for you.

twinBASIC Returns for Fourth Annual Access DevCon

This past week, I had the honor of presenting my annual update on twinBASIC to the largest Microsoft Access conference in the world, Access DevCon Vienna:

DevCon 2024: VBIDE Addin Creation with twinBASIC
Links and resources from my talk today at Access DevCon Vienna 2024, Custom VBIDE Addin Creation with twinBASIC.

In the past, conference organizer Karl Donaubauer has made the recording available for free to the public.  If that happens again, I'll be sure to post a link to the video in this weekly update, as well as in the article linked above.

Each year, I get feedback from some attendees who ask why there's a twinBASIC presentation at an Access conference.  Based on that feedback, I asked Karl whether he would prefer I present on a different topic.  He acknowledged that some people have raised the same objection to him over the years.  

However, he also said that he has people who register for the conference just so they can attend the twinBASIC presentation.  I take that as a good sign for twinBASIC.

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 IDE Enhancements: New addin extensibility features include Host.Themes.ActiveThemeName and Host.OnChangedTheme event, enhancing theme customization and interaction.
  • Improved ActiveX Controls: Enhancements in IViewObject::Draw for ActiveX controls support controls created with the CreateWindow API, improving integration and visual rendering.
  • Fixed Form and Control Issues: Various fixes address issues with UserControl redrawing, form loading, and event timing, enhancing stability and compatibility with VB6 behaviors.
  • Enhanced Debugging Tools: Introduced a build error notification in the DEBUG CONSOLE for incorrect manifest file entries, preventing launch issues with built executables.
  • Added IDE Commands: New commands for toggling word wrap in the IDE editor, improving the editing experience.
  • Updated Project Settings: Added an option for Buffered Trace Log File Writing in the Compilation: Trace Flags, optimizing performance during extended debugging sessions.
  • Compatibility Adjustments: Addressed multiple UserControl and ActiveX control sizing and rendering issues, aligning behavior more closely with traditional VB6 expectations.

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

BETA 505

  • fixed: focus/unfocus of child overlapping controls on a UC would not cause the UC to redraw properly [ commissioned work ]
  • fixed: Form_Load and ActiveX unfreezing of events timing problem [ commissioned work ]
  • added: build error in DEBUG CONSOLE if the manifest file contains incorrect processorArchitecture value for the current build which would prevent built executables from launching [ commissioned work ]
  • fixed: if the focused control is programmatically disabled, the focus automatically moves to the next control [ commissioned work ]
  • fixed: IDE command 'tbDebug_RunOrPreview' not working when form designer is active
  • added: (addin extensibility) Host.Themes.ActiveThemeName string property, e.g. "light" / "dark" [ sokinkeso, discord ]
  • added: (addin extensibility) Host.OnChangedTheme event
  • WARNING: IDE Addins compiled in BETA 505+ will require BETA 505+ to run

BETA 506

  • fixed: hover-info box whilst debugging could truncate the information being displayed
  • fixed: Form.Moveable property was not matching behaviours of VBx [ https://github.com//issues/1828 ]
  • fixed: creating a new control in the form designer, starting at an existing control anchor point could corrupt the form design [ fafalone, discord ]
  • fixed: (regression) Escape key does not unselect a toolbox item in the form designer

BETA 507

  • fixed: edge case around resizing of lightweight controls and WM_SETCURSOR timing [ https://github.com//issues/1829 ]
  • fixed: (regression since BETA 424) issue with runtime creation of control array elements [ https://github.com//issues/1826 ]

BETA 508

  • fixed: some UserControl sizing irregularities [ commissioned work ]
  • fixed: HDC/HWND properties were being copied over to new control array elements, causing rendering problems [ https://github.com//issues/1826 ]
  • (regression since BETA 424) runtime added control array elements events not firing [ https://github.com//issues/1826 ]

BETA 509

  • fixed: spurious debug messages in DEBUG CONSOLE from mousemove internal tests [ https://github.com//issues/1826#issuecomment-2059231635 ]

BETA 510

  • fixed: runtime added control array elements events double-firing [ https://github.com//issues/1826#issuecomment-2059231635 ]
  • fixed: An empty caption on a form alongside ControlBox=False would show a titlebar, unlike VB6 [ https://github.com//issues/1830 ]

BETA 511

  • fixed: overlapping UCs/AX controls in tB forms could have render issues after resize
  • fixed: UserControl keyboard focusing issues [ commissioned work ]
  • added: option Buffered Trace Log File Writing to Compilation: Trace Flags in project settings

BETA 512

  • fixed: potential crash when drawing some tb-generated AX controls from some hosts [ fafalone, discord ]

BETA 513

  • improved: ActiveX IViewObject::Draw implementation now supporting controls created manually with CreateWindow API [ fafalone, discord ]
  • fixed: UserControl.ContainerHwnd implementation would sometimes throw an error [ fafalone, discord ]

BETA 514

  • added: IDE commands tbEditor_ToggleWordWrap (ALT+Z), tbEditor_TurnWordWrapOff, tbEditor_TurnWordWrapOn [ Tecman, discord ]
  • fixed: WinNativeCommonCtls.ListView click outside of items area should not deselect selected item [ sokinkeso, discord ]
  • fixed: WinNativeCommonCtls.ListView click outside of items area should generate Click event [ sokinkeso, discord ]

BETA 515

  • fixed: copying a ParamArray to a standard Variant array would not make indirect copies of VT_BYREF args
  • fixed: UserControl class was declared as non-extensible, wrongly disallowing code such as Me.UserControl.myControl to refer to controls on the UC
  • fixed: some Menu control array problems, required rewrite of menu building implementation

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