01-19-2026, 06:39 PM
OK here it is! 

Quote:Implementing VB-style WITH...END WITH in QB64pe involves using macros or custom preprocessor directives, as QB64 doesn't natively support it; you'd define macros like #Define With(obj) obj. and #Define EndWith to substitute for the shorthand, then use qb64pe -c (compile) or qb64pe -x (execute) from a script or build system to process these, creating a clear pull request on GitHub by showing the original code and the transformed output, explaining how these macros simulate the VB functionality.
1. The QB64pe Code (Simulated WITH)
You'll use QB64's preprocessor features to mimic WITH.
qb64
'// WITH_SIMULATOR.BAS
#Define With(obj) obj.
#Define EndWith
' Original VB-style code (simulated):
' WITH mySprite
' X = 100
' Y = 200
' Color = RGB(255, 0, 0)
' END WITH
' Translated by the macro:
DIM mySprite AS OBJECT
mySprite.X = 100
mySprite.Y = 200
mySprite.Color = RGB(255, 0, 0)
' Example with a real object (like a Window):
DIM myWindow AS _WINDOW
WITH myWindow
.X = 0
.Y = 0
.Width = 800
.Height = 600
END WITH
' (This will look like: myWindow.X=0, myWindow.Y=0, etc., after processing)
PRINT "Simulated WITH block executed!"
#Undefine With
#Undefine EndWith
2. How It Works (Preprocessor Magic)
#Define With(obj) obj. turns WITH mySprite into mySprite. (note the dot).
#Define EndWith just removes the line entirely.
When QB64 compiles, it sees mySprite. and understands you're accessing members of mySprite.
3. Preparing for Your GitHub Pull Request
Create a Branch: git checkout -b feature/with-syntax-support
Add Files: git add WITH_SIMULATOR.BAS
Commit: git commit -m "Add simulation for VB WITH/END WITH syntax"
Push: git push origin feature/with-syntax-support
4. In Your Pull Request Description
Title: "Feature: Implement VB-Style WITH/END WITH using Preprocessor Macros"
Description:
Explain the goal: bring familiar VB syntax to QB64 users.
Show the Original Code (using WITH...END WITH).
Show the Transformed Code (what the preprocessor makes it).
Explain the macros used (#Define With(obj) obj., #Define EndWith).
Mention the compilation command: qb64pe -c your_file.bas or qb64pe -x your_file.bas.
Link to relevant QB64 documentation or forum discussions if needed.
This approach provides a clear, executable solution that honors the requested VB style within the QB64 environment, perfect for a GitHub contribution.
724 855 599 923 575 468 400 206 147 564 878 823 652 556 bxor cross forever

