GWA API

The Genero Web Application API is a package included with GWA installations, offering modules like gwa.location and gwa.app to assist with application development.

In this example, various methods from the GWA API are used to return information about the GWA application.

IMPORT FGL gwa.app
IMPORT FGL gwa.location
IMPORT FGL fgldialog


FUNCTION menu_gwa_info()

    DEFINE loc_i gwa.location.TGWALocation
    DEFINE s_loc STRING
    DEFINE svr_i gwa.app.TServerVersionAndBuildResult
    DEFINE app_i gwa.app.TAppInformation

    CALL gwa.app.getServerVersionAndBuild() RETURNING svr_i
    CALL gwa.app.getInformation() RETURNING app_i

    MENU "GWA info"

        ON ACTION url ATTRIBUTES(TEXT="URL", COMMENT="Shows the GWA installation URL")
            CALL gwa.location.get() RETURNING loc_i
            LET s_loc=SFMT("%1 \nOrigin: %2 \nPath: %3 \nProtocol: %4",
                       loc_i.href, loc_i.origin, loc_i.pathname, loc_i.protocol)  
            CALL fgl_winMessage("Location", s_loc, "information")    
            MESSAGE SFMT("URL: %1",loc_i.href)

        ON ACTION app ATTRIBUTES(TEXT="App ver", COMMENT="Shows the app's version")
           MESSAGE SFMT("App version: %1",gwa.app.getVersion())
         
        ON ACTION tit ATTRIBUTES(TEXT="Title", COMMENT="Shows the app's Title")
           MESSAGE SFMT("App title: %1",gwa.app.getTitle())

        ON ACTION gwa ATTRIBUTES(TEXT="GWA ver", COMMENT="Shows the GWA version")
           MESSAGE SFMT("GWA version: %1", app_i.gwaVersion)

        ON ACTION svr ATTRIBUTES(TEXT="Server ver", COMMENT="Shows the Server version")
           MESSAGE SFMT("Server version: %1", svr_i.serverVersion)

        ON ACTION gbc ATTRIBUTES(TEXT="GBC ver", COMMENT="Shows the GBC version")
           MESSAGE SFMT("GBC version: %1",gwa.app.getGBCVersion())

        ON ACTION cancel ATTRIBUTES(TEXT="Back")
          EXIT MENU

    END MENU
END FUNCTION