Named blocks

PowerBASIC Forms generated code contains named blocks (#PBFORMS metastatement blocks) to define sections of code that hold special meaning for PowerBASIC Forms, but are ignored by PowerBASIC during compilation. These blocks are marked with the #PBFORMS metastatement and code within these blocks should never be manually edited. Some metastatements contain additional data, which PowerBASIC Forms uses to determine the relationship or link between dialogs and menus, etc.

To ensure that PowerBASIC Forms can reload an existing project from disk, manually added code to the generated code template must not be placed or altered within the #PBFORMS metastatement blocks (named blocks). That is, editing code within the marked blocks may prevent PowerBASIC Forms from reading the source code back into the design environment at a later date.

These named blocks are currently defined as follows:

#PBFORMS CREATED

This marker indicates the file was generated by PowerBASIC Forms, and it must be the very first line in the file and may not be moved or PowerBASIC Forms may not be able to reopen the source code file again.

#PBFORMS BEGIN INCLUDES

The #INCLUDE file block start marker. Code that follows this marker links in all necessary resource (.PBR) and API include files.

#PBFORMS END INCLUDES

Signals the end of the #INCLUDE block. Any code that follows this marker may be manually edited up to the next #PBFORMS metastatement. Add any additional code or #INCLUDE metastatements should be placed after this marker.

#PBFORMS BEGIN CONSTANTS

Signifies the start of the numeric equates that PowerBASIC Forms uses to identify dialogs, controls, menus and accelerator tables. To edit or rename these equates, use the ID Editor.

#PBFORMS END CONSTANTS

Signals the end of the equate definition block.

#PBFORMS DECLARATIONS 

This is a single-line marker is used by PowerBASIC Forms to indicate where to insert new declarations into the file. Manually added declarations should be added after this line.

#PBFORMS BEGIN MENU

The code within the menu block defines and creates a menu, and attaches it to its associated dialog. The association appears with the metastatement in the format %IDR_MENU2 -> %IDD_DIALOG2. Modifications to the menu should only be performed with the Menu Editor.

#PBFORMS END MENU

The end of the menu block.

#PBFORMS BEGIN ASSIGNACCEL

The code within the AssignAccel block defines a helper function that fills an ACCEL structure. This function is used by code in the Accel block to simplify the creation of accelerator tables.

#PBFORMS END ASSIGNACCEL

The end of the AssignAccel block.

#PBFORMS BEGIN ACCEL

This marker defines the start of an accelerator table definition block. This block also attaches the table to its associated dialog. The association between the accelerator table and its menu appears with the metastatement in the format %IDR_ACCELERATOR6 -> %IDD_DIALOG2. Modifications to the accelerator table should be performed only with the Menu Editor.

#PBFORMS END ACCEL

The end of the accelerator block.

#PBFORMS BEGIN DIALOG

This marker occurs within the functions that create and launch a dialog. The identifier for the dialog, and its associated menu and accelerator table are included with the metastatement, in the format %IDD_DIALOG3 -> %IDR_MENU3 -> %IDR_ACCELERATOR3.

#PBFORMS END DIALOG

The end of the dialog definition block.

#PBFORMS COPY

Original (imported) code starts at this point, if any.

 

See Also

Handling new vs. existing files

Saving a project

New PowerBASIC Forms projects

Parent and child dialogs

Opening existing project code

Viewing the project code

Migrating changes

Importing code