gbDesigner - Online Help

This page provides the latest online Help information for gbDesigner, a freeware visual designer for PowerBASIC programmers.

For easier browsing, I've put the entire Help content into this single page. That makes for a long page, but I find that it supports searching and browsing more conveniently than moving between multiple web pages.

Key Features

Overview
gbDesigner provides the tools for creating a dialog that contains any of the controls supported by PowerBASIC. Control creation is accomplished by drawing the control with the mouse.

gbDesigner also generates the source code necessary to recreate the dialog. The code can be placed on the clipboard, saved to a file, or directly inserted into your default *.bas file editor (such as the PowerBASIC IDE).

gbDesigner's simplest interface contains nothing but the caption and the drawing area. The user draws controls on the dialog using a mouse, with context menu options available to provide various tools, features, and settings.

However, there are additional GUI elements which provide the user with additional capabilities. The full list of gbDesigner GUI elements, and their usage, are:

The following image shows gbDesigner with the toolbar and CodeBox visible. Display of the toolbar and CodeBox is optional.

This next image shows that a floating toolbar may be used instead of the top-of-dialog toolbar. Or, the user can choose to use a floating toolbar.

Installation

To install gbDesigner, simply unzip the installation file (gbDesigner.zip) in a folder of your choice. In addition to the EXE, the installation provides gbDesigner source code, resource file, and image files.

Drawing Concepts

gbDesigner consists of two primary dialogs. The main dialog contains the caption, toolbar, and CodeBox.

The second (overlay) dialog is positioned directly over, and sized to match, the client area of the main dialog. When drawing actions take place (draw/drag/resize) rectangles of 4 types are drawn on the overlay dialog. Following a drawing action, controls are created/modified and placed directly on the client area of the main dialog.

The following image shows the concept (sorry for the hand-drawn image - working on something better):

The drawing actions create one of the following rectangle types, drawn on the surface of the overlay dialog.

Controls which are created or modified as a result of drawing actions are placed on the main dialog - beneath the overlay dialog.

The overlay dialog is partially transparent, allowing the controls to be seen.

File Commands

In general, gbDesigner was written to allow a user to design a dialog and transfer the results to a source code editor. However, a dialog design can also be saved to a file for subsequent editing.

gbDesigner files use a custom binary format with an extension of *.gbd. See the section below on Programmer Information for more details.

The file commands, listed next, are available from the toolbars and from the drawing area context menu.

An additional command, Restore, is available from the context menu. It re-reads the current file and discards all changes made since the file was opened.

gbDesigner can be set to automatically save the current design on exit.

CodeBox Window


The CodeBox is a fixed height textbox which lists the source code corresponding to the design in work. It is updated automatically and is always current with the displayed design.

Display of the CodeBox is optional. The dialog height is automatically resized to accommodate whether or not the CodeBox is displayed. As controls are added to the dialog, the content of the CodeBox is automatically updated, and scrolled to the last line (where new control code is added).

The CodeBox has a context menu of it's own, containing the following options:

Code Generation

gbDesigner can generate code in one of two ways:

The code generated by gbDesigner is defined by two code file templates - gbdesigner_dialogcode.txt and gbdesigner_controlcode.txt. These file are read in at program start. As controls are added, the content of the files is used to generate the final code that is presented to the user.

Control Code Template
The template for standard and expanded control code is contained in the file gbdesigner_controlcode.txt. Here's an example of the code provided for each of the controls types:

::::ComboBox
    Control Add ComboBox, hDlg, cID, , x,y,w,h, _
        %CBS_DropDown Or %CBS_Sort Or %WS_TabStop,%WS_Ex_Left Or %WS_Ex_ClientEdge 
    Control Add ComboBox, hDlg, cID, , x,y,w,h, _
        %CBS_DropDown Or %CBS_Sort Or %WS_TabStop,%WS_Ex_Left Or %WS_Ex_ClientEdge 
    ComboBox Insert hDlg, cID, 1, "one"
    ComboBox Insert hDlg, cID, 2, "two"
    ComboBox Insert hDlg, cID, 3, "three"
    ComboBox Select hDlg, cID, 1 

The first line is always the standard code . All remaining code lines define the expanded code. Each control type has its own area in the file, each area separated by "::::ControlName" at the start of a line.

The following phrases are replaced by gbDesigner with the indicated code:

The user is allowed to edit the control code template file.

A future version of gbDesigner will allow the user to edit control properties, including the style and extended style properties.

Dialog Code Template
The dialog code is created based on the following template. gbDesigner reads the template (gbdesigner_dialogcode.txt) and replaces content based on the design created by the user.

      #Compile Exe
      #Dim All
      #Include "Win32API.inc"

      'gb_equates

      Global hDlg as Dword
      'gb_globals

      Function PBMain() As Long
         Dialog New Pixels, 0, "Test Code",x,y,w,h, %WS_OverlappedWindow To hDlg
         CreateControls
         Dialog Show Modal hDlg Call DlgProc
      End Function

      CallBack Function DlgProc() As Long
         Select Case Cb.Msg
            Case %WM_InitDialog
      'gb_initialize
            Case %WM_Command
      'gb_command
            Case %WM_Notify
      'gb_notify
         End Select
      End Function

      Sub CreateControls
      'gb_controls
      End Sub

The following phrases are replaced by gbDesigner with the indicated code:

Context Menus

gbDesigner has no main menu, but it does provide a context menus for the drawing area. In the following image, the left side is displayed with a right mouse click in the client area of the main dialog. To display the right side context menu, click on "Design Mode Commands".

Here is additional information on each of the menu items.

Toolbar

gbDesigner provides three toolbar display options:

Both the dialog and floating toolbars provide the same options. However, the dialog toolbar additionally has the option to hie all buttons except those which deal with selecting a button to draw.

The drawing area context menu has all of the options of a toolbar, plus some additional options not available through the toolbars.

This is the image of the full width dialog toolbar

The left side of the toolbar (to the left of the Select button) can be hidden to minimize the dialog width needed to display the toolbar.

Here are separate images of the left and right sides of the toolbar:

Left Side:

   

Right Side:

   

A description of the functions provided by each of the toolbar buttons is given below, starting with the left side buttons.

This next group of icons represents the toolbar buttons used to select controls for drawing. These icons are always displayed as part of the dialog toolbar.

Special Commands

There are several commands which may have been discussed above, but are collected here as a reminder of shortcuts available to the user:

Issues/Road Map

There are some areas where gbDesigner needs improvement. Here's my current list.

Here's my map for additional features/changes for gbDesigner.

Ver 1.1

Ver 1.2

Programmer Information

This section is provided in addition to the gbDesigner source code, to provide comments/pointers on various aspects of gbDesigner.

... in work

Comments/Suggestions

I welcome feedback on gbDesigner and its documentation. Please feel free to contact me with your comments or suggestions.