Explanation of the code
Imagen estanteria
IMPORTANT
- All the images of the books must be saved in the files folders of the application.
- The background image is saved in the icons folder.
- Besides, all of them must be saved in the application database.
PictureMAP Collection Code
Code | Explanation |
---|---|
show-no-data=“false” | It does not show the message It does not show the message that there is no data if there is no data. |
type=“Z” | It indicates the type of data of the property. |
viewmode=“picturemap” | It indicates that the contents instead appearing on “GRID” mode it will be seen as a sensible image in some points. |
method=“executenode(reservar)“ | When clicking on a book it is indicated that it is going to be reserved and its status changes. |
method=”executenode(entregar)“ | When clicking on a book it is indicated that it is going to be delivered and its status changes. |
Example of code of the PictureMAP collection
In this collection we layout the screen of the device, that is, we distribute the screeen according the information we want to show.
<coll name="PictureMAP" title="PictureMAP" sql="" objname="PictureMAP" updateobj="PictureMAP" progid="ASData.CASBasicDataObj" filter="" sort="" notab="true" show-no-data="false"> <group name="General" id="1"> <frame name="F1" width="100%" height="100%" align="top|center"> <!-- Contents de la estantería para seleccionar pulsando un libro, viewmode="picturemap" --> <prop name="@contentLibros" type="Z" contents="contentLibros" imgbk=".\icons\estanteria.png" viewmode="picturemap" width="800px" /> <contents name="contentLibros" src="estanteriaLibros" /> <!-- Contents para ver los datos del libro seleccionado (Filtramos por MAP_ID), apunta a la misma tabla que el anterior --> <prop name="@detalles" locked="true" type="Z" xdisablevisible="MAP_ESTADO=''" contents="detalles" width="800px" height="300px" mask="0" /> <contents name="detalles" src="estadoLibros" filter="t1.ID=##FLD_MAP_ID##" /> <!-- Botones para marcar el libro como Reservado ó Disponible --> <prop name="MAP_RESERVAR" type="B" disablevisible="MAP_ESTADO='Reservado' OR MAP_ESTADO=''" caption="RESERVAR" method="ExecuteNode(reservar)" forecolor="#000000" labelwidth="5" width="300px" height="90px" visible="7" lmargin="30px" tmargin="10%" /> <prop name="MAP_ENTREGAR" type="B" disablevisible="MAP_ESTADO='Disponible' OR MAP_ESTADO=''" caption="ENTREGAR" method="ExecuteNode(entregar)" forecolor="#000000" labelwidth="5" newline="false" width="300px" height="90px" visible="7" lmargin="30px" tmargin="10%" /> <!-- Campos NO visibles, se rellenan de valor desde el content estanteriaLibros cuando pulsamos uno de los libros. --> <prop name="MAP_ID" type="T" visible="0" /> <prop name="MAP_ESTADO" type="T" visible="0" onchange="Refresh" /> </frame> </group> <!--IMPORTANT: Data in the database must be entered to be able to view the images--> <reservar show-wait-dialog="false" refresh-props="MAP_RESERVAR,MAP_ENTREGAR,MAP_ESTADO"> <action name="runscript"> <script language="VBScript"> Dim obj Set obj=appdata.GetCollection("estanteriaLibros")("ID",cstr(This("MAP_ID"))) If not obj is nothing Then obj("ESTADO")="Reservado" obj.save End If obj=Nothing this("MAP_ESTADO")="Reservado" </script> </action> </reservar> <entregar show-wait-dialog="false"> <action name="runscript"> <script language="VBScript"> Dim obj Set obj=appdata.GetCollection("estanteriaLibros")("ID",cstr(This("MAP_ID"))) If not obj is nothing Then obj("ESTADO")="Disponible" obj.save End If obj=Nothing this("MAP_ESTADO")="Disponible" </script> </action> </entregar> <salir show-wait-dialog="false"> <action name="runscript"> <script language="VBScript"> Appdata.FailWithMessage -8100,"##EXIT##" </script> </action> </salir> </coll>
Code | Explanation |
---|---|
sql=“SELECT t1.* FROM ##PREF##estanterialibros t1” | Query that returns the books information. |
dependent=“false” | It indicates that the object belonging to this collection must check if the proprietary object is saved or it is not, to save them. |
check-owner=“false” | It indicates that the collection must check if the proprietary is saved in disk before executing a loadallin the case of content collection. |
Example of code of the bookshelf book collection
In this collection we indicate it what we want to show in the first contens of the PictureMAP collection
<coll name="estanteriaLibros" title="estanteriaLibros" sql="SELECT t1.* FROM ##PREF##estanterialibros t1" objname="estanteriaLibros" updateobj="estanteriaLibros" progid="ASData.CASBasicDataObj" filter="" sort="" dependent="false" check-owner="false"> <group name="General" id="1"> <prop name="ID" title="Codigo" type="T" visible="0" labelwidth="0" /> <prop name="CODIGO" title="Codigo" type="T" visible="0" labelwidth="0" /> <prop name="TITULO" title="Titulo" labelwidth="0" type="T" visible="7" /> <prop name="AUTOR" title="Autor" labelwidth="0" type="T" visible="7" /> <prop name="ESTADO" title="Estado" labelwidth="0" type="T" visible="7" /> <prop name="XCOORD" type="N" xcoord="true" visible="7" /> <prop name="YCOORD" type="N" ycoord="true" visible="7" /> <prop name="ICONBIG" width="126" height="168" type="T" size="250" icon-big="true" visible="7" /> <prop name="RADIO" type="N" circle-radius="true" visible="7" /> <prop name="ICONOFF" width="126" height="168" type="T" size="250" icon-mark="true" visible="7" /> <prop name="ICONON" width="126" height="168" type="T" size="250" icon-touch="true" visible="7" /> </group> <selecteditem> <action name="runscript"> <script language="VBSCript"> this.OwnerCollection.OwnerObject("MAP_ID")=This("ID") this.OwnerCollection.OwnerObject("MAP_ESTADO")=This("ESTADO") </script> </action> </selecteditem> </coll>
Code | Explanation |
---|---|
sql=“SELECT t1.ID,t1.CODIGO AS MAP_CODIGO,t1.TITULO AS MAP_TITULO,t1.AUTOR AS MAP_AUTOR,t1.ESTADO FROM ##PREF##estanterialibros t1” | It returns us the status which the book is in. |
show-toolbar=“false” | By default true. If we put it to false in a collection when we use it as a contents, the buttons of new, edit… do not appear, although it is allowed the edition and the creation of new ones. To lock it, it would be with locked=“true”. |
cell-bgcolor=”#FFFFFF” | It allows to define the cells background color by default. |
Code of the statusBooks collection
In this collection we indicate what we want to show in the second contents of the PictureMAP collection.
<coll name="estadoLibros" title="estadoLibros" sql="SELECT t1.ID,t1.CODIGO AS MAP_CODIGO,t1.TITULO AS MAP_TITULO,t1.AUTOR AS MAP_AUTOR,t1.ESTADO FROM ##PREF##estanterialibros t1" objname="estanterialibros" cell-bgcolor="#FFFFFF" show-toolbar="false" updateobj="estanterialibros" progid="ASData.CASBasicDataObj" filter="" sort="" check-owner="false" dependent="false" show-no-data="false"> <group name="General" id="1"> <prop name="MAP_CODIGO" type="T" visible="0" /> <prop name="MAP_TITULO" type="T" text-border="false" labelbox="false" visible="7" labelwidth="6" title="TITULO:" labelfont-bold="true" /> <prop name="MAP_AUTOR" type="T" text-border="false" labelbox="false" visible="7" labelwidth="6" title="AUTOR:" labelfont-bold="true" /> <prop name="ESTADO" type="T" text-border="false" labelbox="false" visible="7" labelwidth="6" title="ESTADO:" labelfont-bold="true" /> </group> </coll>