The launcher, startup and the toolbar

What the component installs in your project, and how to turn on what it leaves switched off: the launcher, the lines added to your database methods, and the 4D toolbar.

The launcher

The method _BSPK_LAUNCH opens the component's launcher (it was called BSPK_LAUNCH before version 21). Its buttons:

ButtonOpens
Open the ATLThe ATL data explorer
Execute methodThe dialog that runs a method, locally or on the server
Execute codeThe dialog to type and run 4D code
Open the JSON object editorThe JSON object editor
BWEBThe installation panel: licence, then Start the installation
Test BWEBThe browser on https://<your domain>/bweb

What the installation does

The wizard refuses to run if the project is compiled or not opened locally. It then goes through:

  1. The environment: Node.js and npm (installed if missing), the libraries, the style sheet build, the web server settings and the SSL certificates.
  2. The files and methods copied into the project, and the lines added to the database methods (see below), then the BSPK_* tables. 4D restarts.
  3. The relations and indexes. 4D restarts a second time.
  4. The end: the component's version record, the scheduled task that keeps the content exchange snapshot up to date (on a development machine), history archiving, the DEV user, the first domain and the starting point of content reconciliation.

To survive its own restarts, the installation writes a Resources/INSTALL file in your project. While it exists, 4D reopens the launcher at startup to resume the installation, and the toolbar does not open. It is deleted at the last step.

What is copied into your project

Only what is missing: a file that already exists under the same name is never overwritten.

  • The configuration files, in Resources/json: APP_PARAMETERS, DEV_PARAMETERS, PREPROD_PARAMETERS, WEB_PARAMETERS, Modul_menus (the toolbar menus) and MODULE_GENE.
  • The BSPH_* methods: the entry points through which the component calls your code (BSPH_WEB_ON_CONNECTION, BSPH_VERSION_UPDATES, BSPH_EXECUTE_METHOD…). Do not delete them.
  • The BSPKFormController class.

A fresh installation starts in DEV mode: the DEV_PARAMETERS template is among the copied files. On a production server, delete DEV_PARAMETERS and PREPROD_PARAMETERS. See Parameter files.

Every component update runs this copy again: a new version adds the methods and templates it introduces, without touching yours.

The lines added to your database methods

Each line is added only if its text is not already in the method.

On Startup and On Server Startup

//BSPK_CONFIRM_STARTUP_MODE                      // commented
BSPK_STARTUP                                     // active
//BSPK_LOGIN_ON_STARTUP                          // commented
//cs.bspkComponent.ToolBar_FC.new().start()      // commented
Use (Storage)                                    // active block
var $vo_storage : Object
$vo_storage:=BSPK_Storage
Storage.vo_Param:=OB Copy($vo_storage.vo_Param; ck shared)
Storage.vo_SharedStorage:=OB Copy($vo_storage.vo_SharedStorage; ck shared)
End use
LineRole
BSPK_CONFIRM_STARTUP_MODEShows "4D is about to start in mode X, continue?" at startup, the mode being deduced from the parameter files present. Accepted automatically after 60 seconds; closing the window quits 4D. Useful on a server hosting both a development and a production copy.
BSPK_STARTUPThe component's startup: checks that APP_PARAMETERS exists, loads the parameters, runs pending updates, starts the web server, the WebSocket and the scheduled tasks as the parameters say.
BSPK_LOGIN_ON_STARTUPShows the component's 4D login form. In DEV mode, the DEV user is logged in automatically (hold Shift to force the form). On 4D Server, no form.
ToolBar_FC…start()The toolbar, below.
Use (Storage) blockYour project has its own Storage, separate from the component's. This block copies vo_Param (the parameters) and vo_SharedStorage into it. It is a copy taken at startup: a value changed later on the component side is not reflected.

On Web Connection

If the method does not already call the component, its existing code is commented out (/* … */), then the call to BSPK_WEB_ON_CONNECTION is added. Your web code then goes through the BSPH_WEB_ON_CONNECTION method.

#DECLARE($vt_1 : Text; $vt_2 : Text; $vt_3 : Text; $vt_4 : Text; $vt_5 : Text; $vt_6 : Text)
BSPK_WEB_ON_CONNECTION($vt_1; {vo_Session: Session; vt_HTTP_Header: $vt_2; vt_Browser_IP: $vt_3; vt_Server_IP: $vt_4; vt_User_Name: $vt_5; vt_Password: $vt_6})

On Exit and On Server Shutdown

BSPK_QUIT: stops Node.js and the scheduled tasks, then quits 4D.

The toolbar

Turning it on

Remove the // in front of cs.bspkComponent.ToolBar_FC.new().start() in On Startup, after BSPK_STARTUP. It is an interface window (toolbar type): the line written in On Server Startup is useless on a server without a screen. Logging in (BSPK_LOGIN_ON_STARTUP) is not required, but without it the user's rights and preferences do not apply to the buttons.

The toolbar does not open during an installation (INSTALL file present), nor when there is no button to show: 4D's standard toolbar then stays in place.

Where the buttons come from

  • The main buttons, on the left: the ToolBar key of the Modul_menus file.
  • The developer buttons, on the right: the component's ToolBarDev file, shown in DEV mode, when the component is opened on its own, or for the DEV user. In DEV mode, a pattern in the window background marks the mode.

These files are read in the component and in your project: when both exist, their merge is shown, your project winning.

One entry

KeyRole
vt_ActionWhat the click runs (see below). An entry with neither vt_Action nor vo_SubMenu is ignored.
vo_SubMenuA pop-up menu instead: items {vt_Xliff, vt_Action, vt_Right}, or "-" for a separator.
vt_Xliff, vt_HelpTipLabel and tooltip: a translation key, or plain text.
vt_PictureNameSVG icon, looked up in the project's Resources/images/svg, then the component's.
vt_MenuGroupA change of group inserts a separator.
vt_RightThe right needed to see the button.
vt_VisibleWhenA display condition: notCompiled, compiled, dev, component, componentInterpreted, host, clientServer, standalone, or a 4D expression. A condition that raises an error shows the button. No effect inside a submenu.
visible, enablevisible:false hides the button but keeps its space.
vl_Width (45), vl_Height (50), vl_IconHeightSize.
vo_ShortCut{shortcutKey, shortcutAccel, shortcutControl, shortcutShift, shortcutAlt}

What a click runs

  1. A submenu: the menu is shown, then the chosen action runs.
  2. A component class of that name: cs[vt_Action].new().start().
  3. A method of that name, in the component or in your project: it is executed.
  4. Otherwise vt_Action is executed as a formula, in your project's context as a last resort.

For a button of your own, vt_Action is therefore one of your method names, or a formula such as cs.MyForm_FC.new().start(). The bare name of one of your classes does not work: step 2 looks in the component's classes.

Adding your buttons

Add your entries under ToolBar in your project's Modul_menus file, with the JSON object editor (the file is encrypted). The merge cannot remove a component entry: hide it with visible:false or a false vt_VisibleWhen. Put your icons in Resources/images/svg.

Hiding groups per user

The user's preferences object field (BSPK_USER) can hold vc_ToolBarVisible: [{"GroupName": "<vt_MenuGroup>", "vb_Show": false}] hides a whole group for that user. No screen fills it in: edit the record.

Good to know

  • A commented toolbar line can reappear after a component update, next to the one you activated. It has no effect: leave it commented.
  • If every button is hidden by vt_VisibleWhen conditions only, an empty toolbar window can open.
  • Uninstalling BWEB does not restore On Web Connection: the old code is still there, inside /* … */.

See also