How to disable "browse" button on defaultDirectory wizard page

878 views Asked by At

I want to show the user to wich directory the program will be installed. But I do not want to allow him to change that directory. So I thought about disabling the "browse" button and greying the field where you can type a path (disabling anyone from typing in there).

I have read this question, which is about preventing the user to select a wrong directory. In a comment by TLama I saw this:

Wouldn't be the Next button is greyed until the user chooses the right folder quite misleading ? What if I as the user forget the right directory ? Wouldn't be better to disable the choose folder edit box or skip that page at all ?

But the User asking the Question did not want to do it the suggested way so there is no further hint for this solution. Could you please tell me how to do this?

(Note: Sorry for opening a new question on such a similar topic, but as a new user I can't see another way of asking for help)

1

There are 1 answers

0
TLama On BEST ANSWER

You can disable the directory edit box with the browse button this way:

[Setup]
AppName=My Program
AppVersion=1.5
DefaultDirName={pf}\My Program

[Code]
procedure InitializeWizard;
begin
  WizardForm.DirEdit.Enabled := False;
  WizardForm.DirBrowseButton.Enabled := False;
end;