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

Close buttons on Custom Dialo not being recognized


5 replies to this topic

vishwa

vishwa
  • Full Members
  • 63 posts

Posted 01 October 2004 - 21:50

I have a custom dialog with a BACK, NEXT, CANCEL buttons. When the cancel button is clicked, the OnCanceling() function is called. But if I try to close the dialog by clicking on X button on the top right corner, no action takes place. My code does not recognize DLG_CLOSE at all.

This is my function below..

CODE


#define SD_CUSTOM_DB_ASK_OPTIONS       "DBAskOptions"
#define SD_PBUT_CONTINUE        1
#define SD_PBUT_EXITSETUP       9
#define SD_PBUT_BACK            12


function NUMBER MyCustomDialog()
STRING szDialogName;
BOOL bDone;
NUMBER nResult, nCmdValdue;
begin

szDialogName = "SD_CUSTOM_DB_ASK_OPTIONS";

EzDefineDialog( szDialogName, ISUSER, SD_CUSTOM_DB_ASK_OPTIONS, 0);  
bDone = FALSE;  
while (bDone=FALSE)  
 nCmdValue = WaitOnDialog(szDialogName);  
 switch (nCmdValue)      
   case DLG_INIT:  
     MessageBox("init", INFORMATION);

   case SD_PBUT_CONTINUE:  
     MessageBox("continue", INFORMATION);  
     bDone = TRUE;
     nReturn = NEXT;

   case SD_PBUT_EXITSETUP:
     MessageBox("cancel", INFORMATION);
     bDone = TRUE;
     nReturn = CANCEL;

   case SD_PBUT_BACK:      
     MessageBox("back", INFORMATION);
     bDone = TRUE;
     nReturn = BACK;

   case DLG_CLOSE:        
     MessageBox("close", INFORMATION);
     bDone = TRUE;
     nReturn = CANCEL;        

   case DLG_ERR:
     MessageBox("Internal dialog box error", SEVERE);        
     bDone = TRUE;        
 endswitch;            
endwhile;          

EndDialog(szDialogName);  
ReleaseDialog(szDialogName);
return nReturn;  

end;



Please let me know what I am doing wrong. The "case DLG_CLOSE:" never gets executed when I click on the close button. All the other cases work fine.

Thanks,
Vishwa


Ozone

Ozone
  • Full Members
  • 77 posts

Posted 06 October 2004 - 22:29

Substitute the following code for DLG_CLOSE

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

vishwa

vishwa
  • Full Members
  • 63 posts

Posted 07 October 2004 - 15:08


Still, nothing happens. Actually, the execution does not reach "case DLG_CLOSE" at all even when I press the Close button on the right hand top corner.

I am sorry that I did not explain properly in my initial mail. Actually, in the code that I have provided, when I press the close button, it does not display
MessageBox("close", INFORMATION).

So, the script is actually not recognizing that I have pressed the CLOSE button.
Any help is highly appreciated.

Thanks,
Vishwa


Ozone

Ozone
  • Full Members
  • 77 posts

Posted 08 October 2004 - 14:10

Vishwa,

If you look at the example in the InstallShield Help for EzDefineDialog() you will see that they use a Repeat-Until bDone; loop. You are using a While-Endwhile loop.

Also, you defined a Numeric variable as nCmdValdue, but typed it in your code as nCmdValue. If you try to compile it as typed, there should be a compile warning about an undefined variable nCmdValue..

As the example in the Help file demonstrates, use

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



Ozone

Ozone
  • Full Members
  • 77 posts

Posted 11 October 2004 - 15:21

Vishwa,

After trying the code I sent you, I have to admit that the default code to close the form does not work. That code was:

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

What I discovered was that while working with the dialog 'Askpath', I noticed that the form had an invisible button in the lower left corner of the form. This button has a Name Porperty of 'ControlId_2' and a Control Identifier of '2'. So what I did was to add the lines:

#define SD_PBUT_CLOSE_FORM 2 // The invisible button on the form

case RES_PBUT_CLOSE_FORM:
MessageBox ( "CLOSE - Here I is!" , INFORMATION ); // Testing message
// The user clicked the window's close button.
Do (EXIT);

And the form responds!

I am at a loss as to why the default reserved work DLG_CLOSE does not respond directly in this version. blink.gif


vishwa

vishwa
  • Full Members
  • 63 posts

Posted 11 October 2004 - 19:59


Hi Ozone,
Thanks a lot for your discovery. I too found the C button at the left end of my custom dialogs. I added the case to handle that button, and everything works like a charm!

Thank you once again,
Vishwa