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

How to set button visibility via setup.rul?

How to set button visibility via setup.rul?

I have a button defined in a customized welcome dialog (via Dialog View) and need to change the button visibility due to a preprocessor variable is set.

Labels (1)
0 Kudos
(3) Replies
ch_eng2
Level 6

Hello,
You can use the ShowWindow function:

https://docs.revenera.com/installshield26helplib/LangRef/LangrefShowWindow.htm

Example:

Show/Hide utility function:

prototype Dlg_HideControl( byval NUMBER, // hDlg - handle for the dialog
                           byval NUMBER, // nControlID - ID of the control to show/hide
                           byval BOOL // bState - whether to hide (1) or show (0) the control 
                         );
//---------------------------------------------------------------------------
// third argument determines whether to hide (1) or show (0) the control
function Dlg_HideControl( hDlg, nControlID, bState )
    NUMBER hCtrl;
    BOOL bResult;
begin
    hCtrl = GetDlgItem( hDlg, nControlID );    
    if bState then
        ShowWindow( hCtrl, SW_HIDE );
    else
        ShowWindow( hCtrl, SW_SHOW );
    endif;
end;

Usage (in dialog .rul file):

// insert before ShowDialog_xyz function
#define DLG_Dokumente 552

// add to ShowDialog_xyz variables if missing
HWND hDlg

// call from within the ShowDialog_xyz function
Dlg_HideControl( hDlg, DLG_Dokumente, Preprocessor_Variable_as_Boolean );

HTH

0 Kudos

Thanks, but how do I get the hDlg from a sdWelcome dialog?
I guess with CmdGetHwndDlg(szDialogName) but what is the dialog name to use?

0 Kudos

In the InstallScript pane, if you choose these options from the dropdown, it should generate the SdWelcome code in Setup.rul for you to look through/edit (see screenshot)

HTH

0 Kudos