Frequently asked questions

The FAQ lists those questions frequently asked when migrating an existing 4GL application to Genero.

FAQ001: Why do I have a different display with Genero than with BDS V3?

Explanation

Genero Business Development Language (BDL) introduces major graphical user interface enhancements that sometimes require code modification. With BDS V3, application windows created with the OPEN WINDOW instruction were displayed as static boxes in the main graphical window. In the GUI mode of Genero, application windows are displayed as independent, re-sizeable graphical windows.

Solution:

Review the program logic to reduce the number of windows created by the programs. Replace MENU created in specific windows by TOPMENU elements in your forms.

FAQ002: Why does an empty window always appear?

Description

An additional empty window appears when I explicitly create a window with the OPEN WINDOW instruction.

MAIN
  OPEN WINDOW w1 AT 1,1 WITH FORM "form1"
  MENU "Example"
    COMMAND "Exit"
      EXIT MENU
  END MENU
  CLOSE WINDOW w1
END MAIN

Explanation

In the new standard GUI mode, all windows are displayed as real front-end windows, including the default SCREEN window. When an application starts, the runtime system creates this default SCREEN window, as in version 3. This is required because some applications use the SCREEN window to display forms (they do not use the OPEN WINDOW instruction to create new windows). To facilitate BDS V3 to Genero migration, the runtime system must keep the default SCREEN window creation; otherwise, existing applications would fail if their code was not modified.

Solution

You can either execute a CLOSE WINDOW SCREEN at the beginning of the program, to close the default window created by the runtime system, or use the OPEN FORM + DISPLAY FORM instructions, to display the main form in the default SCREEN window.

Example

MAIN
  OPEN FORM f FROM "form1"
  DISPLAY FORM f
  MENU "Example"
    COMMAND "Exit"
      EXIT MENU
  END MENU
END MAIN

FAQ003: Why do some COMMAND KEY buttons no longer appear?

Description

When creating a MENU with COMMAND KEY(keyname) "option" clause, the button for keyname is no longer displayed:
MAIN
  MENU "Example"
    COMMAND "First"
       EXIT PROGRAM
    COMMAND KEY (F5) "Second"
       EXIT PROGRAM
    COMMAND KEY (F6) -- Third is a hidden option 
       EXIT PROGRAM
  END MENU
END MAIN

Explanation

In BDS Version 3, when using the MENU instruction, several buttons are displayed for each clause of the type COMMANDKEY(keyname) "option": one for the menu option, and others for each associated key.

When using Genero, for a named MENU option defined with COMMAND KEY, the buttons of associated keys are no longer displayed (F5 in our example), because there is already a button created for the named menu option. The so called "hidden menu options" created by a COMMAND KEY(keyname) clause (F6 in our example) are not displayed as long as you do not associate a label, for example with the FGL_SETKEYLABEL() function.

FAQ004: Why aren't the elements of my forms aligned properly?

Description

In my forms, I used to align labels and fields by character, for typical terminal display. But now, when using the new LAYOUT section, some elements are not aligned as expected. In this example, the beginning of the field f001 is expected in the column near the end of the digit-based text of the first line, but the field is actually displayed just after the label "Name:":

DATABASE FORMONLY

LAYOUT
  GRID {
  01234567890123456789
   Name:             [f001       ]
  }
  END
END

ATTRIBUTES
  f001 = formonly.field1 TYPE CHAR;
END

Explanation

By default, Genero displays form elements with proportional fonts, using layout managers to align these elements inside the window. In some cases, this requires a review of the content of form screens when using the new layout management, because the layout is based on new alignment rules which are more abstract and automatic than the character-based grids in Version 3.

In most cases, the fglform compiler is able to analyze the layout section of .per form specification file to produce an acceptable presentation, but sometimes you will have to tweak the form files to give hints for the alignment of elements.

Solution

In this example, the field f001 alignment is based on the label appearing on the same line. By adding one space before the field position, the form compiler will understand that the field must be aligned to the text in the first line:

DATABASE FORMONLY

LAYOUT
 GRID {
 01234567890123456789
  Name:              [f001       ]
 }
 END
END

ATTRIBUTES
  f001 = formonly.field1 TYPE CHAR;
END

In the next example, the fields are automatically aligned to the text in the first line:

DATABASE FORMONLY

LAYOUT
 GRID {
                First         Last 
   Name:        [f001      ]  [f002       ]
 }
 END
END

ATTRIBUTES
  f001 = formonly.field1 TYPE CHAR;
  f002 = formonly.field2 TYPE CHAR;
END

FAQ005: Why doesn't the ESC key validate my input?

Description

The traditional ESC (escape) key does not validate an INPUT, it cancels the dialog instead.

Explanation

To follow platform standards (like Microsoft™ Windows® for example), the ESC key is the standard key to cancel the current interactive statement.

Solution

You can change the accelerator keys for the 'accept' action with action defaults. However, is not recommended to change the defaults, because ESC is the standard key used to cancel a dialog in GUI applications.

FAQ006: Why doesn't the Ctrl-C key cancel my input?

Description

The traditional Ctrl-C key does not cancel an INPUT statement.

Explanation

To follow platform standards (like Microsoft Windows for example), the Ctrl-C key is used as the standard key to copy the current selected text to the clipboard, for cut and paste.

Solution

You can change the accelerator keys for the 'cancel' action with action defaults. However, is not recommended to change the defaults, because ESC is the standard key used to cancel a dialog in GUI applications.

FAQ007: Why do the gui.* FGLPROFILE entries have no effect?

Description

The gui.* and some other FGLPROFILE entries related to graphics no longer have effect.

Explanation

These entries are related to the old user interface. They are no longer supported. In BDS version 3, the gui.* entries were interpreted by the front end. As the user interface has completely been redesigned in Genero, some gui.* entries have been removed.

Solution:

Review all FGLPROFILE entries used in your current application and verify if there is a replacement.

FAQ008: Why do I get invalid characters in my form?

Description

The application starts, connects to the database and seems to work properly, but strange symbols (rectangles, question marks) are displayed in the forms for non-ASCII characters. The ASCII characters display properly.

Explanation

This is certainly a character set configuration error.

Solution

You have probably defined a wrong runtime system locale to the database client locale.

FAQ009: Why do large static arrays raise a stack overflow?

Description

When using very large static arrays (DEFINE a1 ARRAY[10000] OF ...), I get a stack overflow on Windows platforms.

Explanation

The runtime system uses the default stack size defined by the C compiler. Because function static arrays are allocated on the C stack, using very large static arrays in functions can result in a stack overflow error.

Solution

Review the program and use dynamic array instead of static arrays.

FAQ010: Why do I get error -6366 "Could not load database driver drivername"?

Description

Error -6366 occurs when the runtime system fails to load the specified database driver.

Explanation

The database driver shared object (.so or .DLL) or a dependent library could not be found.

Solution

Make sure that the specified driver name does not have a spelling mistake. If the driver name is correct, there is probably an environment problem. Make sure that the database client software is installed on the system (Genero does not communicate directly with the database server, you need the client library). Check the UNIX™ LD_LIBRARY_PATH environment variable or the PATH variable on Windows. These must point to the database client libraries. Another common error is the installation of a database client software of a different object type to the Genero runtime system. For example, if you install a 32 bit Genero version, you must install a 32 bit version of the database client software, the 64 bit version will not work.