Hm, your code (I mean putting "10+Durchlauf_fortlaufend") doesn't work, either. I also don't get the point in adding 10, because "Durchlauf_fortlaufend" is incremented in the loop. So it's the same result as when I put any number with the BITMAPBUTTONID. The button will only show up if I put a zero. I don't see where my mistake is because I do this the same way with all the other elements in this dialog.
I don't initialize this array. And the array is defined in the Geometrie.h file like with all the other elements:
Code: Select all
public:
Geometrie(wxWindow* parent,wxWindowID id=wxID_ANY,const wxPoint& pos=wxDefaultPosition,const wxSize& size=wxDefaultSize);
virtual ~Geometrie();
//(*Declarations(Geometrie)
wxPanel* Panel1;
wxStaticText* StaticText[50];
wxStaticBitmap* StaticBitmap[50];
wxSpinCtrl* SpinCtrl[50];
wxBitmapButton* BitmapButton[50];
//*)
protected:
//(*Identifiers(Geometrie)
static const long ID_PANEL1;
static const long ID_STATICTEXT[50];
static const long ID_STATICBITMAP[50];
static const long ID_SPINCTRL[50];
static const long ID_BITMAPBUTTON[50];
//*)
And in my mainApp file I use it like this:
Code: Select all
//(*IdInit(Geometrie)
const long Geometrie::ID_PANEL1 = wxNewId();
const long Geometrie::ID_STATICTEXT[] = {wxNewId()};
const long Geometrie::ID_STATICBITMAP[] = {wxNewId()};
const long Geometrie::ID_SPINCTRL[] = {wxNewId()};
const long Geometrie::ID_BITMAPBUTTON[] = {wxNewId()};
//*)
And then inside "Geometrie::Geometrie(wxWindow* parent,wxWindowID id,const wxPoint& pos,const wxSize& size)" as already posted:
Code: Select all
BitmapButton[Durchlauf_fortlaufend] = new wxBitmapButton(Panel1, ID_BITMAPBUTTON[Durchlauf_fortlaufend], wxBitmap(wxImage(_T("C:\\Users\\Thomas\\Documents\\Programmprojekte\\Wall-Mat\\warenkorb.png"))), wxDefaultPosition, wxDefaultSize, wxNO_BORDER, wxDefaultValidator, _T("ID_BITMAPBUTTON[Durchlauf_fortlaufend]"));
FlexGridSizer2->Add(BitmapButton[Durchlauf_fortlaufend], 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
"Durchlauf_fortlaufend" is declared before the code above. So even if I didn't initialize the arrays, in the moment of "ID_BITMAPBUTTON[Durchlauf_fortlaufend] it will be filled with a value. But somehow I guess it's just a small mistake...
It seems to me that you can't use other IDs than 0. If I start the loop with "Durchlauf_fortlaufend" set to 0 instead of 1 the first button will show up but not the others.