r/nim • u/Vyrnexis • 1d ago
nimvcl + NimRAD: a Delphi VCL-style GUI library for Nim and a Delphi 7-like RAD IDE built on it
Hi,
I've been working on two related projects and they're now at a point where I'd love feedback from other Nim users.
nimvcl: a Delphi VCL-style GUI library, drawn with SDL3
https://github.com/Vyrnexis/nimvcl
If you ever used Delphi or Lazarus, this should feel familiar: forms, align and anchors, onClick events, actions, menus, and a form macro the compiler checks, like a .dfm.
import nimvcl
form MainForm:
caption = "Demo"; width = 400; height = 300
Button okBtn:
caption = "&OK"; align = alBottom
onClick = proc(sender: Control) = showMessage("Hello")
when isMainModule:
Application.run(newMainForm())Some of what's in it:
- Controls: about 30 of them. That covers the usual ones plus ListView, TreeView, StringGrid, PageControl, a virtual ListView that handles 100k+ rows, FlowPanel/GridPanel, PaintBox and Frames.
- Code editor: a
CodeEditcontrol with Nim highlighting, folding, bookmarks, and find and replace. It opens a 100 MB file in about a second. - Docking: split, tabbed and floating panels, with save and load of layouts.
- Actions:
ActionList/Action, so one command drives menu items, toolbar buttons and shortcuts. - Look: light and dark themes, HiDPI and fractional scaling. Noto fonts are embedded, so apps need no font files.
- Form files:
.nfmtext forms thatloadFormturns into a typed form at compile time, with form inheritance like Delphi's. - Tooling for IDEs: a property registry (nimvcl's RTTI), an
ObjectInspectorand aFormDesignerwith undo. That's what made the IDE below possible.
NimRAD: a Delphi 7-like RAD IDE for Nim
https://github.com/Vyrnexis/NimRAD
NimRAD is the old Delphi workflow, but for Nim:
- Drop components from a palette.
- Set properties in the Object Inspector.
- Double-click a button to get its handler.
- Press F9 to build and run.
Forms are saved as plain-text .nfm files that nimvcl loads at compile time, so the finished program carries no designer runtime.
- Form designer: grid and guide lines, an Object TreeView, palette search (Ctrl+Alt+C), and property editors for pictures, image lists, string lists, collections, menus and more.
- Visual form inheritance: a descendant form stores only its differences, changed properties show in bold, and Revert to Inherited works like in Delphi.
- Builds in the background: errors go to a Messages panel, F8 jumps to the next one, and program output shows up live. Quick fixes (Ctrl+.) add a missing import or fix the case of a name.
- Fast compiles: each form unit imports only the modules of the controls it uses, not all of nimvcl.
- Code editor: F12 switches between form and code, with code insight and bookmarks.
- Workspace: docking panels, a project manager, and light and dark themes.
Screenshots are in both READMEs.
Status
- Versions: nimvcl is 0.4.0 and NimRAD is 0.2.1. Expect API changes before 1.0.
- Platforms: Linux is the main platform. Windows and macOS build and pass CI, but count as experimental.
- Requirements: Nim 2.2+ and SDL3, SDL3_ttf and SDL3_image.
nimble install https://github.com/Vyrnexis/NimRAD
nimradThere's a tutorial that builds a small app from scratch.
I'd really appreciate bug reports, especially from Windows and macOS users, and ideas about what you'd want from a RAD tool for Nim. Issues and PRs are welcome on either repo.
Thanks for reading