1 Reply Latest reply on Jul 17, 2011 1:27 PM by Porratic

    Spark TitleWindow with DataGrid Skin error

    Porratic

      Hello, I'm migrating a FLEX 3 application (HALO) to FLEX 4.5 (SPARK) and I've found an issue that can't resolve:

       

      I've a component that shows a pop-up with a DataGrid inside. The FLEX framework throws an the following internal error when the component is displayed:

       

      SkinnableComponent.as (line 698)

       

      at spark.components.supportClasses::SkinnableComponent/attachSkin()[E:\dev\4.5.1\frameworks\ projects\spark\src\spark\components\supportClasses\SkinnableComponent.as:698]
          at spark.components.supportClasses::SkinnableComponent/validateSkinChange()[E:\dev\4.5.1\fra meworks\projects\spark\src\spark\components\supportClasses\SkinnableComponent.as:443]
          at spark.components.supportClasses::SkinnableComponent/createChildren()[E:\dev\4.5.1\framewo rks\projects\spark\src\spark\components\supportClasses\SkinnableComponent.as:406]
          at spark.components::DataGrid/createChildren()[E:\dev\4.5.1\frameworks\projects\spark\src\sp ark\components\DataGrid.as:2220]
          at mx.core::UIComponent/initialize()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\core\ UIComponent.as:7624]
          at mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::childAdded()[E:\dev\4.5.1\frameworks\projects\ framework\src\mx\core\UIComponent.as:7485]
          at mx.core::UIComponent/addChildAt()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\core\ UIComponent.as:7189]

      ...

       

      Thats the piece of the MXML code (I've omitted the AS code):

       

      <?xml version="1.0" encoding="utf-8"?>
      <mx:TitleWindow xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:comp="shared.client.components.*"  showCloseButton="true" close="Close();" defaultButton="{btnAceptar}" width="647" height="400" keyDown="titleWindow_keyDown(event);" creationComplete="dialogo_Loaded();">
         
          <s:VGroup width="100%" height="100%">
             
          <s:HGroup width="100%" height="30">
              <s:Label id="lblMensaje" width="100%" >
             
              </s:Label>
              <comp:TagTextInput id="tbxFiltro" width="190" tabIndex="1"></comp:TagTextInput>
              <s:Image source="shared/themes/basico/icons/magnifier.png" click="FiltrarGrid();"  height="22" toolTip="{resourceManager.getString('textos', 'filtrar')}"></s:Image>
          </s:HGroup>
         
          <s:HGroup id="hbxGridContainer" width="100%" height="100%">
              <s:DataGrid id="dtgDatos" gridDoubleClick="dtgDatos_DoubleClick();" doubleClickEnabled="true" autoSelectItems="false" width="100%" height="100%" tabIndex="2">
                 
              </s:DataGrid>
          </s:HGroup>
         
          <s:HGroup width="100%"  >
              <comp:TagButton id="btnAceptar" label="{resourceManager.getString('textos', 'aceptar')}" click="btnAceptar_Click();" tabIndex="3" icon="@Embed(source='../../themes/basico/icons/tick.png')">
              </comp:TagButton>
              <comp:TagButton id="btnCancelar" label="{resourceManager.getString('textos', 'cancelar')}" click="btnCancelar_Click();" tabIndex="4" icon="@Embed(source='../../themes/basico/icons/cross-button.png')">
              </comp:TagButton>
              <comp:TagButton id="btnNinguno" label="{resourceManager.getString('textos', 'ninguno')}" click="btnNinguno_Click();" tabIndex="5" icon="@Embed(source='../../themes/basico/icons/exclamation-octagon.png')">
              </comp:TagButton>
        </s:HGroup>
      </s:VGroup>
         
      </mx:TitleWindow>

       

      ¿Any ideas?. Thank you.

        • 1. Re: Spark TitleWindow with DataGrid Skin error
          Porratic Level 1

          I've solved the issue.

           

          It was related with the PopupManager, it seems to be a bug in Flex when you open this up using FlexGlobals.topLevelApplication:

           

          PopUpManager.addPopUp(dialogo, FlexGlobals.topLevelApplication, true);
          PopUpManager.centerPopUp(dialogo);

           

          Opening the pop-up this way causes an error related with the IFlexModuleFactory parameter. The correct way to open the pop-up in SPARK is:

           

          PopUpManager.addPopUp(dialogo, this, true);
                          PopUpManager.centerPopUp(dialogo);      

           

          Hope it helps others.