cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
kleinwgolden
Level 3

nResult always equal to 0 with CustomDialog

Hi;
New IS user, took the class last summer, just getting into coding now.

I am trying to use the example in Chapter 9, Custom Dialog Boxes, from the Learning InstallScript Projecs Using InstallShield 2008. I am using v2009 now.

I can get the CustomDialog to display without error, but I cannot get Back button to go back from the CustomDialog screen. Code snip-its:

In the CustomDialog.rul:
case BACK_BUTTON:
nReturn = SD_PBUT_BACK;
NumToStr(szTemp, nReturn);
MessageBox("nReturn:" + szTemp, INFORMATION);
bDone = TRUE;

*** I see a value of '12' in the message box.

In the Setup.rul:
nResult = CD( );
NumToStr(szTemp, nResult);
MessageBox("nResult:" + szTemp, INFORMATION);
if (nResult = SD_PBUT_BACK) goto Dlg_SdWelcome;

*** I see a value of '0' in the message box. So the above If is
false and my script falls thru to the next dialog.


I did some searching in the other threads, but could not any help.

Thanks for your time!
Regards,
Bill
Labels (1)
0 Kudos
(4) Replies
RobertDickau
Flexera Alumni

Could something else later in your CD function be changing the return value to 0?

(As an aside, you can use SprintfBox to display a number value without needing NumToStr or an auxiliary variable...)
0 Kudos
kleinwgolden
Level 3

Thanks for the tip about displaying values.

Here is my entire cd.rul:


prototype NUMBER CD ( );

function NUMBER CD ( )

#define DUDE_BUTTON 1302
#define CANCEL_BUTTON 9
#define BACK_BUTTON 12
#define NEXT_BUTTON 1
BOOL bDone;
NUMBER nReturn, nCtrl;
STRING szTemp;

begin

EzDefineDialog ("CD", ISUSER, "CD", NULL);

while (!bDone)

nCtrl = WaitOnDialog("CD");


switch (nCtrl)

case DUDE_BUTTON:
MessageBox("You clicked Dude.", INFORMATION);
case BACK_BUTTON:
MessageBox("You clicked Back.", INFORMATION);
nReturn = SD_PBUT_BACK;
NumToStr(szTemp, nReturn);
MessageBox("nReturn:" + szTemp, INFORMATION);
bDone = TRUE;
case NEXT_BUTTON:
MessageBox("You clicked Next.", INFORMATION);
nReturn = SD_PBUT_OK;
bDone = TRUE;
case CANCEL_BUTTON:
MessageBox("You clicked Cancel.", INFORMATION);
Do(EXIT);
case SD_PBUT_CANCEL:
MessageBox("You clicked the little x to Cancel.", INFORMATION);
Do(EXIT);

endswitch;


endwhile;

EndDialog("CD");
ReleaseDialog("CD");

end;
0 Kudos
RobertDickau
Flexera Alumni

It appears CD isn't actually returning a value. Maybe add return nReturn; to the end of the CD function?
0 Kudos
kleinwgolden
Level 3

Hi Robert;

As you suggested, using a return nReturn worked, Thank You!

Regards,
Bill
0 Kudos