Resources File
Previous topic  First topic  Next topic


To embed images within your executable has to be defined within the resource file of the application. This file has the same name as the main source program but with the "rc" extension.
Para poder incluir imágenes dentro de nuestro ejecutable tenemos que definirlas dentro del archivo de recursos de la aplicación. Dicho archivo tiene el mismo nombre del programa fuente principal pero con la extensión "rc"

For example, if our main program is located in c:\test and called my_prog.prg our resource file should be called my_prog.rc and must reside in c:\tests
Por ejemplo, si nuestro programa principal esta ubicado en c:\tests y se llama my_prog.prg, nuestro archivo de recursos se deberá llamar my_prog.rc y deberá residir en c:\tests

The easiest way to create this file is from Marinas-IDE:
La forma mas sencilla de crear dicho archivo es desde Marinas-IDE:




The format of the resource file is:

El formato del archivo de recursos es el siguiente:

<alias>       <resource_type>  <image_path_and_name>

Valid resource types:
ICON for icons
IMAGE for other image types
OTHER for other file types

Tipo de recursos aceptados:
ICON para íconos
IMAGE para el resto de los tipos de imágenes
OTHER para otro tipo de archivos


Example:
Ejemplo:

// comment line
marinas-ide   ICON          ../resource/marinas-ide.ico
project       icon          project.png
logClear      image         c:\resource\logclear.png
logView       IMAGE         .\resource/logview.png
logTxT        OTHER         .\data/log.txt
logRecord     image         /home/cdq/logrecord.png
// another comment line


To read more about supported image types press here
Para ver mas sobre tipos de imágenes soportadas presione aquí

In the resource files is not necessary to respect the separation of PATHS operating system ('/' on Windows and '\' in unix operating systems) because the resource compiler will correct automatically.
En los archivos de recursos no es necesario respetar el caracter de separación de PATHS del sistema operativo ( '/' en windows y '\' en sistemas operativos unix) ya que el compilador de recursos lo corregirá automaticamente.

Paths can be relative or absolute, although it is advisable to always use relative paths to be more flexible relocation of the project.
Los paths pueden ser relativos o absolutos, aunque se aconseja utilizar siempre paths relativos para que sea mas flexible el cambio de ubicación del proyecto.


Usage:
Modo de uso:

These images are called from our Marinas-GUI application using aliases that are CASE INSENSITIVE, for example, for image logclear.png:
Estas imágenes son invocadas desde nuestra aplicación Marinas-GUI por medio de los alias que son CASE INSENSITIVE, por ejemplo, para la imagen logclear.png:

PICTURE "logClear"
or
mg_Set( "myWin" , "myControl" , "picture" , "logclear" )


<image_path_and_name> is CASE SENSITIVE, so make sure the file name and path match the real names, especially in unix based operating systems. In windows it is not relevant, but a multi platform system has to do much emphasis upon this.
Our recommendation is to use file names and folders to lowercase.
<image_path_and_name> es CASE SENSITIVE, asi que asegurese que el nombre del archivo y el directorio coincidan con los nombres reales, sobre todo en sistemas operativos basados en unix. En windows no es relevante, pero un sistema multiplataforma tiene que hacer mucho hincapié en esto.
Nuestra recomendación es utilizar siempre nombres de archivos y folders en minúsculas.



Types of icons:
Tipos de íconos:

As noted in the previous example, there is an icon type ico and another type png because different operating systems have different requirements.
In Windows, the icons may be ico, bmp or other format but requires ico type for the icon of the application be integrated with Windows Explorer.
In unix based operating systems png images can be used as icons.

Como se nota en el ejemplo anterior, hay un icono de tipo ico y otro de tipo png ya que los diferentes sistemas operativos tienen diferentes requerimientos.
En Windows, los iconos pueden ser ico, bmp u otro formato pero se requiere de tipo ico para que el ícono de la aplicación se integre con el explorador de windows.
En sistemas operativos basados en unix se pueden usar imágenes png como íconos.


So how do we make our icon work in both Windows and Linux?
The answer is to have two icons, one .ico and other .png and within our specified resource file:

Entonces, ¿como hacemos para que nuestro ícono funcione tanto en Windows como en Linux?
La respuesta es tener ambos íconos, uno .ico y otro .png y dentro de nuestro archivo de recursos especificar:


marinas-ide   ICON       ../resource/marinas-ide<icon_platform>

case <icon_platform> will be replaced automatically by:
la sentencia <icon_platform> será reemplazada automaticamente por:

. ico on windows
and
. png on linux


.ico en windows
y
.png en linux



Detach:

You can detach these files included into executable to a memo variable or to a phisical file.
Usted puede descargar estos archivos incluidos en el ejecutable hacia una variable de tipo memo o hacia un archivo físico.

You can learn more by jump to "DETACH Command" topic.
Usted puede leer más sobre el tema en el tópico "DETACH Command".

Hot Recovery:

The Marinas-IDE Hot Recovery Versions functionality does not provide the possibility of saving all the changes that we make on our database of resources, but we can do with a little trick:
Suppose our resource file called test.rc:

La funcionalidad Hot Recovery Versions de Marinas-IDE no contempla la posibilidad de guardarnos todos los cambios que hagamos sobre nuestro archivo de recursos, pero podemos lograrlo con un pequeño truco:
Supongamos que nuestro archivo de recursos se llama test.rc:


  • 1 .- Rename test.rc as test.ch
  • 2 .- Create a new test.rc in the same directory that contains only the following line:
  •       # include "test.ch"
  • 3 .- Add test.ch on the Headers tab (H &Amp; CH) and edit it there ever since
  • .

  • 1.- Renombrar test.rc como test.ch
  • 2.- Crear un nuevo test.rc en el mismo directorio que solo contenga la siguiente linea:
  •       #include "test.ch"
  • 3.- Agregar test.ch en la pestaña de Headers (H &Amp; CH) y lo editamos siempre desde ahí
  • .

    Thus, we will automatically have backup and file versioning of our resources file so as we have automatically for our sources, headers and display formats.
    De este modo, pasaremos automaticamente a tener backup y versionado de nuestro archivo de recursos asi como lo tenemos automaticamente para nuestros fuentes, encabezados y formatos de pantallas.


    Real example:
    Ejemplo real:

    As a last point, we show a copy of the Marine Resource-IDE, in fact, quite messy!
    Como ultimo punto, les mostramos una copia del archivo de recursos de Marinas-IDE, por cierto, ¡bastante desprolijo!

    //
    //      Resource name   Resouce Type    resource filename
    //
    marinas-ide     ICON                     ..\resource\marinas-ide<icon_platform>
    MIHProject      ICON                     ..\resource\marinas-ide_project<icon_platform>
    //
    KILLER          IMAGE                    ..\resource\us_killer.png
    REVOLVER        IMAGE                    ..\resource\us_killer.png
    REVOLVER2       IMAGE                    ..\resource\us_killer2.png
    //
    // other files to detach
    att_log       OTHER                      ..\data\log.txt
    att_backup    OTHER                      ..\data\backup.zip
    //
    us_editor       IMAGE                    ..\source-tools\us_editor\resource\us_editor.png
    us_dbtool       IMAGE                    ..\source-tools\us_dbtool\resource\dbtool1.png
    us_ftp          IMAGE                    ..\source-tools\us_ftp\resource\ftp_marinas-ide.png
    installer       IMAGE                    ..\resource\us_easy_installer.png
    EI_default_application_icon IMAGE        ..\resource\us_easy_installer_default_icon.png
    EI_default_association_icon IMAGE        ..\resource\us_easy_installer_default_icon.png
    //
    //MIH_Splash      IMAGE                  ..\resource\mih_splash.bmp
    mailcdq         image                    ..\resource\cdqmail.png
    about           image                    ..\resource\marinas-ide.png
    homecdq         image                    ..\resource\cdq.png
    license         image                    ..\resource\license.png
    logclear        image                    ..\resource\logclear.png
    logview         image                    ..\resource\logview.png
    logrecord       image                    ..\resource\logrecord.png
    hot_reindex     image                    ..\resource\hot_reindex.png
    hot_import      image                    ..\resource\hot_import.png
    hot_recovery    image                    ..\resource\hot_recovery.png
    HOTREC          IMAGE                    ..\resource\hot_recovery_add.png
    hot_settings    image                    ..\resource\hot_settings.png
    MIHWAIT         IMAGE                    ..\resource\marinas-ide.png
    NEW             IMAGE                    ..\resource\new.png
    projectsettings IMAGE                    ..\resource\project_settings.png
    globalsettings  IMAGE                    ..\resource\global_settings.png
    SAVE            IMAGE                    ..\resource\save.png
    SAVEas          IMAGE                    ..\resource\saveas.png
    OPEN            IMAGE                    ..\resource\open.png
    RUN             IMAGE                    ..\resource\run.png
    BUILD           IMAGE                    ..\resource\build.png
    BUILD_up        IMAGE                    ..\resource\build_up.png
    HELP            IMAGE                    ..\resource\help.png
    //BUILD1          IMAGE                    ..\resource\build1.bmp
    //BUILD2          IMAGE                    ..\resource\build2.bmp
    ADD             IMAGE                    ..\resource\add.png
    REMOVE          IMAGE                    ..\resource\remove.png
    FORCERECOMP     IMAGE                    ..\resource\forcerecomp.png
    EDIT            IMAGE                    ..\resource\edit.png
    SETTOP          IMAGE                    ..\resource\settop.png
    FOLDERSELECT    IMAGE                    ..\resource\folderselect.png
    DOWN            IMAGE                    ..\resource\down.png
    UP              IMAGE                    ..\resource\up.png
    TEST            IMAGE                    ..\resource\test.png
    YELLOW          IMAGE                    ..\resource\yellow.png
    WHITE           IMAGE                    ..\resource\white.png
    SYNC            IMAGE                    ..\resource\sync.png
    STOP            IMAGE                    ..\resource\stop.png
    WAIT            IMAGE                    ..\resource\wait.png
    debug           IMAGE                    ..\resource\debug.png
    exit            IMAGE                    ..\resource\exit.png
    GridNone            IMAGE                ..\resource\gridnone.png
    GridTilde           IMAGE                ..\resource\gridtilde.png
    GridEquis           IMAGE                ..\resource\gridequis.png
    GridTildeEquis      IMAGE                ..\resource\gridtildeequis.png
    GridSearchok        IMAGE                ..\resource\gridsearchok.png
    GridTildeSearchok   IMAGE                ..\resource\gridtildesearchok.png
    GridEquisSearchok   IMAGE                ..\resource\gridequissearchok.png
    GridTildeEquisSearchok   IMAGE           ..\resource\gridtildeequissearchok.png
    GridEdited               IMAGE           ..\resource\gridedited.png
    GridTildeEdited          IMAGE           ..\resource\gridtildeedited.png
    GridEquisEdited          IMAGE           ..\resource\gridequisedited.png
    GridTildeEquisEdited     IMAGE           ..\resource\gridtildeequisedited.png
    GridSearchokEdited       IMAGE           ..\resource\gridsearchokedited.png
    GridTildeSearchokEdited  IMAGE           ..\resource\gridtildesearchokedited.png
    GridEquisSearchokEdited  IMAGE           ..\resource\gridequissearchokedited.png
    GridTildeEquisSearchokEdited IMAGE       ..\resource\gridtildeequissearchokedited.png
    GridSearchNotok          IMAGE           ..\resource\gridsearchnotok.png
    GridHlpGlobalFoot        IMAGE           ..\resource\shg_imgfoot.bmp
    GridHlpWelcome           IMAGE           ..\resource\shg_imgwelcome.bmp
    GridHlpBook              IMAGE           ..\resource\shg_imgbook.bmp
    GridHlpPage              IMAGE           ..\resource\shg_imgpage.bmp
    GridHlpGlobalFootSearchOk  IMAGE         ..\resource\shg_imgfootsearchok.bmp
    GridHlpWelcomeSearchOk     IMAGE         ..\resource\shg_imgwelcomesearchok.bmp
    GridHlpBookSearchOk        IMAGE         ..\resource\shg_imgbooksearchok.bmp
    GridHlpPageSearchOk        IMAGE         ..\resource\shg_imgpagesearchok.bmp
    GridHotFrom                IMAGE         ..\resource\gridimghotfrom.png
    GridHotTarget              IMAGE         ..\resource\gridimghottarget.png
    GridHotComment             IMAGE         ..\resource\gridimghotcomment.png
    GridHotFromComment         IMAGE         ..\resource\gridimghotfromcomment.png
    GridHotTargetComment       IMAGE         ..\resource\gridimghottargetcomment.png
    SHG_FileNotFound           IMAGE         ..\resource\shg_filenotfound.bmp
    SHG_FileNotSupported       IMAGE         ..\resource\shg_filenotsupported.bmp
    //
    MI_Tree                    IMAGE         ..\resource\mi_tree.png
    MI_Main                    IMAGE         ..\resource\mi_main.bmp
    //
    WWW_New                    IMAGE         ..\resource\www_new.bmp
    WWW_Close                  IMAGE         ..\resource\www_close.bmp
    WWW_CloseAll               IMAGE         ..\resource\www_closeall.bmp
    WWW_Prev                   IMAGE         ..\resource\www_prev.bmp
    WWW_Next                   IMAGE         ..\resource\www_next.bmp
    WWW_Stop                   IMAGE         ..\resource\www_stop.bmp
    WWW_StopAll                IMAGE         ..\resource\www_stopall.bmp
    WWW_ReLoad                 IMAGE         ..\resource\www_reload.bmp
    WWW_ReLoadAll              IMAGE         ..\resource\www_reloadall.bmp
    WWW_Home                   IMAGE         ..\resource\www_home.bmp
    WWW_Favorites              IMAGE         ..\resource\www_favorites.bmp
    WWW_FullScreen             IMAGE         ..\resource\www_fullscreen.bmp
    WWW_Settings               IMAGE         ..\resource\www_settings.bmp
    WWW_GREEN                  IMAGE         ..\resource\www_green.bmp
    WWW_RED                    IMAGE         ..\resource\www_red.bmp
    //SHG_ImgBook              IMAGE         ..\resource\shg_imgbook.bmp
    //SHG_ImgPage              IMAGE         ..\resource\shg_imgpage.bmp
    //SHG_ImgFoot              IMAGE         ..\resource\shg_imgfoot.bmp
    //SHG_ImgWelcome           IMAGE         ..\resource\shg_imgwelcome.bmp
    //
    BANSP                      IMAGE         ..\resource\bansp.bmp
    BANEN                      IMAGE         ..\resource\banen.bmp
    BANBR                      IMAGE         ..\resource\banbr.bmp
    BANPT                      IMAGE         ..\resource\banpt.bmp
    //
    // RichEdit
    us_editprint        IMAGE      ..\resource\us_editprint.png
    us_editpreview      IMAGE      ..\resource\us_editpreview.png
    us_editcopy         IMAGE      ..\resource\us_editcopy.png
    us_editpaste        IMAGE      ..\resource\us_editpaste.png
    us_editcut          IMAGE      ..\resource\us_editcut.png
    us_editselectall    IMAGE      ..\resource\us_editselectall.png
    us_editdelete       IMAGE      ..\resource\us_editdelete.png
    us_editundo         IMAGE      ..\resource\us_editundo.png
    us_editredo         IMAGE      ..\resource\us_editredo.png
    us_editfind         IMAGE      ..\resource\us_editfind.png
    us_editbold         IMAGE      ..\resource\us_editbold.png
    us_edititalic       IMAGE      ..\resource\us_edititalic.png
    us_editunderline    IMAGE      ..\resource\us_editunderline.png
    us_editstrikeout    IMAGE      ..\resource\us_editstrikeout.png
    us_editleft         IMAGE      ..\resource\us_editleft.png
    us_editcenter       IMAGE      ..\resource\us_editcenter.png
    us_editright        IMAGE      ..\resource\us_editright.png
    us_editcolor        IMAGE      ..\resource\us_editcolor.png
    us_editvinetas      IMAGE      ..\resource\us_editvinetas.png
    us_edittabon        IMAGE      ..\resource\us_edittabon.png
    us_edittaboff       IMAGE      ..\resource\us_edittaboff.png



    Marinas-GUI Version 03.06 and
    Marinas-IDE Version 05.06 and
    LEX Files Version 02.06


    ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    last update: April 27
    2017
    ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------




    A Harbour/QT framework to make multiplatform programs

    (©) Copyright 2009-2017 by Fernando Santolin (aka CarozoDeQuilmes)
    CarozoDeQuilmes@gmail.com

    2009-2017 Beta tester and full English translator: Bruno Luciani
    Bruno.Luciani@gmail.com

    2014-2015 Final English corrector: David Worboys
    DavidWorboys@hotmail.com

    ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    www.marinas-gui.org


    www.marinas-gui.org  

    Previous topic  First topic  Next topic