inno setup - How to disable NextButton when file is not selected on InputFilePage (CreateInputFilePage)? -


my inno setup program have custom "input file page" created using createinputfilepage.

how can disable nextbutton in page until file path picked user?

in other words, need make nextbutton unclickable while file selection form empty, , clickable when file selection form filled.

thank you.

the easiest way use nextbuttonclick validate inputs , display error message when validation fails.

var   filepage: tinputfilewizardpage;  procedure initializewizard(); begin   filepage := createinputfilepage(wpselectdir, 'caption', 'description', 'sub caption');   filepage.add('prompt', '*.*', '.dat'); end;  function nextbuttonclick(curpageid: integer): boolean; begin   result := true;    if (curpageid = filepage.id) ,      (length(filepage.edits[0].text) = 0)   begin     msgbox('please select file.', mberror, mb_ok);     wizardform.activecontrol := filepage.edits[0];     result := false;   end; end; 

if want update "next" button state while input changes, bit more complicated:

procedure filepageeditchange(sender: tobject); begin   wizardform.nextbutton.enabled := (length(tedit(sender).text) > 0); end;  procedure filepageactivate(sender: twizardpage); begin   filepageeditchange(tinputfilewizardpage(sender).edits[0]); end;  procedure initializewizard(); var   page: tinputfilewizardpage;   edit: tedit; begin   page := createinputfilepage(wpselectdir, 'caption', 'description', 'sub caption');   { update next button state when page entered }   page.onactivate := @filepageactivate;    edit := page.edits[page.add('prompt', '*.*', '.dat')];   { update next button state when edit contents changes }   edit.onchange := @filepageeditchange; end; 

Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

python - pip wont install .WHL files -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -