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

How to change the default position of Installscript dialogs

How to change the default position of Installscript dialogs

Issue:

By default Installscript dialogs will display in the centre of the screen, this article discussed how to change this location using installscript code.

Solution:

Use the below Installscript code (in bold) in all Dialog init code to change the position of the dialog, where nDx = 200; nDy= 250;  are the starting position of the dialog. Same way, you can modify for all other dialog sources used in you installscripts like SdFinish.

// SdWelcome ----------------------------------------------------------------
function SdWelcome(szTitle, szMsg)
string szDlg, szTemp;
number nId, nMessage, nTemp, nSdDialog, nDx, nDy, nWidth, nHeight;
HWND hwndDlg;
BOOL bDone;
RECT rect;
begin

szDlg = SD_DLG_WELCOME;
nSdDialog = SD_NDLG_WELCOME;

// record data produced by this dialog
if(MODE=SILENTMODE) then
SdMakeName( szAppKey, szDlg, szTitle, nSdWelcome );
SilentReadData( szAppKey, "Result", DATA_NUMBER, szTemp, nId );
return nId;
endif;

// ensure general initialization is complete
if(!bSdInit) then
SdInit();
endif;

if(EzDefineDialog( szDlg, "", "", SD_NDLG_WELCOME ) = DLG_ERR) then
return -1;
endif;

Disable( BACKBUTTON );

// Loop in dialog until the user selects a standard button
bDone = FALSE;

while (!bDone)

nId = WaitOnDialog( szDlg );

switch(nId)

case DLG_INIT:

// Put the corresponding Info in the List Field
if( szMsg != "" ) then
SdSetStatic(szDlg, SD_STA_MSG, szMsg);
endif;

hwndDlg = CmdGetHwndDlg( szDlg );
SdGeneralInit( szDlg, hwndDlg, STYLE_NORMAL, szSdProduct );

SdSetDlgTitle(szDlg, hwndDlg, szTitle);

GetWindowRect(hwndDlg, &rect); nWidth = rect.right - rect.left; nHeight = rect.bottom - rect.top; nDx = 200; nDy= 250; MoveWindow(hwndDlg, nDx, nDy, nWidth, nHeight, TRUE);

Was this article helpful? Yes No
No ratings
Version history
Last update:
‎Feb 03, 2021 05:45 AM
Updated by:
Contributors