home *** CD-ROM | disk | FTP | other *** search
-
- /*=======================================================================*/
- /* */
- /* (c) InstallShield Software Corporation (1996-1997) */
- /* (c) InstallShield Corporation (1990-1996) */
- /* Schaumburg, Illinois 60173 */
- /* All Rights Reserved */
- /* InstallShield (R) */
- /* */
- /* File : sdcomdl2.rul */
- /* */
- /* Purpose : This file contains the code for the SdComponentDialog2 */
- /* script dialog function. */
- /* */
- /*=======================================================================*/
-
- /*------------------------------------------------------------------------*/
- /* */
- /* Function: SdComponentDialog2 */
- /* */
- /* Descrip: This dialog will let user choose different parts of the */
- /* software to install based on the components and sub */
- /* components. */
- /* Misc: */
- /* */
- /*------------------------------------------------------------------------*/
- function SdComponentDialog2( szTitle, szMsg, szTargetDir, szComponents )
- STRING szDlg, szTemp;
- HWND hwndDlg, hwndListBox;
- BOOL bDone;
- NUMBER nId, nTemp, nParentView;
- begin
-
- szDlg = SD_DLG_COMPONENTDIALOG2;
- nSdDialog = SD_NDLG_COMPONENTDIALOG2;
-
- // record data produced by this dialog
- if (MODE=SILENTMODE) then
- SdMakeName( szAppKey, szDlg, szTitle, nSdComponentDialog2 );
- SilentReadData( szAppKey, "Result", DATA_NUMBER, szTemp, nId );
- if ((nId != BACK) && (nId != CANCEL)) then
- SilentReadData( szAppKey, "Component", DATA_COMPONENT, szComponents, nTemp );
- endif;
-
- return nId;
- endif;
-
- // ensure general initialization is complete
- if (!bSdInit) then
- SdInit();
- endif;
-
- if (EzDefineDialog( szDlg, "", "", SD_NDLG_COMPONENTDIALOG2 ) = DLG_ERR) then
- return -1;
- endif;
-
-
- // Loop in dialog until the user selects a standard button
- bDone = FALSE;
-
- while (!bDone)
-
- nId = WaitOnDialog( szDlg );
-
- switch (nId)
- case DLG_INIT:
-
- if( szMsg != "" ) then
- SdSetStatic( szDlg, SD_COMPONENT_MSG, szMsg );
- endif;
-
- hwndDlg = CmdGetHwndDlg( szDlg );
- SdGeneralInit( szDlg, hwndDlg, STYLE_NORMAL, szSdProduct );
-
- if(szTitle != "") then
- SetWindowText(hwndDlg, szTitle);
- endif;
-
- nParentView = SdCreateComponentView( hwndDlg, SD_LISTBOX, szComponents, szTargetDir );
- if (!nParentView) then
- SdError( -1, "SdComponentDialog2" );
- nId = -1;
- bDone = TRUE;
- endif;
-
- ComponentViewRefresh( nParentView,0 );
-
- hwndListBox = GetDlgItem( hwndDlg, SD_LISTBOX );
- SetFocus( hwndListBox );
-
-
- case SD_PBUT_CHANGE:
-
- if( SdComponentDialogEx( szDlg, hwndDlg, nParentView, szComponents, szTargetDir ) < 0 ) then
- bDone = TRUE;
- endif;
- ComponentViewRefresh( nParentView, 0);
-
- hwndListBox = GetDlgItem( hwndDlg, SD_LISTBOX );
- SetFocus( hwndListBox );
-
- case SD_PBUT_OK:
- if( StrCompare(szTargetDir, "") && !SdComponentDlgCheckSpace( szComponents, szDlg, szTargetDir ) ) then
- MessageBox( szSdStr_NotEnoughSpace, WARNING );
- else
- nId = OK;
- bDone = TRUE;
-
- endif;
-
- case BACK:
- nId = BACK;
- bDone = TRUE;
-
- case DLG_ERR:
- SdError( -1, "SdComponentDialog2" );
- nId = -1;
- bDone = TRUE;
-
- case DLG_CLOSE:
- SdCloseDlg( hwndDlg, nId, bDone );
-
- default:
- // check standard handling
- if (SdIsStdButton( nId ) && SdDoStdButton( nId )) then
- bDone = TRUE;
- endif;
- endswitch;
-
- endwhile;
-
- EndDialog( szDlg );
- ReleaseDialog( szDlg );
- ComponentViewDestroy( nParentView );
-
- SdUnInit( );
-
- // record data produced by this dialog
- SdMakeName( szAppKey, szDlg, szTitle, nSdComponentDialog );
- SilentWriteData( szAppKey, "Component", DATA_COMPONENT, szComponents, nTemp );
- SilentWriteData( szAppKey, "Result", DATA_NUMBER, "", nId );
-
- return nId;
-
- end;
-
-
-
- /*------------------------------------------------------------------------*/
- /* */
- /* Function: SdComponentDialogEx */
- /* */
- /* Descrip: This dialog will show a 2nd level of componetns based */
- /* on the current selection in the main dialog. */
- /* Misc: */
- /* */
- /*------------------------------------------------------------------------*/
- function SdComponentDialogEx( szDlg, hwndParentDlg, nParentView, szComponents, szTargetDir )
- NUMBER nId, nChildView;
- HWND hwndDlg, hwndListBox;
- BOOL bDone;
- begin
-
- szDlg = SD_DLG_COMPONENTDIALOGEX;
-
- if (EzDefineDialog( szDlg,
- "",
- "",
- SD_NDLG_COMPONENTDIALOGEX ) = DLG_ERR) then
- return -1;
- endif;
-
-
- // Loop in dialog until the user selects a standard button
- bDone = FALSE;
-
- while (!bDone)
-
- nId = WaitOnDialog( szDlg );
-
- switch (nId)
- case DLG_INIT:
-
- hwndDlg = CmdGetHwndDlg( szDlg );
- SdGeneralInit( szDlg, hwndDlg, STYLE_NORMAL, szSdProduct );
-
- nChildView = SdCreateComponentView( hwndDlg, SD_LISTBOX, szComponents, szTargetDir );
- if (!nChildView) then
- SdError( -1, "SdComponentDialogEx" );
- nId = -1;
- bDone = TRUE;
- endif;
-
- // Connect the parent view with the child view
- ComponentViewSetInfo( nChildView, COMPONENT_VIEW_PARENTVIEW, nParentView, "" );
- ComponentViewSetInfo( nParentView, COMPONENT_VIEW_CHILDVIEW, nChildView, "" );
- ComponentViewRefresh( nParentView, 0 );
-
- hwndListBox = GetDlgItem( hwndDlg, SD_LISTBOX );
- SetFocus( hwndListBox );
-
- case SD_PBUT_CONTINUE:
- nId = OK;
- bDone = TRUE;
-
- case DLG_ERR:
- SdError( -1, "SdComponentDialogEx" );
- nId = -1;
- bDone = TRUE;
-
- case DLG_CLOSE:
- SdCloseDlg( hwndDlg, nId, bDone );
-
- default:
- // check standard handling
- if (SdIsStdButton( nId ) && SdDoStdButton( nId )) then
- bDone = TRUE;
- endif;
- endswitch;
-
- endwhile;
-
- EndDialog( szDlg );
- ReleaseDialog( szDlg );
- ComponentViewDestroy( nChildView );
-
- return nId;
-
- end;
-