News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

is there a way to make control arrays in wxSmith?

Started by ouch, April 21, 2008, 09:06:10 PM

Previous topic - Next topic

ouch

I could really use them for my project but I can't seem to be able to find a way to do it. anytime I enter a non standard character for the control's variable wxsmith strips it out.

to better describe what I'm talking about see below:

wxTextCtrl TextCtrl[2];

    TextCtrl[0] = new wxTextCtrl(Panel2, ID_TEXTCTRL0, wxEmptyString, wxDefaultPosition, wxSize(100,-1), 0, wxDefaultValidator, _T("ID_TEXTCTRL0"));

    TextCtrl[1] = new wxTextCtrl(Panel2, ID_TEXTCTRL1, wxEmptyString, wxDefaultPosition, wxSize(100,-1), 0, wxDefaultValidator, _T("ID_TEXTCTRL1"));

    TextCtrl[2] = new wxTextCtrl(Panel2, ID_TEXTCTRL2, wxEmptyString, wxDefaultPosition, wxSize(100,-1), 0, wxDefaultValidator, _T("ID_TEXTCTRL2"));

//Then later on:

for (i=0;i<2;i++)
    {
     TextCtrl[i]->ChangeValue("written by an array!");
    }


you can also do something simular (but less elegant) with wxArrays. But wxSmith doesn't let you use that method either.

I'm pretty much stuck on my project till I can solve this.

MortenMacFly

Quote from: ouch on April 21, 2008, 09:06:10 PM
wxTextCtrl TextCtrl[2];
[...]
    TextCtrl[2] = new wxTextCtrl(Panel2, ID_TEXTCTRL2, wxEmptyString, wxDefaultPosition, wxSize(100,-1), 0, wxDefaultValidator, _T("ID_TEXTCTRL2"));

As you didn't describe what exactly happens: In case your app crashes: You are creating a vector of size 2 and write on position 3. This should definitely result in a crash. Probably this already solves your problem. ;-)

In additon: You are creating an array of objects but fill with pointers... probably you should start reading a book on C++?!
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

ouch

the problem is that I can't make the brackets on the variable in the first place. ;) wxSmith strips them out when you try to add them in the variable for the control.

if you try to do it outside of wxSmith of course it overwrites everything you do if you touch your GUI with it again.

that was just some example code to show what I would like wxSmith (or some other method) to do.