Author Topic: Using "wxCheckListBox" in a wizard project  (Read 12591 times)

Offline LETARTARE

  • Lives here!
  • ****
  • Posts: 531
  • L'ami de l'homme.The friend of man.
    • LETARTARE
Using "wxCheckListBox" in a wizard project
« on: January 19, 2013, 06:14:43 am »
Hello,
II try to change the project creation wizard for "Avr Project" by adding a third page of choice additional libraries.
This setting uses a widget "wxCheckListBox" named "lib_addons" with fields: libA, libB, libC, libD.

I changed it to "wizard.xrc" and "wizard.script"

A-Modifications "wizard.xrc"
     see *.zip

B-Modifications "wizard.script"

1 - global variables
Code
/// ------------------------------
/// LETARTARE for wxCheckListBox
LibNumbers <- _T ("");
LibString <- _T ("");
/// <----------------------------

2 - in "BeginWizard function ()"
Code
/// ---------------------------------------------------------------------
/// For testing LETARTARE "wiz::GetListboxStringSelections (wxString &)"
/// Page "libraryChoice" contents "wxCheckListBox"
       Wizard.AddPage (_T ("libraryChoice")) /// inside "wizard.xrc"
/// <-------------------------------------------------------------------

3 - I created the following function to display the values ​​retrieved
Code
/// ----------------------------------------------- ---------------------
/// LETARTARE : lib_addons
/// functions available for "wxCheckListBox"
/// int GetListboxSelection(const wxString& name); // with ONLY ONE SELECTION !!!
/// wxString GetListboxSelections(const wxString& name);
/// wxString GetListboxStringSelections(const wxString& name);
/// void SetListboxSelection(const wxString& name, int sel);


function OnLeave_libraryChoice (fwd)
{
    if (fwd)
    {
        LibNumbers = Wizard.GetListboxSelections (_T ("lib_addons"));
       /// Console output for test scripting
       ::print (_T ("->") +  LibNumbers  + _T ("<-"));
        if (LibNumbers.IsEmpty ()) {
             ::print (_T ("No selected library"));
        }
        else {
              LibString = Wizard.GetListboxStringSelections (_T ("lib_addons"));
             ::print (_T ("lib_addons = ") + LibString);
        }
    }
    return true;
}
/// <-------------------------------------------------------------------

Disregard of space errors in quotations !!

4 - Results:
creation is correct but:
Quote
    - The variable LibNumbers is always equal to 0 !
     - Variable LibString is always empty!


I can not find my mistake?

Cordially.
« Last Edit: January 19, 2013, 06:58:53 am by LETARTARE »
CB-13483, plugins-sdk-2.25.0 : Collector-2.0.0, AddOnForQt-3.9.1
1-Win7 Business Pack1 64bits : wx-3.2.4, gcc-8.1.0,
2-OpenSuse::Leap-15.4-64bits : wx-3.2.4;gtk3, gcc-8.2.1,
=> !! The messages are translated by Deepl

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Using "wxCheckListBox" in a wizard project
« Reply #1 on: January 19, 2013, 08:40:31 am »
I can not find my mistake?
What version of C::B do you use? IMHO scripting support for wxCheckListBox was added just recently.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline LETARTARE

  • Lives here!
  • ****
  • Posts: 531
  • L'ami de l'homme.The friend of man.
    • LETARTARE
Re: Using "wxCheckListBox" in a wizard project
« Reply #2 on: January 19, 2013, 09:51:08 am »
hello,
C::B 12.11
I found the access functions in wiz.h and wiz.cpp
cordially
CB-13483, plugins-sdk-2.25.0 : Collector-2.0.0, AddOnForQt-3.9.1
1-Win7 Business Pack1 64bits : wx-3.2.4, gcc-8.1.0,
2-OpenSuse::Leap-15.4-64bits : wx-3.2.4;gtk3, gcc-8.2.1,
=> !! The messages are translated by Deepl

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Using "wxCheckListBox" in a wizard project
« Reply #3 on: January 19, 2013, 10:16:58 am »
You ask for selected item, these are the item(s) which is/are highlighted, not the item(s) with a checked checkbox.
wxCheckListBox is not (yet) implemented as far as I can see.

Offline LETARTARE

  • Lives here!
  • ****
  • Posts: 531
  • L'ami de l'homme.The friend of man.
    • LETARTARE
Re: Using "wxCheckListBox" in a wizard project
« Reply #4 on: January 19, 2013, 10:27:12 am »
thanks you jens.
The box checked are they planned in the near future ?
CB-13483, plugins-sdk-2.25.0 : Collector-2.0.0, AddOnForQt-3.9.1
1-Win7 Business Pack1 64bits : wx-3.2.4, gcc-8.1.0,
2-OpenSuse::Leap-15.4-64bits : wx-3.2.4;gtk3, gcc-8.2.1,
=> !! The messages are translated by Deepl

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Using "wxCheckListBox" in a wizard project
« Reply #5 on: January 19, 2013, 11:14:22 am »
I never worked on scriptedwizard.

Nevertheless I attach a quick patch to imöplement wxCeckListBox-functions for it.

It would be nice if anybody can test it and give feedback.

It works with your test-script (after changing the function calls of course).

Offline LETARTARE

  • Lives here!
  • ****
  • Posts: 531
  • L'ami de l'homme.The friend of man.
    • LETARTARE
Re: Using "wxCheckListBox" in a wizard project
« Reply #6 on: January 19, 2013, 01:59:01 pm »
@jens
after some computer troubles...
I tested the functions :
Code
wxString GetCheckListboxChecked (const wxString& name)
and
Code
wxString GetCheckListboxStringChecked(const wxString& name)
Both give the desired result.

Quote
LibNumbers ->0;2;4;6;<-
Lib_addOns  ->lib_A;lib_C;lib_E;lib_G;<-

But I will now check the four functions in more depth.
And continue editing the wizard.

A big thank you first (especially extremely quickly !)
« Last Edit: January 19, 2013, 02:04:43 pm by LETARTARE »
CB-13483, plugins-sdk-2.25.0 : Collector-2.0.0, AddOnForQt-3.9.1
1-Win7 Business Pack1 64bits : wx-3.2.4, gcc-8.1.0,
2-OpenSuse::Leap-15.4-64bits : wx-3.2.4;gtk3, gcc-8.2.1,
=> !! The messages are translated by Deepl

Offline LETARTARE

  • Lives here!
  • ****
  • Posts: 531
  • L'ami de l'homme.The friend of man.
    • LETARTARE
Re: Using "wxCheckListBox" in a wizard project
« Reply #7 on: January 26, 2013, 02:28:23 pm »
@jens
All methods work correctly on my system.
Soon, I will provide a 'wizard.script' example.
To save with 'Config Manager', I would need:

Code
 void SetCheckListboxChecked(const wxString& name, wxString listname);
Code
/// LETARTARE
void Wiz::SetCheckListboxChecked(const wxString& name, wxString listname )
{
    wxWizardPage* page = m_pWizard->GetCurrentPage();
    if (page)
    {
        wxCheckListBox* clb = dynamic_cast<wxCheckListBox*>(page->FindWindowByName(name, page));
        if (clb && !listname.IsEmpty())
        {  
           /// clear checked
unsigned int i;
for (i = 0; i < clb->GetCount() ; i++ )
      clb->Check(i, false) ;
           /// format listname "1;4;7;"
        char sep = ';';
        unsigned long pos;
          /// checked
        while (!listname.IsEmpty()) {
listname.BeforeFirst(sep).ToULong(&pos);
clb->Check(pos, true) ;
listname = listname.AfterFirst(sep) ;
                }
        }
    }
}

is that correct ?
« Last Edit: January 26, 2013, 05:56:04 pm by LETARTARE »
CB-13483, plugins-sdk-2.25.0 : Collector-2.0.0, AddOnForQt-3.9.1
1-Win7 Business Pack1 64bits : wx-3.2.4, gcc-8.1.0,
2-OpenSuse::Leap-15.4-64bits : wx-3.2.4;gtk3, gcc-8.2.1,
=> !! The messages are translated by Deepl

Offline LETARTARE

  • Lives here!
  • ****
  • Posts: 531
  • L'ami de l'homme.The friend of man.
    • LETARTARE
Re: Using "wxCheckListBox" in a wizard project
« Reply #8 on: February 17, 2013, 09:43:14 am »
@jens
Is it possible to validate the fix in the svn ?
Because I intend to propose to wizard specialization 'avr' using this fix that works for me correctly.

Thank you in advance
CB-13483, plugins-sdk-2.25.0 : Collector-2.0.0, AddOnForQt-3.9.1
1-Win7 Business Pack1 64bits : wx-3.2.4, gcc-8.1.0,
2-OpenSuse::Leap-15.4-64bits : wx-3.2.4;gtk3, gcc-8.2.1,
=> !! The messages are translated by Deepl