Developer forums (C::B DEVELOPMENT STRICTLY!) > Development

window size issues with Scripted Wizard and wxGTK 2.8

(1/2) > >>

SharkCZ:
I have got a bug-report for wrong size (no fields in the right part are shown) of New Project wizard when running on Fedora Development which contains wxGTK 2.8 - the report is at https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=225058 and a screenshot is at https://bugzilla.redhat.com/bugzilla/attachment.cgi?id=146762. So I have played a bit the code of the Scripted Wizard plugin and studied the "wizard" sample from wxWidgets sources and the result is the following patch:

--- Code: ---Index: src/plugins/scriptedwizard/wiz.cpp
===================================================================
--- src/plugins/scriptedwizard/wiz.cpp  (revision 3557)
+++ src/plugins/scriptedwizard/wiz.cpp  (working copy)
@@ -1001,8 +1001,12 @@
         wxWizardPageSimple::Chain(m_Pages[i - 1], m_Pages[i]);
 
     // allow the wizard to size itself around the pages
+#if 0
     for (size_t i = 1; i < m_Pages.GetCount(); ++i)
         m_pWizard->GetPageAreaSizer()->Add(m_Pages[i]);
+#else
+        m_pWizard->GetPageAreaSizer()->Add(m_Pages[0]);
+#endif
 
     m_pWizard->Fit();
 }

--- End code ---

It looks like that it is sufficient to call GetPageAreaSizer->Add() only once and for the first page - the sample has the same code for both WX 2.6 and 2.8. Can somebody test it with wxMSW? With this patch the New Project wizard's pages are almost correct. But there remains sizing issues with the compiler panel and language selection (genericsinglechoicelist).

taZDeVil:
I think this problem was already mentioned here: http://forums.codeblocks.org/index.php?topic=4962.msg38845#msg38845. I've got this problem since compiling C::B using wxMSW 2.8. I've applied your patch (using wxWidgets version check macro) and now it seem to work. Thanks!!!

--- Code: ---void Wiz::Finalize()
{
    // chain pages
    for (size_t i = 1; i < m_Pages.GetCount(); ++i)
        wxWizardPageSimple::Chain(m_Pages[i - 1], m_Pages[i]);

    // allow the wizard to size itself around the pages
#if wxCHECK_VERSION(2, 8, 0)
        m_pWizard->GetPageAreaSizer()->Add(m_Pages[0]);
#else
    for (size_t i = 1; i < m_Pages.GetCount(); ++i)
        m_pWizard->GetPageAreaSizer()->Add(m_Pages[i]);
#endif

    m_pWizard->Fit();
}

--- End code ---

SharkCZ:
I will also check whether the WX 2.8 code will work also on WX 2.6, because I think it should ;-)

stahta01:
Uploaded 2.8 patch to
[ Patch #1880 ] Truncated new project scripted wizard fix for wxW28
https://developer.berlios.de/patch/index.php?func=detailpatch&patch_id=1880&group_id=5358

I was not sure who to grant credit to so I just said I did NOT write the patch.

Tim S

wxLearner:
I think, the problem is, that the second for loop must not start with one but has to start with zero, i. e. :
--- Code: ---for (size_t i = 0; i < m_Pages.GetCount(); ++i)
        m_pWizard->GetPageAreaSizer()->Add(m_Pages[i]);
--- End code ---
The first for loop starts with 1 because it uses m_Pages[i - 1], but the second one needs to start with i = 0. If you do it, like the patch suggests, only the first page is being considered and the dialog can be too small after clicking "Next" (it happened, when I tried it with a dialog, where the welcome message wasn't skipped). If the method looks like the following, all goes well:
--- Code: ---void Wiz::Finalize()
{
    // chain pages
    for (size_t i = 1; i < m_Pages.GetCount(); ++i)
        wxWizardPageSimple::Chain(m_Pages[i - 1], m_Pages[i]);

    // allow the wizard to size itself around the pages
    for (size_t i = 0; i < m_Pages.GetCount(); ++i)
        m_pWizard->GetPageAreaSizer()->Add(m_Pages[i]);
   
    m_pWizard->Fit();
}
--- End code ---

Navigation

[0] Message Index

[#] Next page

Go to full version