Author Topic: window size issues with Scripted Wizard and wxGTK 2.8  (Read 7129 times)

Offline SharkCZ

  • Almost regular
  • **
  • Posts: 131
window size issues with Scripted Wizard and wxGTK 2.8
« on: January 31, 2007, 09:41:21 pm »
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();
 }

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

Offline taZDeVil

  • Single posting newcomer
  • *
  • Posts: 5
Re: window size issues with Scripted Wizard and wxGTK 2.8
« Reply #1 on: January 31, 2007, 11:02:22 pm »
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();
}

Offline SharkCZ

  • Almost regular
  • **
  • Posts: 131
Re: window size issues with Scripted Wizard and wxGTK 2.8
« Reply #2 on: February 01, 2007, 09:59:40 am »
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

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: window size issues with Scripted Wizard and wxGTK 2.8
« Reply #3 on: February 09, 2007, 01:37:24 pm »
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++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

wxLearner

  • Guest
Re: window size issues with Scripted Wizard and wxGTK 2.8
« Reply #4 on: February 20, 2007, 04:16:08 pm »
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]);
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();
}

Offline SharkCZ

  • Almost regular
  • **
  • Posts: 131
Re: window size issues with Scripted Wizard and wxGTK 2.8
« Reply #5 on: February 28, 2007, 12:50:12 pm »
Hi, it really works when calling
Code
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

Offline SharkCZ

  • Almost regular
  • **
  • Posts: 131
Re: window size issues with Scripted Wizard and wxGTK 2.8
« Reply #6 on: March 17, 2007, 06:32:20 pm »
Hi, it really works when calling
Code
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