Archive: "Next" button bug


"Next" button bug
There is a little bug in main dialog. When I get to directory select dialog and invalidate the directory in edit box (for example delete it) then "Next" button is disabled. If I go back to previous dialog "Next" button remains disabled.


Simple patch:

add 1 global variable to util.c:
int install_directory_verified=0;

... and declaration to state.h:
extern int install_directory_verified;

in DialogProc in ui.c: add 1 line after IDC_BACK enabling
EnableWindow(GetDlgItem(hwndDlg,IDOK),m_page!=2 || install_directory_verified);

in DirProc in ui.c rewrite enabling of IDOK:
install_directory_verified=is_valid_path && (available >= total || available == -1) && !ExecuteCodeSegment(g_inst_entry,g_inst_header->code_onVerifyInstDir,NULL);
EnableWindow(GetDlgItem(GetParent(hwndDlg),IDOK),install_directory_verified);


Sorry, the patch was not correct. I looked again at the source code and this will (hopefully :-) ) work:

static BOOL CALLBACK LicenseProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
if (uMsg == WM_INITDIALOG)
{
EnableWindow(GetDlgItem(GetParent(hwndDlg),IDOK),TRUE); // <-----

SetDlgItemText(hwndDlg,IDC_EDIT1,GetStringFromStringTab(g_inst_header->licensedata_ptr));
...


static BOOL CALLBACK SelProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
HWND hwndCombo1 = GetDlgItem(hwndDlg,IDC_COMBO1);
HWND hwndList1 = GetDlgItem(hwndDlg,IDC_LIST1);

if (uMsg == WM_INITDIALOG)
{
EnableWindow(GetDlgItem(GetParent(hwndDlg),IDOK),TRUE); // <-----

hBMcheck[0]=LoadBitmap(g_hInstance, MAKEINTRESOURCE(IDB_BITMAP1));