cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
ShounakBose
Level 2

Installscript Custom Dialog not getting displayed

Hi,

I am working on an installscript project in which i need to display messages on a multi line edit box. The messages will be sent from installscript code.

I have created a custom dialog ("CleanSystem") containing one read-only multi-line edit box, back, cancel and next buttons and some static texts. And have written the following functions to handle it.


#define DLG_CLEAN_SYSTEM "CleanSystem"
#define DLG_CLEAN_SYSTEM_ID 13001
#define CTRL_EDIT 301

LIST listMsg;

prototype NUMBER CleanSystemShowDialog(BYVAL STRING, BYVAL STRING);
function CleanSystemShowDialog(szTitle, szMsg)
NUMBER nId;
HWND hwndDlg;
begin
// Initialize if not already done
if (!bSdInit) then
SdInit();
endif;

// Create dialog
if (EzDefineDialog(DLG_CLEAN_SYSTEM, ISUSER,
"", DLG_CLEAN_SYSTEM_ID) = DLG_ERR) then
return -1;
endif;

// Handle Dialog Init event
listMsg = ListCreate(STRINGLIST);

nId = WaitOnDialog(DLG_CLEAN_SYSTEM);
switch (nId)

case DLG_INIT:
if (szMsg != "") then
SdSetStatic(DLG_CLEAN_SYSTEM, SD_STA_MSG, szMsg);
endif;

// Disabling control buttons
Disable(BACKBUTTON);
Disable(NEXTBUTTON);
Disable(CANCELBUTTON);

// Initialize Dialog
hwndDlg = CmdGetHwndDlg(DLG_CLEAN_SYSTEM);
SdGeneralInit(DLG_CLEAN_SYSTEM, hwndDlg, 0, "");
SdSetDlgTitle(DLG_CLEAN_SYSTEM, hwndDlg, szTitle);

// Initialize Edit Box
ListAddString(listMsg, "", AFTER);

case DLG_ERR:
SdError(-1, DLG_CLEAN_SYSTEM);
nId = -1;

endswitch;

// Error encountered, cleanup dialog
if (nId = -1) then
CleanSystemReleaseDialog();
return nId;
endif;

return nId;
end;


prototype NUMBER CleanSystemCloseDialog();
function CleanSystemCloseDialog()
NUMBER nId;
BOOL bDone;
begin
Enable(NEXTBUTTON);
bDone = FALSE;

while (!bDone)
nId = WaitOnDialog(DLG_CLEAN_SYSTEM);

switch (nId)

case DLG_ERR:
SdError(-1, DLG_CLEAN_SYSTEM);
nId = -1;
bDone = TRUE;

case NEXT:
nId = NEXT;
bDone = TRUE;

default:
if (SdIsStdButton(nId) && SdDoStdButton(nId)) then
bDone = TRUE;
elseif (nId >= 101 && nId <= 199) then
bDone = TRUE;
endif;

endswitch;
endwhile;

// Release the dialog
CleanSystemReleaseDialog();

return nId;
end;


prototype NUMBER CleanSystemUpdateMessage(BYVAL STRING);
function CleanSystemUpdateMessage(svText)
STRING svString;
BOOL bNewLine;
begin
bNewLine = FALSE;

if (StrFindEx(svText, "\n", 0) >= 0) then
bNewLine = TRUE;
StrReplace(svText, "\n", "", 0);
endif;

ListCurrentString(listMsg, svString);
ListSetCurrentString(listMsg, svString + svText);
CtrlSetMLEText(DLG_CLEAN_SYSTEM, CTRL_EDIT, listMsg);

if (bNewLine) then
ListAddString(listMsg, "", AFTER);
endif;
end;

prototype void CleanSystemReleaseDialog();
function void CleanSystemReleaseDialog()
begin
// Cleanup Dialog
ListDestroy(listMsg);
EndDialog(DLG_CLEAN_SYSTEM);
ReleaseDialog(DLG_CLEAN_SYSTEM);
SdUnInit();

// TODO: Record Silent Mode
end;


function OnFirstUIBefore()
...
begin
...
CleanSystemShowDialog("", "");

CleanSystemUpdateMessage("Hello ");
CleanSystemUpdateMessage("World\n");

CleanSystemCloseDialog();

...
end;


The problem is the dialog is not getting displayed after CleanSystemShowDialog() whereas it can be seen while WaitOnDialog after CleanSystemCloseDialog().

Is there any way to display the dialog without waiting on the WaitOnDialog()?
Please help.

Regards,
Shounak
Labels (1)
0 Kudos
(2) Replies
ch_eng
Level 7

Shounak,

Try adding the same

while (!bDone)


loop to your CleanSystemShowDialog function that you have in CleanSystemCloseDialog


HTH
0 Kudos
ShounakBose
Level 2

Thanks for your reply ch_eng.

The requirement is that i need a dialog with a read-only multiline edit box to get displayed, whose text will be changed by the running script.
So if I am looping with while (!bDone) and WaitOnDialog in the code then rest of the script won't get executed, until and unless i exit the dialog.

What I want to do is almost similar to using SetStatusWindow() to change the progress bar while diplaying installation progress.

Thanks,
Shounak
0 Kudos