Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: Pecan on April 30, 2012, 06:35:39 pm

Title: FindInFiles dlg error
Post by: Pecan on April 30, 2012, 06:35:39 pm
When no editor is active and the user types Ctl-Shift-F for Find-in-Files,
the following occurs:

(http://dl.dropbox.com/u/46870262/FindInFilesErr.png)

I believe the error is caused by the else clause in FindDlg line 107.

Code
    if (!m_Complete)
    {
// NOTE (jens#1#): Do not delete, just hide the page, to avoid asserts in debug-mode
        (XRCCTRL(*this, "nbFind", wxNotebook)->GetPage(0))->Hide(); // no active editor, so only find-in-files
        XRCCTRL(*this, "cmbFind2", wxComboBox)->SetFocus();
    }
    else if (findInFilesActive)
    {
        XRCCTRL(*this, "nbFind", wxNotebook)->SetSelection(1); // Search->Find in Files was selected
        XRCCTRL(*this, "cmbFind2", wxComboBox)->SetFocus();
    }
}

If the else clause is changed to an "if", the correct page of the dialog is selected.

Code
    if (!m_Complete)    // !findInFilesOnly == !ed
    {
// NOTE (jens#1#): Do not delete, just hide the page, to avoid asserts in debug-mode
        (XRCCTRL(*this, "nbFind", wxNotebook)->GetPage(0))->Hide(); // no active editor, so only find-in-files
        XRCCTRL(*this, "cmbFind2", wxComboBox)->SetFocus();
    }
    //-else if (findInFilesActive)
    if (findInFilesActive)
    {
        XRCCTRL(*this, "nbFind", wxNotebook)->SetSelection(1); // Search->Find in Files was selected
        XRCCTRL(*this, "cmbFind2", wxComboBox)->SetFocus();
    }
}

svn build  rev 7950 (2012-04-29 13:51:10)   gcc 4.6.1 Windows/unicode - 32 bit