Skip to content

Simple_example_of_a_project_with_FiveLinux.

AntonioFS edited this page Apr 21, 2022 · 14 revisions

This is an example (you can create your own) of working with Harbour and FiveLinux. Initially, the starting point is a structure configured as follows, programmed procedurally:

  • image HBp (Harbour Projects)

    • image DB (Databases)

    • image SF (Standard Functions)

    • image BF (Binary files)

    • image Lb (Libraries)

    • image NameProject1 (Project 1)

      • Creating code in the Project1.prg source file:

        #include "FiveLinux.ch"
        
        PROCEDURE Main()
            LOCAL oWindow
        
            LOCAL cTitle := "FiveLinux"
            LOCAL nWidth := 640, nHeight := 480
        
            DEFINE WINDOW oWindow;
                TITLE cTitle;
                MENU  MenuBuild();
                SIZE  nWidth, nHeight
            ACTIVATE WINDOW oWindow;
        RETURN
        
        
        FUNCTION MenuBuild()
            LOCAL oMenu
            MENU oMenu
                MENUITEM "One"
                    MENU
                        MENUITEM "One->one"
                            MENU
                                MENUITEM "One->one->1"
                                MENUITEM "One->one->2"
                                SEPARATOR
                                MENUITEM "One->one->3"
                            ENDMENU
                        MENUITEM "One->two"
                    ENDMENU
                MENUITEM "Two"   ACTION MsgInfo( "Two" )
                MENUITEM "Three" ACTION MsgInfo( "Three" )
            ENDMENU
        RETURN oMenu
        
      • Creating code in the batch file compilation.sh:

        # ------------------------------
        # Initialisation of identifiers.
        # ------------------------------
        dirProyect="NameProject1"
        proyect="Proyect1"
        extension=".prg"
        proyectPRG="$proyect$extension"
        
        # ------------------------------------------------------------------------
        # Copy of the source from the project directory, to the samples directory
        # of FiveLinux.
        # ------------------------------------------------------------------------
        cp $proyectPRG ~/fivelinux/samples/$proyectPRG
        cd ~/fivelinux/samples/
        
        # -------------------
        # Source compilation.
        # -------------------
        source build.sh $proyect
        
        # ----------------
        # Various actions.
        # ----------------
        # Deletion of source in samples directory.
            rm ~/fivelinux/samples/$proyectPRG 
        # Transfer of the focus to the object's directory.
            cd ~/HBp/BF/
        # The previous copy of the object is deleted.
            rm "copy_"$proyect
        # Transfer of the object in samples directory, to the object's dir.
            mv ~/fivelinux/samples/$proyect ~/HBp/BF/$proyect
        # A copy of the object is made.
            cp $proyect "copy_"$proyect
        
        # -----------------------------------------------------------------
        # The new object is executed and we remain in the source directory.
        # -----------------------------------------------------------------
        ./$proyect
        cd ~/HBp/$dirProyect/
        
      • Once both files have been created, from the 'NameProject1' directory and from the terminal, type:

        • image

        image

    • image NameProject2 (Project 2)

    • image ...