Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Multiple Custom Dialogs


5 replies to this topic

dsaxena

dsaxena
  • Members
  • 10 posts

Posted 18 May 2005 - 17:24

Hi All,

I made two custom dialogs in isuser and I want to call them one by one in the OnBegin() function. I used the code given in Installshield help to call a custom dialog. But if I repeat the same code for the other within the same function (or in other function ... doesnt really matter), it gives me the error "multiple case labels for statement". Even if I change the ID for 'Next','Back' or 'Cancel' button and use these new IDs as test cases, it gives me the same error.

Has anyone worked on multiple custom dialog boxes before ? I know the code works if you have just one custom dialog box. Any help would be appreciated.

Thanx
DK

Xitch13

Xitch13
  • Members
  • 134 posts

Posted 18 May 2005 - 17:44

I haven't had to use more than one custom dialog, so I'm not talking from experience here. Have you properly released all the resources you're using for the 1st box before you're attempting to reuse them for the 2nd?

If you post the code from your OnBegin function it might be easier to see what's going on.

There is great chaos under heaven, and the situation is excellent. (Mao Tse Tung)

Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 18 May 2005 - 17:45

Is this a compile time or a run time error?
If compile time: on which line?
If run time: use the debugger to see on which line.

dsaxena

dsaxena
  • Members
  • 10 posts

Posted 18 May 2005 - 17:50

Hi,

Here is the code I have written. The two custom dialogs are DLG_CONFIG and DLG_COFFEE

#define DLG_CONFIG 13032
#define IDC_SRSCNTRL_PORT 1004
#define IDC_SRSCORE_SERVER 1005
#define IDC_SRSCORE_PORT 1006
#define IDC_SRSCORE_TIMEOUT 1007

#define DLG_COFFEE 3
#define IDC_CREAM 1001
#define IDC_SUGAR 1002
#define SD_PBUT_COFFEE_CONTINUE 1009
#define SD_PBUT_COFFEE_BACK 1010
#define SD_PBUT_COFFEE_CANCEL 1011

function OnBegin()

STRING szDialogName, szString, szDesc, szTemp, szMsg, szDirPath;
NUMBER nResult, nCmdValue, nvFileHandle;
BOOL bDone;
HWND hwndDlg;


begin

// Specify a name to identify the custom dialog in this setup.
szDialogName = "MyConfigDialog";

// Define the dialog. Pass a null string in the second parameter
// to get the dialog from_isuser.dll or _isres.dll. Pass a null
// string in the third parameter because the dialog is identified
// by its ID in the fourth parameter.
nResult = EzDefineDialog (szDialogName, "", "", DLG_CONFIG);

if (nResult < 0) then

// Report an error; then terminate.
MessageBox ("Error in defining dialog", SEVERE);
abort;

endif;

// Loop until done.

repeat
// Display the dialog and return the next dialog event.
nCmdValue = WaitOnDialog (szDialogName);

// Respond to the event.
switch (nCmdValue)

case IDCANCEL:

// The user clicked the window's close button.
Do (EXIT);

case DLG_ERR:
MessageBox ("Unable to display dialog. Setup canceled.", SEVERE);
abort;

case DLG_INIT:

// Get the dialog's window handle.
hwndDlg = CmdGetHwndDlg (szDialogName);

// Set the window title. SetWindowText is prototyped
// in Winsub.h and defined in Winsub.rul.
SetWindowText (hwndDlg, "Config File Options Dialog");

// Set the message that appears at the top of the dialog.
//szDesc = "Specify options to be written in the Config file " + "\nThen press Next to continue.";
//CtrlSetText (szDialogName, SD_HEADER_AREA, szDesc);

NumToStr(szString,7785);
CtrlSetText (szDialogName, IDC_SRSCNTRL_PORT, szString);
szString = "localhost";
CtrlSetText (szDialogName, IDC_SRSCORE_SERVER, szString);
NumToStr(szString,7772);
CtrlSetText (szDialogName, IDC_SRSCORE_PORT, szString);
NumToStr(szString,2000);
CtrlSetText (szDialogName, IDC_SRSCORE_TIMEOUT, szString);


case SD_PBUT_BACK:

bDone = TRUE;


case SD_PBUT_CONTINUE:

//Add code to write a file

bDone = TRUE;


case SD_PBUT_CANCEL:

// The user clicked the Cancel button.

Do (EXIT);



endswitch;

until bDone;

// Close the custom dialog box.
EndDialog (szDialogName);

// Remove the custom dialog box from memory.
ReleaseDialog (szDialogName);

if (nCmdValue = SD_PBUT_CONTINUE) then

//MessageBox( szTemp, INFORMATION );

endif;


//-------- Defining New Dialog Box ---------//
bDone = FALSE;
nResult = EzDefineDialog (szDialogName, "", "", DLG_COFFEE);

if (nResult < 0) then

// Report an error; then terminate.
MessageBox ("Error in defining dialog", SEVERE);
abort;

endif;

// Loop until done.

repeat
// Display the dialog and return the next dialog event.
nCmdValue = WaitOnDialog (szDialogName);

// Respond to the event.
switch (nCmdValue)

case IDCANCEL:

// The user clicked the window's close button.
Do (EXIT);

case DLG_ERR:
MessageBox ("Unable to display dialog. Setup canceled.", SEVERE);
abort;

case DLG_INIT:


case SD_PBUT_COFFEE_BACK:

bDone = TRUE;


case SD_PBUT_COFFEE_CONTINUE:

endswitch;

until bDone;


end;

dsaxena

dsaxena
  • Members
  • 10 posts

Posted 18 May 2005 - 17:51

Its a compile time error at line

case SD_PBUT_COFFEE_BACK:

Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 19 May 2005 - 13:22

Your empty case DLG_INIT: may be cauing the problem:
CODE
case DLG_INIT:


case SD_PBUT_COFFEE_BACK:

Remove it, or put some code in it.