News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

window size issues with Scripted Wizard and wxGTK 2.8

Started by SharkCZ, January 31, 2007, 09:41:21 PM

Previous topic - Next topic

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:

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();
}


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).
Code::Blocks package maintainer for Fedora and EPEL

taZDeVil

I think this problem was already mentioned here: http://forums.next.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!!!

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();
}

SharkCZ

I will also check whether the WX 2.8 code will work also on WX 2.6, because I think it should ;-)
Code::Blocks package maintainer for Fedora and EPEL

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
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

wxLearner

I think, the problem is, that the second for loop must not start with one but has to start with zero, i. e. :for (size_t i = 0; i < m_Pages.GetCount(); ++i)
        m_pWizard->GetPageAreaSizer()->Add(m_Pages[i]);
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: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();
}

SharkCZ

Hi, it really works when calling m_pWizard->GetPageAreaSizer()->Add(m_Pages[i]) for i between 0 and the last page. I though I had tried it before but without success. And it must work for WX 2.6 too.

There still remains one sizing issue with GenericSingleChoiceList in the Scripted Wizard

Code::Blocks package maintainer for Fedora and EPEL

SharkCZ

Quote from: SharkCZ on February 28, 2007, 12:50:12 PM
Hi, it really works when calling m_pWizard->GetPageAreaSizer()->Add(m_Pages[i]) for i between 0 and the last page. I though I had tried it before but without success. And it must work for WX 2.6 too.
I have just built last nightie on Fedora Core 6 with wxGTK 2.6 and this patch and the size of the New Project wizard's pages is OK.
Code::Blocks package maintainer for Fedora and EPEL