Table of Contents



Customized MSGBOX


msgbox Collection


To improve the msgbox appearance from the system, it has been carried out the posibility to make a collection where we can show customized messages with the system msgbox appearance we desire.

The collection which we can call as we want to, is a special collection that thave the cancelable=“false” and cancelable-outside=“false” atttibutes, that make it behaves as a “modal” window, so that the user will have to select one of the buttons displayed to be able to continue. It appears as “floating” on the current screen.


The buttons displayed in this collection must have a button-option=“NUM” attribute, where will be indicated the value that they will return if they are pressed.

Call to customized msgbox


To call the collection that shows the message it can be done with vbscript and with javascript, the collection is treated like any other, the only thing is that this collection will return a result with the value of the button the user has pressed.

Somewhere in the code a call will be made like the following one:

// El tercer parámetro es para que muestre los botones Si/No y el cuarto parámetro si queremos mostrar unicamente OK ó CANCELAR
	var vResult=showMsgBox("¿Desea guardar los cambios?", "CONFIRMACIÓN!!",1,0);
	if (vResult==6) 
	{
		self.executeNode("btn_save");
	}
 
	showMsgBox("Debe introducir una firma", "ERROR!!",0,1);
 
// Hay que definir la funcion que lanza la colección en edicion (Se le pasa el objeto como parámetro al ui.msgBox)
function showMsgBox(strText,strTitle,showBt1,showBt2)
{
 
	var mColeccionMessageBox = appData.getCollection("MsgBoxColl");
    var mNuevoMessageBox = mColeccionMessageBox.createObject();
	mNuevoMessageBox.MAP_TITULO = strTitle;
	mNuevoMessageBox.MAP_MENSAJE = strText;
	mNuevoMessageBox.MAP_IMG = "incidencias.png";
	mNuevoMessageBox.MAP_SHOW1 = showBt1;
    mNuevoMessageBox.MAP_SHOW2 = showBt2;
 
	var nResult = ui.msgBox(mNuevoMessageBox);
    return nResult;
}


Example Coll customized msgbox


<coll name="MsgBoxColl" title="XoneCollvacia" sql="" objname="" updateobj="" progid="" filter="" sort="" special="true" cancelable="false" cancelable-outside="false">
      <group name="General" id="1">
        <frame name="frmBack" class="colorframebackflotante" width="100%" height="100%" align="center">
          <frame name="title2" classd="colorfrmgrupos" bgcolor="#FFFFFF" width="1000p" height="600p" align="center|center">
            <prop name="MAP_IMG" visible="0" type="IMG" height="70p" lmargin="0" />
            <prop name="MAP_TITULO" visible="1" type="T" labelwidth="0" classx="lockedTL" locked="true" newlinec="false" lmarginx="5%" width="90%" text-align="center" textfont-size="8" />
            <prop name="BTNBLUEM13" visible="0" type="B" img="lineaG.png" width="90%" height="4p" lmargin="0" tmargin="10p" />
            <prop name="MAP_MENSAJE" type="T" visible="7" title=" " width="90%" labelwidth="0" tmargin="40p" class="loginProp" locked="true" text-align="center" lines="2" text-border-bottom="false" />
            <frame name="frameSiNo" class="frame_data" tmargin="40p" align="center" disablevisible="MAP_SHOW1=0">
              <prop name="BTNOK" type="B" visible="1" title="Si" button-option="6" class="buttontxtsmallfocus" method="executenode(onback)" />
              <prop name="BTNCANCEL" type="B" visible="1" title="No" button-option="2" class="buttontxtsmall" method="executenode(onback)" newline="false" lmargin="30p" />
            </frame>
            <frame name="frameCerrar" class="frame_data" tmargin="40p" align="center" disablevisible="MAP_SHOW2=0">
              <prop name="BTNCANCEL2" type="B" visible="1" title="Cerrar" button-option="1" class="buttontxtsmall" width="260p" method="executenode(onback)" />
            </frame>
            <prop name="MAP_SHOW1" type="N" visible="0" title="" labelwidth="0" fieldsize="6" size="6" />
            <prop name="MAP_SHOW2" type="N" visible="0" title="" labelwidth="0" fieldsize="6" size="6" />
          </frame>
        </frame>
      </group>
</coll>