How to Create a Hand Coded Project using the IDE?

I have what some call a “Scratch Program” to paste in as a framework for a quick start.

Below is the “lite” one.

Note it begins by calling the MAIN() procedure. One thing I like to do is always write code in a Procedure; otherwise, all the variables are Global / Static and not quite the same as typical.

    PROGRAM  !Scratch Lite program by Carl Barnes - Version 9/1/2022 - Download https://git.io/JtPKE
    INCLUDE('TplEqu.CLW')
    INCLUDE('KeyCodes.CLW')
    MAP
Main        PROCEDURE()
DB          PROCEDURE(STRING DebugMessage)
      MODULE('api')
        OutputDebugString(*CSTRING cMsg),PASCAL,DLL(1),RAW,NAME('OutputDebugStringA')
      END
    END
    CODE
    MAIN()
    RETURN
!----------------------------
Main   PROCEDURE

Window WINDOW('Scratch '),AT(,,400,200),CENTER,GRAY,IMM,SYSTEM,STATUS,FONT('Segoe UI',9),RESIZE
        BUTTON('Button1'),AT(155,180),USE(?Button1)
        BUTTON('Button2'),AT(206,180),USE(?Button2)
    END

    CODE
    OPEN(WINDOW)
    0{PROP:text}=clip(0{PROP:text}) &' - Library ' & system{PROP:LibVersion,2} &'.'& system{PROP:LibVersion,3}
    ACCEPT
        CASE EVENT()
        OF EVENT:OpenWindow 
        OF EVENT:CloseWindow
        OF EVENT:PreAlertKey
        OF EVENT:AlertKey
        OF EVENT:Timer
        END
        CASE ACCEPTED()
!        OF ?Button1
!        OF ?Button2
        END
        CASE FIELD()
!        OF ?Button1
!        OF ?Button2
        END
    END
    CLOSE(WINDOW)
   
!===============================
DB   PROCEDURE(STRING xMessage)
Prfx EQUATE('Scratch: ')
sz   CSTRING(SIZE(Prfx)+SIZE(xMessage)+1),AUTO
  CODE 
  sz  = Prfx & CLIP(xMessage)
  OutputDebugString( sz )

Below GIST link has a few more Scratch Programs. Like one with a LIST on the Window because sometimes you want to test some LIST code. Its a File:Queue loaded from a Directory() of the Windows Temp folder so it has data.


There’s also these scratch programs for writing Reports


There’s this one for generating a quick Scratch Program to write and test StringTheory code:

6 Likes