Exemple #1
0
zOPER_EXPORT zSHORT OPERATION
UpgradeAction( zVIEW    vSubtask,
               zVIEW    OrigW )
{
#if 0
   zSHORT   RESULT;
   zCHAR    szTempString_0[ 33 ];
   zSHORT   nZRetCode;

   if ( CompareAttributeToString( OrigW, "Action", "OperName", "" ) != 0 )
   {
      nZRetCode = GetStringFromAttribute( szTempString_0, OrigW, "Action", "OperName" );
      RESULT = SetCursorFirstEntityByString( OrigW, "Operation", "Name", szTempString_0, "" );
      if ( RESULT < 0 )
      {
         nZRetCode = CreateMetaEntity( vSubtask, OrigW, "Operation", zPOS_AFTER );
         SetAttributeFromAttribute( OrigW, "Operation", "Name", OrigW, "Action", "OperName" );
         nZRetCode = IncludeSubobjectFromSubobject( OrigW, "SourceFileOfOperation", OrigW, "SourceFile", zPOS_AFTER );
         SetAttributeFromString( OrigW, "Action", "OperName", "");
      }
      nZRetCode = IncludeSubobjectFromSubobject( OrigW, "ActOper", OrigW, "Operation", zPOS_AFTER );
      SetAttributeFromString( OrigW, "Action", "OperName", "");
   }
#endif
   return( 0 );
}
Exemple #2
0
zOPER_EXPORT zSHORT OPERATION
IncludeAttributeMapping( zVIEW    vSubtask,
                         zVIEW    OrigW,
                         zVIEW    OrigWC )
{
#if 0
   zVIEW    vLOD;
   zVIEW    LOD_List;
   zVIEW    vDomain;
   zVIEW    DomainList;
   zSHORT   nZRetCode;
   zSHORT   RESULT;
   zCHAR    szTempString_0[ 33 ];

   RetrieveViewForMetaList( vSubtask, &LOD_List, zREFER_LOD_META );
   GetStringFromAttribute( szTempString_0, OrigW, "LOD", "Name" );
   SetCursorFirstEntityByString( LOD_List, "W_MetaDef", "Name", szTempString_0, "" );
   ActivateMetaOI( vSubtask, &vLOD, LOD_List, zREFER_LOD_META, zSINGLE );
   GetStringFromAttribute( szTempString_0, OrigWC, "CtrlMap", "X_EntityName" );
   RESULT = SetCursorFirstEntityByString( vLOD, "LOD_Entity", "Name", szTempString_0, "" );
   if ( RESULT >= 0 )
   {
      nZRetCode = GetStringFromAttribute( szTempString_0, OrigWC, "CtrlMap", "X_AttributeName" );
      RESULT = SetCursorFirstEntityByString( vLOD, "ER_Attribute", "Name", szTempString_0, "LOD_Entity" );
      if ( RESULT >= 0 )
      {
         nZRetCode = IncludeSubobjectFromSubobject( OrigWC, "CtrlMapLOD_Attribute", vLOD, "LOD_Attribute", zPOS_AFTER );
         if ( CompareAttributeToString ( OrigWC, "CtrlMap", "X_Context", "" ) != 0 )
         {
            nZRetCode = RetrieveViewForMetaList( vSubtask, &DomainList, zREFER_DOMAIN_META );
            nZRetCode = GetStringFromAttribute( szTempString_0, vLOD, "Domain", "Name" );
            RESULT = SetCursorFirstEntityByString( DomainList, "W_MetaDef", "Name", szTempString_0, "" );
            nZRetCode = ActivateMetaOI( vSubtask, &vDomain, DomainList, zREFER_DOMAIN_META, zSINGLE );
            nZRetCode = GetStringFromAttribute( szTempString_0, OrigWC, "CtrlMap", "X_Context" );
            RESULT = SetCursorFirstEntityByString( vDomain, "Context", "Name", szTempString_0, "" );
            if ( RESULT >= 0 )
            {
               nZRetCode = IncludeSubobjectFromSubobject( OrigWC, "CtrlMapContext", vDomain, "Context", zPOS_AFTER );
            }
            nZRetCode = DropMetaOI( vSubtask, vDomain );
            nZRetCode = DropView( DomainList );
         }
      }
   }

   nZRetCode = DropMetaOI( vSubtask, vLOD );
   nZRetCode = DropView( LOD_List );
#endif
   return( 0 );
}
Exemple #3
0
zOPER_EXPORT zSHORT OPERATION
oTZERSASO_RefreshOneSA_Entity( zVIEW    vSubjectArea,
                               zVIEW    vEntpModel )
{
   zVIEW    vEntpModel_Wrk;
   zLONG    lEntityZKey;
   zSHORT   nRC;

   CreateViewFromViewForTask( &vEntpModel_Wrk, vEntpModel, 0 );
   GetIntegerFromAttribute( &lEntityZKey, vSubjectArea,
                            "ER_Entity", "ZKey" );
   nRC = SetCursorFirstEntityByInteger( vEntpModel_Wrk, "ER_Entity",
                                        "ZKey", lEntityZKey, "" );
   if ( nRC > zCURSOR_UNCHANGED )
   {
      ExcludeEntity( vSubjectArea, "ER_Entity" );
//    SetCursorPrevEntity( vSubjectArea, "SA_Entity", "" );
      IncludeSubobjectFromSubobject( vSubjectArea, "ER_Entity",
                                     vEntpModel_Wrk, "ER_Entity", zPOS_AFTER );
      nRC = 0;
   }
   else
   {
      DeleteEntity( vSubjectArea, "SA_Entity" );
      nRC = 1;
   }

   DropView( vEntpModel_Wrk );
   return( nRC );
}
Exemple #4
0
zOPER_EXPORT zSHORT OPERATION
UpgradeCtrlMap( zVIEW    vSubtask,
                zVIEW    OrigW,
                zVIEW    OrigWC )
{
#if 0
   zLONG    lTempInteger_0;
   zSHORT   RESULT;
   zCHAR    szTempString_0[ 33 ];
   zSHORT   nZRetCode;
   zLONG    lTempInteger_1;
   zLONG    lTempInteger_2;

   lTempInteger_0 = CheckExistenceOfEntity( OrigWC, "CtrlMapView" );
   if ( lTempInteger_0 >= 0 )
   {
      nZRetCode = GetStringFromAttribute( szTempString_0, OrigWC, "CtrlMapView", "Name" );
      RESULT = SetCursorFirstEntityByString( OrigW, "ViewObjRef", "Name", szTempString_0, "" );
   }
   else
   {
      if ( CompareAttributeToString ( OrigWC, "CtrlMap", "X_ViewName", "" ) != 0 )
      {
         nZRetCode = GetStringFromAttribute( szTempString_0, OrigWC, "CtrlMap", "X_ViewName" );
         RESULT = SetCursorFirstEntityByString( OrigW, "ViewObjRef", "Name", szTempString_0, "" );
      }
   }
   lTempInteger_1 = CheckExistenceOfEntity( OrigWC, "CtrlMapView" );
   if ( lTempInteger_1 < 0 && CompareAttributeToString ( OrigWC, "CtrlMap", "X_ViewName", "" ) != 0 )
   {
      nZRetCode = IncludeSubobjectFromSubobject( OrigWC, "CtrlMapView", OrigW, "ViewObjRef", zPOS_AFTER );
   }
   lTempInteger_2 = CheckExistenceOfEntity( OrigWC, "CtrlMapLOD_Attribute" );
   if ( lTempInteger_2 < 0 && CompareAttributeToString ( OrigWC, "CtrlMap", "X_AttributeName", "" ) != 0 )
   {
      nZRetCode = IncludeAttributeMapping( vSubtask, OrigW, OrigWC );
   }
   nZRetCode = SetAttributeFromString( OrigWC, "CtrlMap", "X_ViewName", "" );
   nZRetCode = SetAttributeFromString( OrigWC, "CtrlMap", "X_EntityName", "" );
   nZRetCode = SetAttributeFromString( OrigWC, "CtrlMap", "X_AttributeName", "" );
   nZRetCode = SetAttributeFromString( OrigWC, "CtrlMap", "X_Context", "" );
#endif
   return( 0 );
}
Exemple #5
0
zOPER_EXPORT zSHORT OPERATION
zwTZHKEYAD_IncludeOperation( zVIEW vSubtask )
{
   zVIEW vHotKeys;
   zVIEW vOperationList;
   zVIEW vOperation;

   GetViewByName( &vHotKeys, "KZHKEYSO", vSubtask, zLEVEL_TASK );
   GetViewByName( &vOperationList, "CM_List", vSubtask, zLEVEL_TASK );
   if ( ActivateMetaOI( vSubtask, &vOperation, vOperationList, zREFER_GO_META, 0 ) >= 0 )
   {
      if ( SetCursorFirstEntity( vHotKeys, "Operation", 0 ) >= zCURSOR_SET )
         ExcludeEntity( vHotKeys, "Operation", zREPOS_NONE );

      IncludeSubobjectFromSubobject( vHotKeys, "Operation",
                                     vOperation, "Operation", zPOS_FIRST );
      DropView( vOperation );
   }

   return( 0 );
}
Exemple #6
0
zOPER_EXPORT zSHORT OPERATION
UpgradeControl( zVIEW    vSubtask,
                zVIEW    OrigW,
                zVIEW    OrigWC,
                zVIEW    vType,
                zVIEW    vPE )
{
#if 0
   zLONG    lType;
   zCHAR    szTag[ 35 ];
   zSHORT   RESULT;
   zSHORT   nZRetCode;

   RESULT = SetCursorFirstEntity( OrigWC, "CtrlCtrl", "" );
   while ( RESULT >= 0 )
   {
      nZRetCode = SetViewToSubobject( OrigWC, "CtrlCtrl" );
      nZRetCode = UpgradeControl( vSubtask, OrigW, OrigWC, vType, vPE );
      nZRetCode = ResetViewFromSubobject( OrigWC );
      RESULT = SetCursorNextEntity( OrigWC, "CtrlCtrl", "" );
   }
   RESULT = SetCursorFirstEntity( OrigWC, "CtrlMap", "" );
   while ( RESULT >= 0 )
   {
      nZRetCode = UpgradeCtrlMap( vSubtask, OrigW, OrigWC );
      RESULT = SetCursorNextEntity( OrigWC, "CtrlMap", "" );
   }
   // Upgrade Control to relate to ControlDef
   if ( CheckExistenceOfEntity ( OrigWC, "ControlDef" ) < 0 )
   {
      GetIntegerFromAttribute( &lType, OrigWC, "Control", "Type" );
      SetCursorFirstEntityByInteger( vType, "Control", "Type", lType, "" );
      GetStringFromAttribute( szTag, vType, "Control", "Tag" );
      SetCursorFirstEntityByString( vPE, "ControlDef", "Tag", szTag, "" );
      IncludeSubobjectFromSubobject( OrigWC, "ControlDef", vPE, "ControlDef", zPOS_AFTER );
      SetAttributeFromString ( OrigWC, "Control", "Type", "");
   }
#endif
   return( 0 );
}
Exemple #7
0
///////////////////////////////////////////////////////////////////////
//
// PURPOSE:  This function paints the list attributes from the user spec
//           into the existing partition.
//
////////////////////////////////////////////////////////////////////////
zOPER_EXPORT zLONG OPERATION
ofnTZWDLGSO_AutoPntFldPartWLits( zVIEW  vSubtask,
                                 zVIEW  vUserSpec,
                                 zVIEW  vNewDialog,
                                 zPCHAR szListType )
{
   zVIEW  vAutoDesWk;
   zVIEW  vSubobject;
   zVIEW  vTempStyle;
   zVIEW  vCtrlDef;
   zLONG  k, j;
   zLONG  lCC, lCL;
   zLONG  lMaxLines;
   zLONG  lLine, lFirstPaintLine, lFieldsPainted, lColumn;
   zLONG  lMaxFieldDLG_X, lMaxText, lPush;
   zLONG  lGroupDLG_X, lGroupDLG_Y;
   zSHORT RESULT;
   zLONG  lLastPaintLine, lLastWindowLine, lMaxLength;
// zCHAR  cUsage[ 1 ];
   zCHAR  szMapEntity[ 33 ];
   zCHAR  szMapAttribute[ 33 ];
   zCHAR  szType[ 33 ];
   zCHAR  szWorkString[ 256 ];
   zCHAR  X_LOD_Attribute[ 16 ];
   zCHAR  X_ER_Attribute[ 15 ];

// TraceLineS( "IN", " AutoPaintPartitionWithFields" );

   // Set up variables to either I_LOD listbox or L_LOD listbox.
   if ( szListType[ 0 ] == 'I' )
   {
      zstrcpy( X_LOD_Attribute, "I_LOD_Attribute" );
      zstrcpy( X_ER_Attribute, "I_ER_Attribute" );
   }
   else
   {
      zstrcpy( X_LOD_Attribute, "L_LOD_Attribute" );
      zstrcpy( X_ER_Attribute, "L_ER_Attribute" );
   }

// TraceLineS( "IN", " AutoPaintPartitionWithFields" );

   GetViewByName( &vCtrlDef, "TZADCTLD", vNewDialog, zLEVEL_TASK );
   GetViewByName( &vAutoDesWk, "TZADWWKO", vNewDialog, zLEVEL_TASK );
   CreateViewFromViewForTask( &vSubobject, vNewDialog, 0 );

   lCL = 12;
   lCC = 5;

   /* Create a new view that will point to the UIS_ViewObjRef entity
      in the user spec object.  Sometimes vUserSpec is pointing to a
      recursive subobject and UI_ViewObjRef cannot be accessed. */
   CreateViewFromViewForTask( &vTempStyle, vUserSpec, 0 );
   ResetView( vTempStyle );

   SetViewToSubobject( vSubobject, "CtrlCtrl" );
   /* Delete any existing fields in the listbox */
   RESULT = SetCursorFirstEntity( vSubobject, "Control", "" );
   while ( RESULT > zCURSOR_UNCHANGED )
   {
      RESULT = DeleteEntity( vSubobject, "Control", zREPOS_NEXT );
   }

   GetIntegerFromAttribute( &lMaxLines, vNewDialog, "Control", "SZDLG_Y" );
   szMapEntity[ 0 ] = 0;

   lFirstPaintLine = 0;
   lLastPaintLine = 1;
   lLine          = 1;
   lMaxFieldDLG_X = 0;
   lMaxLength     = 0;
   lMaxText       = 0;
   lPush          = 0;
   lFieldsPainted = 0;

// cUsage[ 0 ] = 'U';

   /* If there is a paint object, loop through its attributes */
   RESULT = SetCursorFirstEntity( vUserSpec, X_LOD_Attribute, "" );
   while ( RESULT > zCURSOR_UNCHANGED )
   {
      /* The last line painted was at this posititon */
      lLastPaintLine = lLine;
      lColumn = 1;

      /* Create the Text Field for the Attribute */
      CreateMetaEntity( vSubtask, vSubobject, "Control", zPOS_AFTER );
      SetAttributeFromInteger( vSubobject, "Control",
                               "PSDLG_Y", lLine );
      if ( lFirstPaintLine == 0 )
         lFirstPaintLine = lLine;

      SetAttributeFromInteger( vSubobject, "Control",
                               "PSDLG_X", lColumn );
      /* Creating text field. */
      SetCursorFirstEntityByString( vCtrlDef, "ControlDef",
                                    "Tag", "Text", "" );
      IncludeSubobjectFromSubobject( vSubobject, "ControlDef",
                                     vCtrlDef, "ControlDef", zPOS_AFTER );
      // Remove the text border.
      SetAttributeFromInteger( vSubobject, "Control", "Subtype",
                               zCONTROL_BORDEROFF | zCONTROL_NOTABSTOP );
      GetStringFromAttribute( szWorkString, vUserSpec,
                              X_ER_Attribute, "ListPaintLit" );
      GetStringFromAttribute( szMapAttribute, vUserSpec,
                              X_ER_Attribute, "Name" );

      // If there is no paint literal for this attribute then
      // use the attribute name as the paint literal.
      if ( szWorkString[ 0 ] == 0 )
         zstrcpy( szWorkString, szMapAttribute );

      SetAttributeFromString( vSubobject, "Control", "Text", szWorkString );

      j = zstrlen( szWorkString );
      j = j * lCC;

      // Determine the size of the longest paint literal.
      if ( j > lMaxText )
         lMaxText = j;

      SetAttributeFromInteger( vSubobject, "Control", "SZDLG_X", j );
      SetAttributeFromInteger( vSubobject, "Control", "SZDLG_Y", lCL );

      /* Add the length of the longest paint literal
         to the column so the attribute field will be
         painted there */
      lColumn += j;
      lColumn = lColumn + lCC;

      // If there is no paint length for the field, then
      // use the field's length.
      j = ofnTZWDLGSO_GetSizeForListAttr( vSubtask, vUserSpec, szListType );

      j = j * lCC;

      // If there is no paint length for the field, then
      // use the field's length.
      if ( j > 100 )
         j = 100;
      else
      if ( j < 25 )
         j = 25;

      // Create the appropriate Data Field for the Attribute.
      CreateMetaEntity( vSubtask, vSubobject, "Control", zPOS_AFTER );

      SetAttributeFromInteger( vSubobject, "Control",
                               "PSDLG_Y",  lLine );
      SetAttributeFromInteger( vSubobject, "Control",
                               "PSDLG_X", lColumn );
      SetAttributeFromInteger( vSubobject, "Control",
                               "SZDLG_X", j );
      SetAttributeFromInteger( vSubobject, "Control",
                               "SZDLG_Y", lCL );
      // Determine the maximum column length.
      if ( lMaxFieldDLG_X < lColumn )
         lMaxFieldDLG_X = lColumn;

      lColumn += j;
      lColumn = lColumn - 1 * lCC;

      // Determine the maximum length of colum and literal.
      if ( lMaxLength < lColumn )
         lMaxLength = lColumn;

      SetCursorFirstEntityByString( vCtrlDef, "ControlDef",
                                    "Tag", "EditBox", "" );
      IncludeSubobjectFromSubobject( vSubobject, "ControlDef",
                                     vCtrlDef, "ControlDef", zPOS_AFTER );
   // SetAttributeFromInteger( vSubobject, "Control", "Type", 1010 );
      /*
      if ( cUsage[ 0 ] == 'U' )
      {
         GetStringFromAttribute( cWork, vUserSpec,
                                 X_LOD_Attribute, "DERIVEDF" );
         if ( cWork[ 0 ] != 0 )
            SetAttributeFromCharacter( vSubobject,
                                        "Control", "Type", 1000 );
      }
      */
      /* setting the group and field's ENAME and ANAME */
      CreateMetaEntity( vSubtask, vSubobject, "CtrlMap", zPOS_AFTER );

      /* set the partitions OI name */
      IncludeSubobjectFromSubobject( vSubobject, "CtrlMapView",
                                     vTempStyle, "UIS_ViewObjRef", zPOS_AFTER );
      IncludeSubobjectFromSubobject( vSubobject, "CtrlMapLOD_Attribute",
                                     vUserSpec, X_LOD_Attribute, zPOS_AFTER );
      lFieldsPainted++;
      lLine = lLine + lCL;

      RESULT = SetCursorNextEntity( vUserSpec, X_LOD_Attribute, "" );
   }

   lLastPaintLine = lLine;

   /* Get the dimensions of the partition. */
   GetIntegerFromAttribute( &lGroupDLG_X, vNewDialog, "Control", "SZDLG_X" );

   GetIntegerFromAttribute( &lGroupDLG_Y, vNewDialog, "Control", "SZDLG_Y" );

   RESULT = SetCursorFirstEntity( vSubobject, "Control", "" );
   while ( RESULT > zCURSOR_UNCHANGED )
   {
      GetIntegerFromAttribute( &lLine, vSubobject, "Control", "PSDLG_Y" );
      if ( lLine >= lFirstPaintLine && lLine <= lLastPaintLine )
      {
         GetStringFromAttribute( szType, vSubobject, "ControlDef", "Tag" );
         /* If the control is not a text control. */
         if ( zstrcmp( szType, "Text" ) != 0 )
         {
            GetIntegerFromAttribute( &j, vSubobject, "Control", "PSDLG_X" );
            GetIntegerFromAttribute( &k, vSubobject, "Control", "SZDLG_X" );

            if ( j < lMaxFieldDLG_X )
            {
               j = lMaxFieldDLG_X - j;
               if ( ( lMaxFieldDLG_X + k ) >
                    ( lMaxLength + lCC ) )
               {
                  if ( ( lMaxFieldDLG_X + k ) <= lGroupDLG_X )
                  {
                     lMaxLength = lMaxFieldDLG_X +( k - lCC );
                  }
                  else
                  {
                     j -=( ( lMaxFieldDLG_X + k ) -
                                          lGroupDLG_X );
                     if ( j > 0 )
                     {
                        AddToAttributeFromInteger( vSubobject, "Control",
                                                   "PSDLG_X", j );
                        lMaxLength = lGroupDLG_X - lCC;
                        j = -1;
                     }
                  }
               }

               if ( j > 0 )
               {
                  SetAttributeFromInteger( vSubobject, "Control",
                                           "PSDLG_X", lMaxFieldDLG_X );
               }
            }
         }

         GetIntegerFromAttribute( &j, vSubobject, "Control", "PSDLG_X" );
         GetIntegerFromAttribute( &k, vSubobject, "Control", "SZDLG_X" );
         if ( ( j + k ) >= lGroupDLG_X )
         {
            RESULT = SetCursorFirstEntity( vSubobject, "Control", "" );
            while ( RESULT > zCURSOR_UNCHANGED )
            {
               RESULT = DeleteEntity( vSubobject, "Control", zREPOS_NEXT );
            }

            MessageSend( vNewDialog, "AD10304", "Autodesigner",
                         "Partition too small( width )",
                         zMSGQ_OBJECT_CONSTRAINT_ERROR, zBEEP );

            /* the partition is not wide enough */
            return( -1 );
         }

         ///////////////////////////////////////////////////////////
         // Code to truncate fields which extend over the partition to
         // the right COMMENTED out. This is a 'too small' error as
         // noted above.
         // else
         // if ( (j + k) >= lGroupDLG_X )
         // {
         //    k =( lGroupDLG_X - 1 ) - j;
         //    SetAttributeFromInteger( vSubobject, "Control",
         //                             "SZDLG_X", k );
         // }
         ////////////////////////////////////////////////////////////
      }

      RESULT = SetCursorNextEntity( vSubobject, "Control", "" );
   }

   lLastWindowLine = lLine;

   /* If the window painted has too many lines for the
      terminal being used for painting. Attempt to
      compress the window into a more manageable size by combining
      painted fields which are located on separate lines            */

   /*
   for ( i = 1; i < 8; i++ )
   {
      if ( lLastWindowLine + 12 <= lMaxLines )
      {
         break;
      }
      fnCompressPartition( vNewDialog, i, lFirstPaintLine, lMaxText,
                           lMaxLines,
                           &lLastPaintLine, &lLastWindowLine,
                           &lMaxLength );
   }
   */

   if ( ( lLastWindowLine + lCL ) > lMaxLines )
   {
      RESULT = SetCursorFirstEntity( vSubobject, "Control", "" );
      while ( RESULT > zCURSOR_UNCHANGED )
      {
         RESULT = DeleteEntity( vSubobject, "Control", zREPOS_NEXT );
      }

      MessageSend( vNewDialog, "AD10305", "Autodesigner",
                   "Partition too small( height )",
                   zMSGQ_OBJECT_CONSTRAINT_ERROR, zBEEP );
      return( -1 );
   }

// TraceLineS( "END", " AutoPaintPartitionWithFields" );

   /* Return the last paint line for AutoDesign */
   return( lLastPaintLine );
}
Exemple #8
0
/////////////////////////////////////////////////////////////////////////////
//
// PURPOSE: This function places selected attributes in an already
// existing partition without the attributes text literals.
//
// vNewDialog - handle to the partition
// lFieldRow - offset row in the group
// lFieldCol - offset column in the group
// PartitionSize - length size for the group
//
// Return Codes:
//     0 - Everything is O.K. and the fields were placed into the
//         partition
//    -1 - The field widths exceeded the partitions width
//
/////////////////////////////////////////////////////////////////////////////
zOPER_EXPORT zSHORT OPERATION
ofnTZWDLGSO_AutoPaintListPart( zVIEW    vSubtask,
                               zVIEW    vUserSpec,
                               zVIEW    vNewDialog,
                               zLONG    lFieldRow,
                               zLONG    lFieldCol,
                               zLONG    PartitionSize,
                               zPCHAR   szListType )
{
   zVIEW    vAutoDesWk;
   zVIEW    vTempStyle;
   zVIEW    vSubobject;
   zVIEW    vCtrlDef;
   zLONG    lListAttributeLength;
   zLONG    lPaintLiteralLength;
   zLONG    lCC;
   zLONG    lCL;
   zCHAR    szControlType[ 33 ];
   zCHAR    szMapEntity[ 33 ];
   zCHAR    szParentName[ 33 ];
   zCHAR    szWorkString[ 65 ];
   zCHAR    szLiteralString[ 65 ];
   zLONG    lTempInteger_0;
   zSHORT   RESULT;
   zSHORT   lFieldsPainted;
   zLONG    lRC;
   zCHAR    X_LOD_Attribute[ 16 ];
   zCHAR    X_LOD_Entity[ 13 ];
   zCHAR    X_ER_Attribute[ 15 ];

// TraceLineS( "IN", "AutoPaintListPart W4" );

   // Set up variables to either I_LOD listbox or L_LOD listbox.
   if ( szListType[ 0 ] == 'I' )
   {
      zstrcpy( X_LOD_Attribute, "I_LOD_Attribute" );
      zstrcpy( X_LOD_Entity, "I_LOD_Entity" );
      zstrcpy( X_ER_Attribute, "I_ER_Attribute" );
   }
   else
   {
      zstrcpy( X_LOD_Attribute, "L_LOD_Attribute" );
      zstrcpy( X_LOD_Entity, "L_LOD_Entity" );
      zstrcpy( X_ER_Attribute, "L_ER_Attribute" );
   }

   lCL = 12;
   lCC = 5;

   GetViewByName( &vCtrlDef, "TZADCTLD", vNewDialog, zLEVEL_TASK );
   GetViewByName( &vAutoDesWk, "TZADWWKO", vNewDialog, zLEVEL_TASK );
   GetStringFromAttribute( szControlType, vNewDialog, "ControlDef", "Tag" );

   /* It is important to know whether the parent is a WINDOW(WDODs)
      or a SECTION(RODs). */
   zstrcpy( szParentName, "Window" );

   /* IF we are Autodesigning a ROD, set lCL to 8 so line
      skips do not take place */
   lTempInteger_0  = zstrcmp( szParentName, "SECTION" );
   if ( lTempInteger_0 == 0 )
   {
      lCL = 8;
   }

   /* Create a view that will point to the controls under the listbox. */
   CreateViewFromViewForTask( &vSubobject, vNewDialog, 0 );

   /* Set handle to the fields under the group */
   SetViewToSubobject( vSubobject, "CtrlCtrl" );

   /* Delete any existing fields in the listbox */
   RESULT = SetCursorFirstEntity( vSubobject, "Control", "" );
   while ( RESULT > zCURSOR_UNCHANGED )
   {
      RESULT = DeleteEntity( vSubobject, "Control", zREPOS_NEXT );
   }

   /* Create a new view that will point to the UIS_ViewObjRef entity
      in the user spec object.  Sometimes vUserSpec is pointing to a
      recursive subobject and UI_ViewObjRef cannot be accessed. */
   CreateViewFromViewForTask( &vTempStyle, vUserSpec, 0 );
   ResetView( vTempStyle );

   lFieldsPainted = 0;

   //// Paint the fields in the Partition //////////
   /* IF Attributes have been found to paint, paint them */
   RESULT = SetCursorFirstEntity( vUserSpec, X_LOD_Attribute, "" );
   while ( RESULT > zCURSOR_UNCHANGED )
   {
      // This gets the length of the field to be painted.
      lListAttributeLength = ofnTZWDLGSO_GetSizeForListAttr( vSubtask,
                                                             vUserSpec,
                                                             szListType );

      if ( lListAttributeLength == 0 )
         lListAttributeLength = 4;
      lListAttributeLength = lListAttributeLength * lCC;
      if ( lListAttributeLength > 100 )
         lListAttributeLength = 100;
      if ( lListAttributeLength < 25 )
         lListAttributeLength = 25;

      /* If there isn't a paint literal then use the entity name
         as the paint literal */
      GetStringFromAttribute( szLiteralString, vUserSpec,
                               X_ER_Attribute, "ListPaintLit" );
      if ( szLiteralString[ 0 ] == 0 )
         GetStringFromAttribute( szLiteralString, vUserSpec,
                                 X_ER_Attribute, "PromptPaintLit" );
      lPaintLiteralLength = zstrlen( szLiteralString );
      if ( szLiteralString[ 0 ] == 0 )
      {
         GetStringFromAttribute( szLiteralString, vUserSpec,
                                 X_ER_Attribute, "Name" );
         AddSpacesToString( szLiteralString );
         lPaintLiteralLength = zstrlen( szLiteralString ) + 1;
      }

      lPaintLiteralLength = lPaintLiteralLength * lCC;
      if ( lPaintLiteralLength > 100 )
         lPaintLiteralLength = 100;
      if ( lPaintLiteralLength < 25 )
         lPaintLiteralLength = 25;

      /* Do not continue to add fields into the partition if
         the field sizes exceed the size of the partition */
      /* If the field attribute length is greater than the text
         literal length, then add the field attribute length
         to lFieldCol. */
      if ( lPaintLiteralLength < lListAttributeLength )
      {
         /* If the length of lFieldCol is greater than the
            partition size, then delete all the fields that have
            been added and give a message to the user. */
         if ( lFieldCol + lListAttributeLength > PartitionSize )
         {
            RESULT = SetCursorFirstEntity( vSubobject, "Control", "" );
            while ( RESULT > zCURSOR_UNCHANGED )
            {
               DeleteEntity( vSubobject, "Control", zREPOS_NEXT );
               RESULT = SetCursorNextEntity( vSubobject, "Control", "" );
            }
            DropView( vSubobject );
            MessageSend( vUserSpec, "AD10302", "Autodesigner",
                         "Partition too small( width )",
                         zMSGQ_OBJECT_CONSTRAINT_ERROR, zBEEP );
            return( -1 );
         }
      }
      else
      {
      /* If the text literal length is greater than the field
         attribute length, then add the text literal length
         to lFieldCol. */

         /* If the length of lFieldCol is greater than the
            partition size, then delete all the fields that have
            been added and give a message to the user. */
         if ( lFieldCol + lPaintLiteralLength > PartitionSize )
         {
            RESULT = SetCursorFirstEntity( vSubobject, "Control", "" );
            while ( RESULT > zCURSOR_UNCHANGED )
            {
               DeleteEntity( vSubobject, "Control", zREPOS_NEXT );
               RESULT = SetCursorNextEntity( vSubobject, "Control", "" );
            }
            DropView( vSubobject );
            MessageSend( vUserSpec, "AD10303", "Autodesigner",
                         "Partition too small( width )",
                         zMSGQ_OBJECT_CONSTRAINT_ERROR, zBEEP );
            return( -1 );
         }
      }

      /* Create the partition's fields */
      CreateMetaEntity( vSubtask, vSubobject, "Control", zPOS_AFTER );
      SetAttributeFromString( vSubobject, "Control", "Text", szLiteralString );
      if ( zstrcmp( szControlType, "ListBox" ) == 0 )
      {
         SetCursorFirstEntityByString( vCtrlDef, "ControlDef",
                                       "Tag", "ListBoxCtl", "" );
         IncludeSubobjectFromSubobject( vSubobject, "ControlDef",
                                        vCtrlDef, "ControlDef", zPOS_AFTER );
      }
      else
      {
         SetCursorFirstEntityByString( vCtrlDef, "ControlDef",
                                       "Tag", "Text", "" );
         IncludeSubobjectFromSubobject( vSubobject, "ControlDef",
                                        vCtrlDef, "ControlDef", zPOS_AFTER );
      }
      // Set the tag
      ofnTZWDLGSO_AssignTag( vSubtask, vNewDialog, vSubobject, "ListCtrl" );
/*    GetStringFromAttribute( szTag, vUserSpec, X_ER_Attribute, "Name" );
      szTag[ 30 ] = 0;

      lFieldsPainted = lFieldsPainted + 1;
      zltoa( lFieldsPainted, szWork );
      zstrcat( szTag, szWork );
      SetAttributeFromString( vSubobject, "Control", "Tag", szTag );
*/
      SetAttributeFromInteger( vSubobject, "Control", "SZDLG_X",
                               lListAttributeLength );
      SetAttributeFromInteger( vSubobject, "Control", "SZDLG_Y",  lCL );

      /* If the domain is an integer or a long, then right justify. */
      /*
      IF vUserSpec.L_Domain.DerivedDataType = 'I' OR
         vUserSpec.L_Domain.DerivedDataType = 'L' OR
         vUserSpec.L_Domain.DerivedDataType = 'M'
         vNewDialog.FLAGFLD.RJUST = 'Y'
      END
      */

      GetStringFromAttribute( szMapEntity, vUserSpec, "LOD_Entity", "Name" );
      GetStringFromAttribute( szWorkString, vUserSpec, X_LOD_Entity, "Name" );
      /* If this LISTATTRIB is from a different ENTITY than the
         current ENTITY, then make sure the value gets mapped. */
      lRC = zstrcmp( szWorkString, "" );
      if ( lRC != 0 )
      {
         lRC = zstrcmp( szWorkString, szMapEntity );
         if ( lRC == 0 )
         {
            zstrcpy( szMapEntity, szWorkString );
         }
      }

      /* setting the group and field's ENAME and ANAME */
      CreateMetaEntity( vSubtask, vSubobject, "CtrlMap", zPOS_AFTER );

      /* set the partitions OI name */
      if ( szListType[ 0 ] == 'I' )
         IncludeSubobjectFromSubobject( vSubobject, "CtrlMapView",
                                        vUserSpec, "ListViewObjRef", zPOS_AFTER );
      else
         IncludeSubobjectFromSubobject( vSubobject, "CtrlMapView",
                                        vTempStyle, "UIS_ViewObjRef", zPOS_AFTER );

      IncludeSubobjectFromSubobject( vSubobject, "CtrlMapLOD_Attribute",
                                     vUserSpec, X_LOD_Attribute, zPOS_AFTER );

      /* lFieldRow should always stay the same */
      SetAttributeFromInteger( vSubobject, "Control", "PSDLG_X", lFieldCol );
      SetAttributeFromInteger( vSubobject, "Control", "PSDLG_Y", lFieldRow );

      /* If the field length is longer than the paint literal,
         then position the next field by using the field length,
         otherwise position the next field by using the paint
         literal length */
      if ( lPaintLiteralLength < lListAttributeLength )
      {
         lFieldCol = lFieldCol + lListAttributeLength + lCC;
      }
      else
      {
         lFieldCol = lFieldCol + lPaintLiteralLength + lCC;
      }
      RESULT = SetCursorNextEntity( vUserSpec, X_LOD_Attribute, "" );
   }

   DropView( vSubobject );
   DropView( vTempStyle );
// TraceLineS("END", "AutoPaintListPart W4" );
   return( 0 );
}
Exemple #9
0
/////////////////////////////////////////////////////////////////////////////
//
// PURPOSE: This function places the paint literals of selected
// attributes above the fields in a partition or list box.
//
// vNewDialog - handle to the group
// OffsetDLG_Y - offset row to the group
// OffsetDLG_X - offset column to the group
// PartitionSize - length size of the group
//
// Return Codes:
//     0 - Everything is O.K. and the literals were placed into the
//         partition
//    -1 - The literal widths exceeded the partitions width
//
////////////////////////////////////////////////////////////////////
zOPER_EXPORT zSHORT OPERATION
ofnTZWDLGSO_AutoPaintLstLitPart( zVIEW    vSubtask,
                                 zVIEW    vUserSpec,
                                 zVIEW    vNewDialog,
                                 zLONG    OffsetDLG_Y,
                                 zLONG    OffsetDLG_X,
                                 zLONG    PartitionSize,
                                 zPCHAR   szListType )
{
   zVIEW    vCtrlDef;
   zLONG    lCC;
   zLONG    lCL;
   zLONG    lFieldCol;
   zLONG    lListAttributeLength;
   zLONG    lPaintLiteralLength;
   zCHAR    sPaintLiteral[ 65 ];
   zSHORT   RESULT;
   zLONG    lTempInteger_1;
   zLONG    lTempInteger_2;
   zCHAR    X_LOD_Attribute[ 16 ];
   zCHAR    X_ER_Attribute[ 15 ];

// TraceLineS("IN", "AutoPaintLstListPart W4" );

   // Set up variables to either I_LOD listbox or L_LOD listbox.
   if ( szListType[ 0 ] == 'I' )
   {
      zstrcpy( X_LOD_Attribute, "I_LOD_Attribute" );
      zstrcpy( X_ER_Attribute, "I_ER_Attribute" );
   }
   else
   {
      zstrcpy( X_LOD_Attribute, "L_LOD_Attribute" );
      zstrcpy( X_ER_Attribute, "L_ER_Attribute" );
   }

   lCC = 5;
   lCL = 12;

   GetViewByName( &vCtrlDef, "TZADCTLD", vNewDialog, zLEVEL_TASK );

   lFieldCol = 1;

   RESULT = SetCursorFirstEntity( vUserSpec, X_LOD_Attribute, "" );
   while ( RESULT > zCURSOR_UNCHANGED )
   {
      /* This gets the length of the field to be painted */
      lListAttributeLength = ofnTZWDLGSO_GetSizeForListAttr( vSubtask,
                                                             vUserSpec,
                                                             szListType );

      lListAttributeLength = lListAttributeLength * lCC;
      /* Limit the size of the attribute length. */
      if ( lListAttributeLength > 100 )
         lListAttributeLength = 100;
      if ( lListAttributeLength < 25 )
         lListAttributeLength = 25;

      /* Get the paint literal */
      GetStringFromAttribute( sPaintLiteral, vUserSpec,
                               X_ER_Attribute, "ListPaintLit" );
      if ( sPaintLiteral[ 0 ] == 0 )
         GetStringFromAttribute( sPaintLiteral, vUserSpec,
                                 X_ER_Attribute, "PromptPaintLit" );
      if ( sPaintLiteral[ 0 ] == 0 )
      {
         GetStringFromAttribute( sPaintLiteral, vUserSpec,
                                  X_ER_Attribute, "Name" );
         /* Add a ':' to the end. */
         zstrcat( sPaintLiteral, ":" );
         /* Add spaces before any capital letters. */
         AddSpacesToString( sPaintLiteral );
      }

      lPaintLiteralLength = zstrlen( sPaintLiteral );
      lPaintLiteralLength = lPaintLiteralLength * lCC;
      /* Limit the size of the literal length. */
      if ( lPaintLiteralLength > 100 )
         lPaintLiteralLength = 100;
      if ( lPaintLiteralLength < 25 )
         lPaintLiteralLength = 25;

      /*
      lTempInteger_1 = CheckForOverlappingFields( vNewDialog, OffsetDLG_Y,
                                                   OffsetDLG_Y + nCL,
                                                   lFieldCol + OffsetDLG_X - lCC, lFieldCol + OffsetDLG_X + lPaintLiteralLength - lCC );
      */

      lTempInteger_1 = 0;
      /* Check to see IF there is a field or group located above
         the listbox that would be in the way of painting the literals */
      if ( lTempInteger_1 == -1 )
      {
         /* Cannot place text fields above the listbox because of
            either a field or a group */
         /* InformationMessage( "Field literals can't fit because of FIELD or GROUP" ); */
         MessageSend( vUserSpec, "AD10301", "Autodesigner",
                      "Field literals can't fit because of FIELD or GROUP",
                      zMSGQ_OBJECT_CONSTRAINT_ERROR, zBEEP );
         return( -1 );
      }

      /* Add the listbox literals at the end of the client fields.
         This makes a difference in fnCompressWindow in autodesigning.*/
      SetCursorLastEntity( vNewDialog, "Control", "" );

      /* Do not continue to add fields into the list box if
         the field sizes exceed the size of the list box */
      /* If the field attribute length is greater than the text
         literal length, then add the field attribute length
         to lFieldCol. */
      if ( lPaintLiteralLength < lListAttributeLength )
      {
         /* If the length of lFieldCol is greater than the
            partition size, then RETURN */
         if ( lFieldCol + lListAttributeLength > PartitionSize )
         {
            return( 1 );
         }
      }
      else
      {
         /* If the length of lFieldCol is greater than the
            partition size, then RETURN */
         if ( lFieldCol + lPaintLiteralLength > PartitionSize )
         {
            return( 1 );
         }
      }

      /* Create literals for the list box */
      CreateMetaEntity( vSubtask, vNewDialog, "Control", zPOS_AFTER );
      SetCursorFirstEntityByString( vCtrlDef, "ControlDef", "Tag", "Text", "" );
      IncludeSubobjectFromSubobject( vNewDialog, "ControlDef",
                                     vCtrlDef, "ControlDef", zPOS_AFTER );

      /* Remove the text border. */
      SetAttributeFromInteger( vNewDialog, "Control", "Subtype",
                               zCONTROL_BORDEROFF | zCONTROL_NOTABSTOP );
      SetAttributeFromInteger( vNewDialog, "Control",
                               "PSDLG_Y", OffsetDLG_Y );
      lTempInteger_2 = OffsetDLG_X + lFieldCol - lCC;
      SetAttributeFromInteger( vNewDialog, "Control",
                               "PSDLG_X", lTempInteger_2 );
      SetAttributeFromInteger( vNewDialog, "Control",
                               "SZDLG_X", lPaintLiteralLength );
      SetAttributeFromInteger( vNewDialog, "Control",
                               "SZDLG_Y", 10 );

      ofnTZWDLGSO_AssignTag( vSubtask, vNewDialog, vNewDialog, "ListText" );
      SetAttributeFromString( vNewDialog, "Control",
                              "Text", sPaintLiteral );

      /* If the field length is longer than the paint literal,
         then position the next field by using the field length,
         otherwise position the next field by using the paint
         literal length */
      if ( lPaintLiteralLength < lListAttributeLength )
      {
         lFieldCol = lFieldCol + lListAttributeLength + lCC;
      }
      else
      {
         lFieldCol = lFieldCol + lPaintLiteralLength + lCC;
      }
      RESULT = SetCursorNextEntity( vUserSpec, X_LOD_Attribute, "" );
   }
// TraceLineS("END", "AutoPaintLstListPart W4" );

   return( 0 );
}
Exemple #10
0
//:   VIEW TZZOLODO  REGISTERED AS TZZOLODO
zOPER_EXPORT zSHORT OPERATION
EntityChanged( zVIEW     vSubtask )
{
   zVIEW     TZZOLODO = 0; 
   zSHORT    RESULT; 
   //:VIEW TZTENVRO  REGISTERED AS TZTENVRO
   zVIEW     TZTENVRO = 0; 
   //:SHORT nIsCheckedOut
   zSHORT    nIsCheckedOut = 0; 
   zSHORT    lTempInteger_0; 
   zSHORT    lTempInteger_1; 
   zCHAR     szTempString_0[ 201 ]; 
   zCHAR     szTempString_1[ 2 ]; 
   zCHAR     szTempString_2[ 201 ]; 

   RESULT = GetViewByName( &TZZOLODO, "TZZOLODO", vSubtask, zLEVEL_TASK );
   RESULT = GetViewByName( &TZTENVRO, "TZTENVRO", vSubtask, zLEVEL_TASK );

   //:nIsCheckedOut = ComponentIsCheckedOut( vSubtask, TZZOLODO, zSOURCE_LOD_META )
   nIsCheckedOut = ComponentIsCheckedOut( vSubtask, TZZOLODO, zSOURCE_LOD_META );

   //:IF nIsCheckedOut = 1
   if ( nIsCheckedOut == 1 )
   { 
      //:// do not allow any input to the Join checkbox, if we are on the root
      //://  or if the currrent LOD entity is work or if the currrent LOD entity is derived
      //:IF TZZOLODO.ER_RelLinkRec EXISTS AND TZZOLODO.LOD_EntityParent.Work != "Y"
      lTempInteger_0 = CheckExistenceOfEntity( TZZOLODO, "ER_RelLinkRec" );
      //:   AND TZZOLODO.LOD_EntityParent.Derived != "Y"
      if ( lTempInteger_0 == 0 && CompareAttributeToString( TZZOLODO, "LOD_EntityParent", "Work", "Y" ) != 0 && CompareAttributeToString( TZZOLODO, "LOD_EntityParent", "Derived", "Y" ) != 0 )
      { 

         //:// Set the cursor to the POD_Entity for the current TE Source.
         //:SET CURSOR FIRST TZZOLODO.POD_Entity
         //:           WHERE  TZZOLODO.TE_DBMS_SourceForEntity.ZKey = TZTENVRO.TE_DBMS_Source.ZKey
         RESULT = SetCursorFirstEntity( TZZOLODO, "POD_Entity", "" );
         if ( RESULT > zCURSOR_UNCHANGED )
         { 
            while ( RESULT > zCURSOR_UNCHANGED && ( CompareAttributeToAttribute( TZZOLODO, "TE_DBMS_SourceForEntity", "ZKey", TZTENVRO, "TE_DBMS_Source", "ZKey" ) != 0 ) )
            { 
               RESULT = SetCursorNextEntity( TZZOLODO, "POD_Entity", "" );
            } 

         } 


         //:IF RESULT < zCURSOR_SET
         if ( RESULT < zCURSOR_SET )
         { 
            //:// POD_Entity doesn't exist so create one.
            //:CREATE ENTITY TZZOLODO.POD_Entity
            RESULT = CreateEntity( TZZOLODO, "POD_Entity", zPOS_AFTER );

            //:TZZOLODO.POD_Entity.SQL_JoinWithParent = "N"
            SetAttributeFromString( TZZOLODO, "POD_Entity", "SQL_JoinWithParent", "N" );
            //:INCLUDE TZZOLODO.TE_DBMS_SourceForEntity FROM TZTENVRO.TE_DBMS_Source
            RESULT = IncludeSubobjectFromSubobject( TZZOLODO, "TE_DBMS_SourceForEntity", TZTENVRO, "TE_DBMS_Source", zPOS_AFTER );
         } 

         //:END

         //:// not the root and not work and not derived
         //:SetCtrlState( vSubtask,      "JoinCheck", zCONTROL_STATUS_ENABLED, TRUE )
         SetCtrlState( vSubtask, "JoinCheck", zCONTROL_STATUS_ENABLED, TRUE );
         //:ELSE
      } 
      else
      { 
         //:SetCtrlState( vSubtask,      "JoinCheck", zCONTROL_STATUS_ENABLED, FALSE )
         SetCtrlState( vSubtask, "JoinCheck", zCONTROL_STATUS_ENABLED, FALSE );
      } 

      //:END

      //:// Refresh checkbox and set the string being displayed.
      //:IF  TZZOLODO.POD_Entity EXISTS
      lTempInteger_1 = CheckExistenceOfEntity( TZZOLODO, "POD_Entity" );
      if ( lTempInteger_1 == 0 )
      { 
         //: TZZOLODO.LOD_EntityParent.WorkString = TZZOLODO.LOD_EntityParent.Name +
         //:                                        " JOIN = " + TZZOLODO.POD_Entity.SQL_JoinWithParent
         GetStringFromAttribute( szTempString_0, TZZOLODO, "LOD_EntityParent", "Name" );
         ZeidonStringConcat( szTempString_0, 1, 0, " JOIN = ", 1, 0, 201 );
         GetVariableFromAttribute( szTempString_1, 0, 'S', 2, TZZOLODO, "POD_Entity", "SQL_JoinWithParent", "", 0 );
         ZeidonStringConcat( szTempString_0, 1, 0, szTempString_1, 1, 0, 201 );
         SetAttributeFromString( TZZOLODO, "LOD_EntityParent", "WorkString", szTempString_0 );
         //:ELSE
      } 
      else
      { 
         //: TZZOLODO.LOD_EntityParent.WorkString = TZZOLODO.LOD_EntityParent.Name + " JOIN = N"
         GetStringFromAttribute( szTempString_2, TZZOLODO, "LOD_EntityParent", "Name" );
         ZeidonStringConcat( szTempString_2, 1, 0, " JOIN = N", 1, 0, 201 );
         SetAttributeFromString( TZZOLODO, "LOD_EntityParent", "WorkString", szTempString_2 );
      } 

      //:END
   } 

   //:END

   //:RefreshCtrl( vSubtask, "JoinCheck" )
   RefreshCtrl( vSubtask, "JoinCheck" );
   //:RefreshCtrl( vSubtask, "edDescription" )
   RefreshCtrl( vSubtask, "edDescription" );
   //:RefreshCtrl( vSubtask, "cbDerived" )
   RefreshCtrl( vSubtask, "cbDerived" );
   //:RefreshCtrl( vSubtask, "cbWork" )
   RefreshCtrl( vSubtask, "cbWork" );
   return( 0 );
// END
} 
Exemple #11
0
/////////////////////////////////////////////////////////////////////////////
//
// ENTRY:   CreateListBox
//
// PURPOSE: This function creates a listbox with the given
//          specifications and then autodesigns this listbox with
//          the LISTATTRIB attributes for the listbox's entity.
//          In addition to auto designing the listbox's fields, any
//          actions defined for the listbox(in the style object)
//          get autodesigned.
//
/////////////////////////////////////////////////////////////////////////////
zOPER_EXPORT zSHORT OPERATION
ofnTZWDLGSO_CreateListBox( zVIEW    vSubtask,
                           zVIEW    vNewDialog,
                           zVIEW    vUserSpec,
                           zLONG    lStart_X,
                           zLONG    lStart_Y,
                           zLONG    lHeight,
                           zPCHAR   szListType )
{
   zVIEW    vCtrlDef;
   zVIEW    vTZPNCTWO;
   zLONG    lTotalLth;
   zLONG    lAttribLth;
   zLONG    lPaintLth;
   zLONG    lCC;
   zLONG    lCL;
   zSHORT   RESULT;
   zCHAR    szPaintStr[ 50 ];
   zCHAR    X_LOD_Attribute[ 16 ];
   zCHAR    X_ER_Attribute[ 15 ];

// TraceLineS("IN", "AutoPaintLstListPart W4" );

   // Set up variables to either I_LOD listbox or L_LOD listbox.
   if ( szListType[ 0 ] == 'I' )
   {
      strcpy_s( X_LOD_Attribute, zsizeof( X_LOD_Attribute ), "I_LOD_Attribute" );
      strcpy_s( X_ER_Attribute, zsizeof( X_ER_Attribute ), "I_ER_Attribute" );
   }
   else
   {
      strcpy_s( X_LOD_Attribute, zsizeof( X_LOD_Attribute ), "L_LOD_Attribute" );
      strcpy_s( X_ER_Attribute, zsizeof( X_ER_Attribute ), "L_ER_Attribute" );
   }

   lCC = 5;
   lCL = 12;
   GetViewByName( &vCtrlDef, "TZADCTLD", vNewDialog, zLEVEL_TASK );

// TraceLineS("IN", "CreateListBox W3" );
   /* Create the listbox. */
   CreateMetaEntity( vSubtask, vNewDialog, "Control", zPOS_AFTER );

   SetCursorFirstEntityByString( vCtrlDef, "ControlDef", "Tag", "ListBox", "" );
   IncludeSubobjectFromSubobject( vNewDialog, "ControlDef",
                                  vCtrlDef, "ControlDef", zPOS_AFTER );
   SetAttributeFromInteger( vNewDialog, "Control", "PSDLG_X", lStart_X );
   SetAttributeFromInteger( vNewDialog, "Control", "PSDLG_Y", lStart_Y );

   // We must set the CtrlBOI.
   ActivateEmptyObjectInstance( &vTZPNCTWO, "TZPNCTWO",
                                vUserSpec, zSINGLE );
   CreateEntity( vTZPNCTWO, "TZPNCTWO", zPOS_AFTER );
   CreateEntity( vTZPNCTWO, "ListBox", zPOS_AFTER );
   SetAttributeFromInteger( vTZPNCTWO, "ListBox", "Subtype", 8192 );

   // Set Control.CtrlBOI from work entity GroupBox
   SetBlobFromEntityAttributes( vNewDialog, "Control",
                                 "CtrlBOI", vTZPNCTWO, "ListBox" );
   DropView( vTZPNCTWO );

   // Set the control subtype to 0(Single).
   SetAttributeFromInteger( vNewDialog, "Control", "Subtype", 8192 );

   lTotalLth = 0;

   if ( CheckExistenceOfEntity ( vUserSpec, X_LOD_Attribute ) != 0 )
      lTotalLth = 5;

   // Loop through the L_LOD_Attribute and find the total width needed
   // for this listbox.
   RESULT = SetCursorFirstEntity( vUserSpec, X_LOD_Attribute, "" );
   while ( RESULT > zCURSOR_UNCHANGED )
   {
      lAttribLth = ofnTZWDLGSO_GetSizeForListAttr( vSubtask, vUserSpec,
                                                   szListType );

      if ( lAttribLth > 20 )
         lAttribLth = 20;

      if ( lAttribLth < 5 )
         lAttribLth = 5;

      GetStringFromAttribute( szPaintStr, zsizeof( szPaintStr ), vUserSpec,
                              X_ER_Attribute, "ListPaintLit" );
      if ( szPaintStr[ 0 ] == 0 )
      {
         GetStringFromAttribute( szPaintStr, zsizeof( szPaintStr ), vUserSpec,
                                 X_ER_Attribute, "PromptPaintLit" );
      }
      if ( szPaintStr[ 0 ] == 0 )
      {
         GetStringFromAttribute( szPaintStr, zsizeof( szPaintStr ), vUserSpec,
                                 X_ER_Attribute, "Name" );
         /* Add a ':' to the end. */
         strcat_s( szPaintStr, zsizeof( szPaintStr ), ":" );
         /* Add spaces before any capital letters. */
         AddSpacesToString( szPaintStr );
      }
      lPaintLth = zstrlen( szPaintStr );
      if ( lPaintLth > 20 )
         lPaintLth = 20;
      if ( lPaintLth < 5 )
         lPaintLth = 5;

      if ( lAttribLth > lPaintLth )
         lTotalLth = lTotalLth + lAttribLth + 1;
      else
         lTotalLth = lTotalLth + lPaintLth + 1;

      RESULT = SetCursorNextEntity( vUserSpec, X_LOD_Attribute, "" );
   }

   lTotalLth ++;

   SetAttributeFromInteger( vNewDialog, "Control",
                            "SZDLG_X", lTotalLth * lCC );
   SetAttributeFromInteger( vNewDialog, "Control", "SZDLG_Y", lHeight );

// TraceLineS("END", "CreateListBox W3" );
   return( 0 );
}