home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Visual Database / IShield for Visual C++ 6.0 / DATA1.CAB / Include_Files / SDCOMDL2.RUL < prev    next >
Encoding:
Text File  |  1997-11-20  |  8.8 KB  |  230 lines

  1.  
  2.  /*=======================================================================*/
  3.  /*                                                                       */
  4.  /*           (c) InstallShield Software Corporation (1996-1997)          */
  5.  /*            (c)  InstallShield Corporation  (1990-1996)                */
  6.  /*                       Schaumburg, Illinois 60173                      */
  7.  /*                          All Rights Reserved                          */
  8.  /*                           InstallShield (R)                           */
  9.  /*                                                                       */
  10.  /*   File    : sdcomdl2.rul                                              */
  11.  /*                                                                       */
  12.  /*   Purpose : This file contains the code for the SdComponentDialog2    */
  13.  /*             script dialog function.                                   */
  14.  /*                                                                       */
  15.  /*=======================================================================*/
  16.  
  17.  /*------------------------------------------------------------------------*/
  18.  /*                                                                        */
  19.  /*   Function: SdComponentDialog2                                         */
  20.  /*                                                                        */
  21.  /*   Descrip:  This dialog will let user choose different parts of the    */
  22.  /*             software to install based on the components and sub        */
  23.  /*             components.                                                */
  24.  /*   Misc:                                                                */
  25.  /*                                                                        */
  26.  /*------------------------------------------------------------------------*/
  27. function SdComponentDialog2( szTitle, szMsg, szTargetDir, szComponents )
  28.           STRING  szDlg, szTemp;
  29.           HWND    hwndDlg, hwndListBox;
  30.           BOOL    bDone;
  31.           NUMBER  nId, nTemp, nParentView;
  32.         begin
  33.  
  34.            szDlg     = SD_DLG_COMPONENTDIALOG2;
  35.            nSdDialog = SD_NDLG_COMPONENTDIALOG2;
  36.  
  37.            // record data produced by this dialog
  38.            if (MODE=SILENTMODE) then
  39.              SdMakeName( szAppKey, szDlg, szTitle, nSdComponentDialog2 );
  40.              SilentReadData( szAppKey, "Result", DATA_NUMBER, szTemp, nId );
  41.              if ((nId != BACK) && (nId != CANCEL)) then
  42.                 SilentReadData( szAppKey, "Component", DATA_COMPONENT, szComponents, nTemp );
  43.              endif;
  44.  
  45.              return nId;
  46.            endif;
  47.  
  48.            // ensure general initialization is complete
  49.            if (!bSdInit) then
  50.               SdInit();
  51.            endif;
  52.  
  53.            if (EzDefineDialog( szDlg, "", "", SD_NDLG_COMPONENTDIALOG2 ) = DLG_ERR) then
  54.               return -1;
  55.            endif;
  56.  
  57.  
  58.            // Loop in dialog until the user selects a standard button
  59.            bDone = FALSE;
  60.  
  61.            while (!bDone)
  62.  
  63.               nId = WaitOnDialog( szDlg );
  64.  
  65.               switch (nId)
  66.               case DLG_INIT:
  67.  
  68.                    if( szMsg != "" ) then
  69.                        SdSetStatic( szDlg, SD_COMPONENT_MSG, szMsg );
  70.                    endif;
  71.  
  72.                    hwndDlg = CmdGetHwndDlg( szDlg );
  73.                    SdGeneralInit( szDlg, hwndDlg, STYLE_NORMAL, szSdProduct );
  74.  
  75.                    if(szTitle != "") then
  76.                        SetWindowText(hwndDlg, szTitle);
  77.                    endif;
  78.  
  79.                    nParentView = SdCreateComponentView( hwndDlg, SD_LISTBOX, szComponents, szTargetDir );
  80.                    if (!nParentView) then
  81.                        SdError( -1, "SdComponentDialog2" );
  82.                        nId = -1;
  83.                        bDone = TRUE;
  84.                    endif;
  85.  
  86.                    ComponentViewRefresh( nParentView,0 );
  87.  
  88.                    hwndListBox = GetDlgItem( hwndDlg, SD_LISTBOX );
  89.                    SetFocus( hwndListBox );
  90.  
  91.  
  92.               case SD_PBUT_CHANGE:
  93.  
  94.                    if( SdComponentDialogEx( szDlg, hwndDlg, nParentView, szComponents, szTargetDir ) < 0 ) then
  95.                        bDone = TRUE;
  96.                     endif;
  97.                    ComponentViewRefresh( nParentView, 0);
  98.  
  99.                    hwndListBox = GetDlgItem( hwndDlg, SD_LISTBOX );
  100.                    SetFocus( hwndListBox );
  101.  
  102.               case SD_PBUT_OK:
  103.                    if( StrCompare(szTargetDir, "") && !SdComponentDlgCheckSpace( szComponents, szDlg, szTargetDir ) ) then
  104.                       MessageBox( szSdStr_NotEnoughSpace, WARNING );
  105.                    else
  106.                       nId   = OK;
  107.                       bDone = TRUE;
  108.  
  109.                    endif;
  110.  
  111.               case BACK:
  112.                    nId    = BACK;
  113.                    bDone  = TRUE;
  114.  
  115.               case DLG_ERR:
  116.                    SdError( -1, "SdComponentDialog2" );
  117.                    nId   = -1;
  118.                    bDone = TRUE;
  119.  
  120.               case DLG_CLOSE:
  121.                    SdCloseDlg( hwndDlg, nId, bDone );
  122.  
  123.               default:
  124.                    // check standard handling
  125.                    if (SdIsStdButton( nId ) && SdDoStdButton( nId )) then
  126.                        bDone = TRUE;
  127.                    endif;
  128.               endswitch;
  129.  
  130.            endwhile;
  131.  
  132.            EndDialog( szDlg );
  133.            ReleaseDialog( szDlg );
  134.            ComponentViewDestroy( nParentView );
  135.  
  136.            SdUnInit( );
  137.  
  138.            // record data produced by this dialog
  139.            SdMakeName( szAppKey, szDlg, szTitle, nSdComponentDialog );
  140.            SilentWriteData( szAppKey, "Component", DATA_COMPONENT, szComponents, nTemp );
  141.            SilentWriteData( szAppKey, "Result", DATA_NUMBER, "", nId );
  142.  
  143.            return nId;
  144.  
  145.         end;
  146.  
  147.  
  148.  
  149.  /*------------------------------------------------------------------------*/
  150.  /*                                                                        */
  151.  /*   Function: SdComponentDialogEx                                        */
  152.  /*                                                                        */
  153.  /*   Descrip:  This dialog will show a 2nd level of componetns based      */
  154.  /*             on the current selection in the main dialog.               */
  155.  /*   Misc:                                                                */
  156.  /*                                                                        */
  157.  /*------------------------------------------------------------------------*/
  158. function SdComponentDialogEx( szDlg, hwndParentDlg, nParentView, szComponents, szTargetDir )
  159.           NUMBER   nId, nChildView;
  160.           HWND     hwndDlg, hwndListBox;
  161.           BOOL     bDone;
  162.         begin
  163.  
  164.            szDlg = SD_DLG_COMPONENTDIALOGEX;
  165.  
  166.            if (EzDefineDialog( szDlg,
  167.                                "",
  168.                                "",
  169.                                SD_NDLG_COMPONENTDIALOGEX ) = DLG_ERR) then
  170.               return -1;
  171.            endif;
  172.  
  173.  
  174.            // Loop in dialog until the user selects a standard button
  175.            bDone = FALSE;
  176.  
  177.            while (!bDone)
  178.  
  179.               nId = WaitOnDialog( szDlg );
  180.  
  181.               switch (nId)
  182.               case DLG_INIT:
  183.  
  184.                    hwndDlg = CmdGetHwndDlg( szDlg );
  185.                    SdGeneralInit( szDlg, hwndDlg, STYLE_NORMAL, szSdProduct );
  186.  
  187.                    nChildView = SdCreateComponentView( hwndDlg, SD_LISTBOX, szComponents, szTargetDir );
  188.                    if (!nChildView) then
  189.                        SdError( -1, "SdComponentDialogEx" );
  190.                        nId = -1;
  191.                        bDone = TRUE;
  192.                    endif;
  193.  
  194.                    // Connect the parent view with the child view
  195.                    ComponentViewSetInfo( nChildView, COMPONENT_VIEW_PARENTVIEW, nParentView,  "" );
  196.                    ComponentViewSetInfo( nParentView, COMPONENT_VIEW_CHILDVIEW, nChildView,  "" );
  197.                    ComponentViewRefresh( nParentView, 0 );
  198.  
  199.                    hwndListBox = GetDlgItem( hwndDlg, SD_LISTBOX );
  200.                    SetFocus( hwndListBox );
  201.  
  202.               case SD_PBUT_CONTINUE:
  203.                    nId   = OK;
  204.                    bDone = TRUE;
  205.  
  206.               case DLG_ERR:
  207.                    SdError( -1, "SdComponentDialogEx" );
  208.                    nId   = -1;
  209.                    bDone = TRUE;
  210.  
  211.               case DLG_CLOSE:
  212.                    SdCloseDlg( hwndDlg, nId, bDone );
  213.  
  214.               default:
  215.                    // check standard handling
  216.                    if (SdIsStdButton( nId ) && SdDoStdButton( nId )) then
  217.                        bDone = TRUE;
  218.                    endif;
  219.               endswitch;
  220.  
  221.            endwhile;
  222.  
  223.            EndDialog( szDlg );
  224.            ReleaseDialog( szDlg );
  225.            ComponentViewDestroy( nChildView );
  226.  
  227.            return nId;
  228.  
  229.         end;
  230.