Explore Code Editor

Follow these steps to work with code in Genero Studio.

  1. From the Welcome Page, Tutorials & Samples tab, open the HelloWorld project.
  2. Expand the Hello World folder and doubleclick HelloSource.4gl to open the source in Code Editor and the Code Structure view.
    Note:

    If the Code Structure view is not visible, select Window > Views > Code Structure from the menu.

    Figure: The HelloSource.4gl file in Code Editor

    This figure shows the open HelloSource.4gl file in the Code Editor and Code Structure view.
  3. Add a line after END MENU. Type CA, and then press Ctrl-Space. From the code completion dropdown, select CALL.
    Figure: The Code Completion dropdown

    This figure shows the open HelloSource.4gl file in the Code Editor. The Code Completion dropdown men displays the valid keywords beginning with CA (CALL, CANCEL, CASE)

    The left margin now displays:

    • A green +, indicating a new line.
    • A red X, indicating an error. Hover over the X to read the error description.
    Note:

    If these editing marks do not appear, select Diff > Diff View from the menu.

  4. Complete the line in the code:
    CALL displayText()

    The error indicator is now a warning icon (yellow triangle with exclamation mark). Hover over this icon to read the description:

    Figure: Error display in Code Editor

    This figure shows the open HelloSource.4gl file. The cursor hovers over the warning, and the hover text displays the message: Line 21: The function 'displayText()' has not been defined.
  5. At the end of the file (after END MAIN), define the new function:
    FUNCTION displayText()
    DISPLAY "hello!!!!"
    END FUNCTION

    The displayText() function appears in the Code Structure view.

    Figure: New displayText() function

    This figure shows the open HelloSource.4gl file The displayText() function is highlighted in the Code Editor and Code Structure view.
  6. In the Projects view, right-click the HelloSource.4gl node and select Format and Indent to prettify the code.
  7. Select the Execute icon in the toolbar to run the application.

    The Hello World form is opened in your client.

  8. Close the Hello World form.

    The application writes hello!!!! to the Output view.

    Figure: New displayText() function

    This figure shows the open HelloSource.4gl file, the Execute icon in the toolbar, and the "hello!!!!" text in the Output view.
  9. Close the code file to complete this section of the tour.