Modern BBj for New Code
Rule
For new development, prefer the BBjAPI object model --
BBjAPI(), setCallback() handlers, and
PROCESS_EVENTS -- over the older SENDMSG/mnemonic style
driven by a READ RECORD event loop. For new client-facing UI work,
target DWC (Dynamic Web Client) rather than the older CUI, SysGui desktop GUI, or
BUI clients. PRO/5-style code remains fully valid: BBj is a superset of PRO/5 and
runs everything PRO/5 ran, so this is a recommendation for what to write next, not a
deprecation of what already exists.
Why
The callback style registers a handler per event type and control, which
keeps event-handling code colocated with the control it affects; a
READ RECORD loop instead forces one big dispatch loop that manually
decodes EVENT.CODE$ values. DWC needs no JVM on the end-user machine,
loads incrementally instead of in bulk, supports responsive CSS layouts and theming,
and integrates third-party web components -- BUI exists mainly to migrate legacy GUI
applications to the browser with minimal change, which is a different goal from what
a new project needs.
Edge
This is a recommendation for new code, not a deprecation: PRO/5-style
READ RECORD event loops, the standalone CALLBACK verb, and
the CUI/SysGui/BUI clients remain fully documented and fully valid. When maintaining
an existing program, keep its existing event style rather than converting it (see
One Event Style Per Program) -- this
rule is about which style a genuinely new program should choose, not about rewriting
working code.
Evidence
PROCESS_EVENTS Verb -- the callback-plus-PROCESS_EVENTS recommendation for new code.
BBjControl.setCallback() -- registering a handler on the control that raises the event.
CALLBACK Verb -- the older, standalone registration form kept for existing programs.
DWC Overview -- why DWC is the forward client for new work.
Owner verdict: BBjAPI with PROCESS_EVENTS/callbacks over
SENDMSG, mnemonics and READ RECORD loops; DWC over CUI, GUI/SysGui and
BUI for new client-facing work.
Example
BBjAPI() is the single entry point for constructing BBj-native objects:
rem 'Obtain the instance of the BBjAPI object declare BBjAPI BBjAPI! BBjAPI! = BBjAPI()