Make wxDialog scrollable?

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Wanderer82
Earned some good credits
Earned some good credits
Posts: 148
Joined: Tue Jul 26, 2016 2:00 pm

Make wxDialog scrollable?

Post by Wanderer82 » Fri Mar 30, 2018 6:19 pm

First of all I have to say that I was searching the web for a solution. I did find several threads concerning this question but I guess I'm too much of a beginner to use these suggestions. I just can't understand that this is so difficult... or at least seems so difficult.

All I want is a scrollable wxDialog. I want to create, for example, a shopping cart with a lot of items. The window / dialog size should be limited. If there are too many items you should see the scrollbar. So I already have created a wxDialog with all my items. First I have a box sizer, then a wxPanel, inside of this a wxFlexGridSizer, another box sizer and inside this one more box sizers containing the items (StaticText, Spacer, wxStaticBitmap etc.). Is there an option to just make a scrollable dialog from what I've already created or do I have to start over again using another kind of "wxDialog"?

Why doesn't wxwidgets support these scrollable dialogs in a way that I can just select them like a regular wxDialog from the menu? From the solutions I found it seems to me that I have to write the code by hand, is that correct? I also tried a wxScrollingDialog filling in all my items, but it still wouldn't show a scrollbar.

Thanks for any easy solution.
Thomas

User avatar
doublemax
Moderator
Moderator
Posts: 14982
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Make wxDialog scrollable?

Post by doublemax » Fri Mar 30, 2018 6:43 pm

Usually you would use a dedicated control to display many items like that, e.g. wxListCtrl, wxDataViewCtrl or wxGrid.

But if you want to build them yourself using individual controls:
First I have a box sizer, then a wxPanel, inside of this a wxFlexGridSizer, another box sizer and inside this one more box sizers containing the items (StaticText, Spacer, wxStaticBitmap etc.).
Hard to tell exactly without seeing code, but most likely all you have to do is to replace that wxPanel with a wxScrolledWindow and call wxScrolledWindow::SetScrollRate() afterwards.
Why doesn't wxwidgets support these scrollable dialogs in a way that I can just select them like a regular wxDialog from the menu?
This would be the job of a GUI editor. wxWidgets itself is just a library, all available GUI editors come from other people.
Use the source, Luke!

PB
Part Of The Furniture
Part Of The Furniture
Posts: 2472
Joined: Sun Jan 03, 2010 5:45 pm

Re: Make wxDialog scrollable?

Post by PB » Fri Mar 30, 2018 7:18 pm

Example of a code that creates a dialog with a scrolling part. Should be easy to create with a decent GUI builder (in wxFormBuilder, wxScrolledWindow is in the Containers tab).

Code: Select all

#include <wx/wx.h>
#include <wx/scrolwin.h>

class MyDlg : public wxDialog
{
public:   
    MyDlg() : wxDialog(NULL, wxID_ANY, "Test", wxDefaultPosition, wxSize(300, 500))
    { 
        wxBoxSizer* mainSizer = new wxBoxSizer(wxVERTICAL);

        mainSizer->Add(new wxStaticText(this, wxID_ANY, "This control will not be scrolled"), 0, wxALL, 10);

        wxScrolledWindow* scrolled = new wxScrolledWindow(this);
        wxGridSizer* scrolledSizer = new wxFlexGridSizer(5, wxSize(5, 5));

        for ( size_t i = 0; i < 20; ++i )
        {
            scrolledSizer->Add(new wxStaticText(scrolled, wxID_ANY, wxString::Format("%zu A", i)));
            scrolledSizer->Add(new wxTextCtrl(scrolled, wxID_ANY));
            scrolledSizer->Add(new wxStaticText(scrolled, wxID_ANY, wxString::Format("%zu B", i)));
            scrolledSizer->Add(new wxTextCtrl(scrolled, wxID_ANY));
            scrolledSizer->Add(new wxButton(scrolled, wxID_ANY, wxString::Format("%zu", i)));
        }           
        
        scrolled->SetSizer(scrolledSizer);        
        scrolled->FitInside();
        scrolled->SetScrollRate(25, 25);                
        mainSizer->Add(scrolled, 1, wxEXPAND);

        mainSizer->Add(CreateStdDialogButtonSizer(wxOK | wxCANCEL), 0, wxEXPAND | wxALL, 5);

        SetSizer(mainSizer);        
    }
};

class MyApp : public wxApp
{
public:          
    bool OnInit()
    {
        MyDlg dlg;

        dlg.ShowModal();
        return false;
    }   
}; wxIMPLEMENT_APP(MyApp);
scrolled.png
scrolled.png (7.07 KiB) Viewed 1934 times

Wanderer82
Earned some good credits
Earned some good credits
Posts: 148
Joined: Tue Jul 26, 2016 2:00 pm

Re: Make wxDialog scrollable?

Post by Wanderer82 » Fri Mar 30, 2018 7:34 pm

Thank you so far... I'll look into these suggestions.

But still another question (by the way, I use Code::Blocks)... in the menu "wxSmith" I can find Add wxPanel, Add wxScrollingDialog, Add wxDialog etc. What is the difference between wxDialog and wxScrollingDialog if I can't just use this wxScrollingDialog to have a scrollable dialog?

User avatar
doublemax
Moderator
Moderator
Posts: 14982
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Make wxDialog scrollable?

Post by doublemax » Fri Mar 30, 2018 7:39 pm

wxScrollingDialog is no official wxWidgets class. My guess is that it's just a wxDialog with a wxScrolledWindow as child and some addional code so that you only have to add controls to it.
Use the source, Luke!

Wanderer82
Earned some good credits
Earned some good credits
Posts: 148
Joined: Tue Jul 26, 2016 2:00 pm

Re: Make wxDialog scrollable?

Post by Wanderer82 » Fri Mar 30, 2018 9:06 pm

I got this working using the code from wxFormBuilder. But this GUI builder creates quite a different code compared to Code::Blocks. So for my already written dialogs which built their items / layout during runtime I'd have to rewrite these completely and I'd like to avoid that. I don't know how to change the code as you @Doublemax suggested.

Code::Blocks has the wxScrolledWindow feature but I can't get it to work. Also in wxFormBuilder I can manually change the size of the window by using the mouse. In Code::Blocks I have to put the size values manually and I don't really know where to do it. I tried it with "Default Size" where I unticked the box and filled in some values. The window got smaller but still no Scrollbar appeared. Something is different with Code::Blocks and definitely more difficult.

Well my code (extract) for another dialog which I would like to keep and only enable the scrollbars:

.cpp:

Code: Select all

//(*InternalHeaders(Papier)
#include <wx/intl.h>
#include <wx/bitmap.h>
#include <wx/font.h>
#include <wx/string.h>
#include <wx/image.h>
//*)

//(*IdInit(Papier)
const long Papier::ID_PANEL1 = wxNewId();
const long Papier::ID_STATICTEXT[] = {wxNewId()};
const long Papier::ID_STATICBITMAP[] = {wxNewId()};
const long Papier::ID_SPINCTRL[] = {wxNewId()};
const long Papier::ID_CHOICE1[] = {wxNewId()};
const long Papier::ID_CHOICE2[] = {wxNewId()};
//*)

BEGIN_EVENT_TABLE(Papier,wxDialog)
	//(*EventTable(Papier)
	//*)
END_EVENT_TABLE()

Papier::Papier(wxWindow* parent,wxWindowID id,const wxPoint& pos,const wxSize& size)
{
	//(*Initialize(Papier)
	first_last_product_Papier("Papier");

	wxFlexGridSizer* FlexGridSizer2;
	wxBoxSizer* BoxSizer2;
	wxBoxSizer* BoxSizer1;
	wxBoxSizer* BoxSizer[50];
	wxFlexGridSizer* FlexGridSizer1;

	Create(parent, wxID_ANY, _("Papier"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE, _T("wxID_ANY"));
	SetClientSize(wxDefaultSize);
	Move(wxDefaultPosition);
	BoxSizer1 = new wxBoxSizer(wxVERTICAL);
	Panel1 = new wxPanel(this, ID_PANEL1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T("ID_PANEL1"));
	FlexGridSizer1 = new wxFlexGridSizer(0, 3, 0, 0);
	BoxSizer2 = new wxBoxSizer(wxVERTICAL);
	FlexGridSizer2 = new wxFlexGridSizer(0, 4, 0, 0);
	BoxSizer2->Add(FlexGridSizer2, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);

    int Durchlauf = 1;
    int AnzahlDurchlauf = letztesProduktPapier - (erstesProduktPapier - 1);

	do
    {
    StaticText[erstesProduktPapier] = new wxStaticText(Panel1, ID_STATICTEXT[erstesProduktPapier], _(_Produkt[erstesProduktPapier].readName()), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT[erstesProduktPapier]"));
	wxFont StaticTextFont(11,wxFONTFAMILY_SWISS,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_BOLD,false,_T("Calibri"),wxFONTENCODING_DEFAULT);
	StaticText[erstesProduktPapier]->SetFont(StaticTextFont);
	FlexGridSizer2->Add(StaticText[erstesProduktPapier], 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	StaticBitmap[erstesProduktPapier] = new wxStaticBitmap(Panel1, ID_STATICBITMAP[erstesProduktPapier], wxBitmap(wxImage(_Produkt[erstesProduktPapier].readProduktbild())), wxDefaultPosition, wxDefaultSize, wxSIMPLE_BORDER, _T("ID_STATICBITMAP1"));
	FlexGridSizer2->Add(StaticBitmap[erstesProduktPapier], 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
    BoxSizer[erstesProduktPapier] = new wxBoxSizer(wxVERTICAL);
    int s = 0; //Zähler für Choice
    ostringstream Strin1;
    Strin1 << Warenkorb_count;
    string g(Strin1.str());

	if (_Produkt[erstesProduktPapier].readAnzahlOptionen() == 1)
    {

        Choice1[erstesProduktPapier] = new wxChoice(Panel1, ID_CHOICE1[erstesProduktPapier], wxDefaultPosition, wxSize(72,21), 0, 0, 0, wxDefaultValidator, _T("ID_CHOICE1[erstesProduktPapier]"));
        BoxSizer[erstesProduktPapier]->Add(Choice1[erstesProduktPapier], 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);

        do
        {
            Choice1[erstesProduktPapier]->SetSelection( Choice1[erstesProduktPapier]->Append(_(_Produkt[erstesProduktPapier].readOptionen(0,s))) );
            s = s + 1;
        }

        while (s < _Produkt[erstesProduktPapier].readAnzahlOption(1));
    }

    if (_Produkt[erstesProduktPapier].readAnzahlOptionen() == 2)
    {
        Choice1[erstesProduktPapier] = new wxChoice(Panel1, ID_CHOICE1[erstesProduktPapier], wxDefaultPosition, wxSize(72,21), 0, 0, 0, wxDefaultValidator, _T("ID_CHOICE1[erstesProduktPapier]"));
        BoxSizer[erstesProduktPapier]->Add(Choice1[erstesProduktPapier], 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);

        do
        {
            Choice1[erstesProduktPapier]->SetSelection( Choice1[erstesProduktPapier]->Append(_(_Produkt[erstesProduktPapier].readOptionen(0,s))) );
            s = s + 1;
        }

        while (s < _Produkt[erstesProduktPapier].readAnzahlOption(1));
        s = 0;

        Choice2[erstesProduktPapier] = new wxChoice(Panel1, ID_CHOICE2[erstesProduktPapier], wxDefaultPosition, wxSize(72,21), 0, 0, 0, wxDefaultValidator, _T("ID_CHOICE2[erstesProduktPapier]"));
        BoxSizer[erstesProduktPapier]->Add(Choice2[erstesProduktPapier], 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);

        do
        {
            Choice2[erstesProduktPapier]->SetSelection( Choice2[erstesProduktPapier]->Append(_(_Produkt[erstesProduktPapier].readOptionen(1,s))) );
            s = s + 1;
        }

        while (s < _Produkt[erstesProduktPapier].readAnzahlOption(2));
    }

	SpinCtrl[erstesProduktPapier] = new wxSpinCtrl(Panel1, ID_SPINCTRL[erstesProduktPapier], _T("1"), wxDefaultPosition, wxSize(72,21), 0, 0, 100, 0, _T("ID_SPINCTRL[erstesProduktPapier]"));
	SpinCtrl[erstesProduktPapier]->SetValue(_T("0"));

	BoxSizer[erstesProduktPapier]->Add(SpinCtrl[erstesProduktPapier], 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
   
	FlexGridSizer2->Add(BoxSizer[erstesProduktPapier], 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	int button_id = 10000 + erstesProduktPapier;
	wxBitmapButton *button = new wxBitmapButton(Panel1, button_id, wxBitmap(wxImage(_T("C:\\Users\\Thomas\\Documents\\Programmprojekte\\Wall-Mat\\warenkorb2.png"))), wxDefaultPosition, wxDefaultSize, wxNO_BORDER, wxDefaultValidator, _T("ID_BITMAPBUTTON[10000]"));
	BitmapButton[erstesProduktPapier] = button;
	FlexGridSizer2->Add(button, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
    button->Connect(button_id,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&Papier::OnBitmapButtonClick, NULL, this);

	Durchlauf = Durchlauf + 1;
	erstesProduktPapier = erstesProduktPapier + 1;
    }

	while (Durchlauf < AnzahlDurchlauf + 1);

	FlexGridSizer1->Add(BoxSizer2, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	Panel1->SetSizer(FlexGridSizer1);
	FlexGridSizer1->Fit(Panel1);
	FlexGridSizer1->SetSizeHints(Panel1);
	BoxSizer1->Add(Panel1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0);
	SetSizer(BoxSizer1);
	BoxSizer1->Fit(this);
	BoxSizer1->SetSizeHints(this);
    Center();
	//*)
}

Papier::~Papier()
{
	//(*Destroy(Papier)
	//*)
}
.h:

Code: Select all

#ifndef PAPIER_H
#define PAPIER_H

//(*Headers(Papier)
#include <wx/sizer.h>
#include <wx/stattext.h>
#include <wx/spinctrl.h>
#include <wx/panel.h>
#include <wx/bmpbuttn.h>
#include <wx/statbmp.h>
#include <wx/dialog.h>
#include <wx/msgdlg.h>
#include <wx/choice.h>
//*)

class Papier: public wxDialog
{
	public:

		Papier(wxWindow* parent,wxWindowID id=wxID_ANY,const wxPoint& pos=wxDefaultPosition,const wxSize& size=wxDefaultSize);
		virtual ~Papier();

		//(*Declarations(Papier)
		wxPanel* Panel1;
		wxStaticText* StaticText[50];
		wxStaticBitmap* StaticBitmap[50];
		wxSpinCtrl* SpinCtrl[50];
		wxBitmapButton* BitmapButton[50];
		wxChoice* Choice1[50];
		wxChoice* Choice2[50];
		//*)

	protected:

		//(*Identifiers(Papier)
		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_CHOICE1[50];
		static const long ID_CHOICE2[50];
		//*)

	private:

		//(*Handlers(Papier)
        void OnBitmapButtonClick(wxCommandEvent& event);
		//*)

		DECLARE_EVENT_TABLE()
};

#endif

User avatar
doublemax
Moderator
Moderator
Posts: 14982
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Make wxDialog scrollable?

Post by doublemax » Fri Mar 30, 2018 9:48 pm

Like i said in my first post: Try to replace this panel

Code: Select all

Panel1 = new wxPanel(this, ID_PANEL1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T("ID_PANEL1"));
with a wxScrolledWindow
Use the source, Luke!

Wanderer82
Earned some good credits
Earned some good credits
Posts: 148
Joined: Tue Jul 26, 2016 2:00 pm

Re: Make wxDialog scrollable?

Post by Wanderer82 » Fri Mar 30, 2018 10:04 pm

Ok, tried that. My window is now quite small but even after changig the wxPanel to wxScrolledWindow no scrollbars will show up :-(

I tried it with another wxDialog. So here's my code:

Code: Select all

#include "User_Warenkorb.h"

//(*InternalHeaders(User_Warenkorb)
#include <wx/bitmap.h>
#include <wx/font.h>
#include <wx/intl.h>
#include <wx/image.h>
#include <wx/string.h>
#include <wx/scrolwin.h>
//*)

//(*IdInit(User_Warenkorb)
const long User_Warenkorb::ID_STATICTEXT3 = wxNewId();
const long User_Warenkorb::ID_STATICTEXT2 = wxNewId();
const long User_Warenkorb::ID_STATICBITMAP1 = wxNewId();
const long User_Warenkorb::ID_STATICLINE6 = wxNewId();
const long User_Warenkorb::ID_STATICTEXT6 = wxNewId();
const long User_Warenkorb::ID_STATICTEXT7 = wxNewId();
const long User_Warenkorb::ID_STATICLINE1 = wxNewId();
const long User_Warenkorb::ID_STATICTEXT1 = wxNewId();
const long User_Warenkorb::ID_STATICBITMAP2 = wxNewId();
const long User_Warenkorb::ID_STATICTEXT4 = wxNewId();
const long User_Warenkorb::ID_STATICTEXT5 = wxNewId();
const long User_Warenkorb::ID_SPINCTRL1 = wxNewId();
const long User_Warenkorb::ID_STATICLINE2 = wxNewId();
const long User_Warenkorb::ID_STATICTEXT8 = wxNewId();
const long User_Warenkorb::ID_STATICBITMAP3 = wxNewId();
const long User_Warenkorb::ID_STATICTEXT9 = wxNewId();
const long User_Warenkorb::ID_STATICTEXT10 = wxNewId();
const long User_Warenkorb::ID_SPINCTRL2 = wxNewId();
const long User_Warenkorb::ID_STATICLINE3 = wxNewId();
const long User_Warenkorb::ID_STATICTEXT11 = wxNewId();
const long User_Warenkorb::ID_STATICBITMAP4 = wxNewId();
const long User_Warenkorb::ID_STATICTEXT12 = wxNewId();
const long User_Warenkorb::ID_STATICTEXT13 = wxNewId();
const long User_Warenkorb::ID_SPINCTRL3 = wxNewId();
const long User_Warenkorb::ID_STATICLINE4 = wxNewId();
const long User_Warenkorb::ID_STATICTEXT14 = wxNewId();
const long User_Warenkorb::ID_STATICBITMAP5 = wxNewId();
const long User_Warenkorb::ID_STATICTEXT15 = wxNewId();
const long User_Warenkorb::ID_STATICTEXT16 = wxNewId();
const long User_Warenkorb::ID_TEXTCTRL1 = wxNewId();
const long User_Warenkorb::ID_SPINBUTTON1 = wxNewId();
const long User_Warenkorb::ID_STATICLINE5 = wxNewId();
const long User_Warenkorb::ID_BUTTON3 = wxNewId();
const long User_Warenkorb::ID_BUTTON2 = wxNewId();
const long User_Warenkorb::ID_SCROLLEDWINDOW1 = wxNewId();
//*)

BEGIN_EVENT_TABLE(User_Warenkorb,wxDialog)
	//(*EventTable(User_Warenkorb)
	//*)
END_EVENT_TABLE()

User_Warenkorb::User_Warenkorb(wxWindow* parent,wxWindowID id,const wxPoint& pos,const wxSize& size)
{
	//(*Initialize(User_Warenkorb)
	wxBoxSizer* BoxSizer4;
	wxFlexGridSizer* FlexGridSizer4;
	wxBoxSizer* BoxSizer5;
	wxFlexGridSizer* FlexGridSizer3;
	wxFlexGridSizer* FlexGridSizer5;
	wxFlexGridSizer* FlexGridSizer2;
	wxBoxSizer* BoxSizer2;
	wxBoxSizer* BoxSizer1;
	wxFlexGridSizer* FlexGridSizer1;
	wxBoxSizer* BoxSizer3;

	Create(parent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, _T("wxID_ANY"));
	BoxSizer1 = new wxBoxSizer(wxVERTICAL);
	ScrolledWindow1 = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL );
    ScrolledWindow1->SetMaxSize(wxSize(100,200));
	FlexGridSizer1 = new wxFlexGridSizer(0, 3, 0, 0);
	BoxSizer2 = new wxBoxSizer(wxVERTICAL);
	BoxSizer3 = new wxBoxSizer(wxHORIZONTAL);
	StaticText3 = new wxStaticText(ScrolledWindow1, ID_STATICTEXT3, _("Stahel, Thomas"), wxDefaultPosition, wxSize(165,19), 0, _T("ID_STATICTEXT3"));
	wxFont StaticText3Font(12,wxFONTFAMILY_SWISS,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_BOLD,false,_T("Calibri"),wxFONTENCODING_DEFAULT);
	StaticText3->SetFont(StaticText3Font);
	BoxSizer3->Add(StaticText3, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	StaticText2 = new wxStaticText(ScrolledWindow1, ID_STATICTEXT2, _("Warenkorb"), wxDefaultPosition, wxSize(127,29), 0, _T("ID_STATICTEXT2"));
	wxFont StaticText2Font(20,wxFONTFAMILY_SWISS,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_BOLD,false,_T("Calibri"),wxFONTENCODING_DEFAULT);
	StaticText2->SetFont(StaticText2Font);
	BoxSizer3->Add(StaticText2, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	BoxSizer3->Add(90,20,0, wxALL, 5);
	StaticBitmap1 = new wxStaticBitmap(ScrolledWindow1, ID_STATICBITMAP1, wxBitmap(wxImage(_T("C:\\Users\\Thomas\\Documents\\Programmprojekte\\Wall-Mat\\warenkorb2.png"))), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICBITMAP1"));
	BoxSizer3->Add(StaticBitmap1, 1, wxALL, 5);
	BoxSizer2->Add(BoxSizer3, 0, wxALL|wxEXPAND, 5);
	StaticLine6 = new wxStaticLine(ScrolledWindow1, ID_STATICLINE6, wxDefaultPosition, wxSize(490,3), wxLI_HORIZONTAL, _T("ID_STATICLINE6"));
	BoxSizer2->Add(StaticLine6, 0, wxALL, 0);
	BoxSizer2->Add(34,5,0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0);
	BoxSizer4 = new wxBoxSizer(wxHORIZONTAL);
	BoxSizer4->Add(9,20,0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 1);
	StaticText6 = new wxStaticText(ScrolledWindow1, ID_STATICTEXT6, _("Produkt"), wxDefaultPosition, wxSize(173,15), 0, _T("ID_STATICTEXT6"));
	wxFont StaticText6Font(10,wxFONTFAMILY_SWISS,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_LIGHT,false,_T("Calibri Light"),wxFONTENCODING_DEFAULT);
	StaticText6->SetFont(StaticText6Font);
	BoxSizer4->Add(StaticText6, 0, wxALL|wxALIGN_BOTTOM, wxDLG_UNIT(ScrolledWindow1,wxSize(3,0)).GetWidth());
	BoxSizer4->Add(209,20,0, wxALL, 5);
	StaticText7 = new wxStaticText(ScrolledWindow1, ID_STATICTEXT7, _("     Menge"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT7"));
	wxFont StaticText7Font(10,wxFONTFAMILY_SWISS,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_LIGHT,false,_T("Calibri Light"),wxFONTENCODING_DEFAULT);
	StaticText7->SetFont(StaticText7Font);
	BoxSizer4->Add(StaticText7, 0, wxALL|wxALIGN_BOTTOM, 3);
	BoxSizer2->Add(BoxSizer4, 0, wxALL, 0);
	StaticLine1 = new wxStaticLine(ScrolledWindow1, ID_STATICLINE1, wxDefaultPosition, wxSize(490,1), wxLI_HORIZONTAL, _T("ID_STATICLINE1"));
	StaticLine1->Disable();
	BoxSizer2->Add(StaticLine1, 0, wxALL, 0);
	FlexGridSizer2 = new wxFlexGridSizer(0, 9, 0, 0);
	StaticText1 = new wxStaticText(ScrolledWindow1, ID_STATICTEXT1, _("Wasserfarbkasten"), wxDefaultPosition, wxSize(125,19), 0, _T("ID_STATICTEXT1"));
	wxFont StaticText1Font(12,wxFONTFAMILY_SWISS,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_NORMAL,false,_T("Calibri"),wxFONTENCODING_DEFAULT);
	StaticText1->SetFont(StaticText1Font);
	FlexGridSizer2->Add(StaticText1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 10);
	StaticBitmap2 = new wxStaticBitmap(ScrolledWindow1, ID_STATICBITMAP2, wxBitmap(wxImage(_T("C:\\Users\\Thomas\\Documents\\Programmprojekte\\Wall-Mat\\Ordner_gross.jpg")).Rescale(wxSize(46,48).GetWidth(),wxSize(46,48).GetHeight())), wxDefaultPosition, wxSize(46,48), wxSIMPLE_BORDER, _T("ID_STATICBITMAP2"));
	FlexGridSizer2->Add(StaticBitmap2, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	FlexGridSizer2->Add(30,20,1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	StaticText4 = new wxStaticText(ScrolledWindow1, ID_STATICTEXT4, _("A4"), wxDefaultPosition, wxSize(45,20), 0, _T("ID_STATICTEXT4"));
	wxFont StaticText4Font(12,wxFONTFAMILY_SWISS,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_NORMAL,false,_T("Calibri"),wxFONTENCODING_DEFAULT);
	StaticText4->SetFont(StaticText4Font);
	FlexGridSizer2->Add(StaticText4, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	FlexGridSizer2->Add(20,20,1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	StaticText5 = new wxStaticText(ScrolledWindow1, ID_STATICTEXT5, _("rot"), wxDefaultPosition, wxSize(45,20), 0, _T("ID_STATICTEXT5"));
	wxFont StaticText5Font(12,wxFONTFAMILY_SWISS,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_NORMAL,false,_T("Calibri"),wxFONTENCODING_DEFAULT);
	StaticText5->SetFont(StaticText5Font);
	FlexGridSizer2->Add(StaticText5, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	FlexGridSizer2->Add(28,20,3, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	SpinCtrl1 = new wxSpinCtrl(ScrolledWindow1, ID_SPINCTRL1, _T("0"), wxDefaultPosition, wxSize(51,21), 0, 0, 100, 0, _T("ID_SPINCTRL1"));
	SpinCtrl1->SetValue(_T("0"));
	FlexGridSizer2->Add(SpinCtrl1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	BoxSizer2->Add(FlexGridSizer2, 0, wxALL, 5);
	StaticLine2 = new wxStaticLine(ScrolledWindow1, ID_STATICLINE2, wxDefaultPosition, wxSize(490,1), wxLI_HORIZONTAL, _T("ID_STATICLINE2"));
	BoxSizer2->Add(StaticLine2, 0, wxALL, 0);
	FlexGridSizer3 = new wxFlexGridSizer(0, 8, 0, 0);
	StaticText8 = new wxStaticText(ScrolledWindow1, ID_STATICTEXT8, _("Ordner, gross"), wxDefaultPosition, wxSize(125,19), 0, _T("ID_STATICTEXT8"));
	wxFont StaticText8Font(12,wxFONTFAMILY_SWISS,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_NORMAL,false,_T("Calibri"),wxFONTENCODING_DEFAULT);
	StaticText8->SetFont(StaticText8Font);
	FlexGridSizer3->Add(StaticText8, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 10);
	StaticBitmap3 = new wxStaticBitmap(ScrolledWindow1, ID_STATICBITMAP3, wxBitmap(wxImage(_T("C:\\Users\\Thomas\\Documents\\Programmprojekte\\Wall-Mat\\Ordner_gross.jpg")).Rescale(wxSize(46,48).GetWidth(),wxSize(46,48).GetHeight())), wxDefaultPosition, wxSize(46,48), wxSIMPLE_BORDER, _T("ID_STATICBITMAP3"));
	FlexGridSizer3->Add(StaticBitmap3, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	FlexGridSizer3->Add(30,20,1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	StaticText9 = new wxStaticText(ScrolledWindow1, ID_STATICTEXT9, wxEmptyString, wxDefaultPosition, wxSize(45,20), 0, _T("ID_STATICTEXT9"));
	wxFont StaticText9Font(11,wxFONTFAMILY_SWISS,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_NORMAL,false,_T("Calibri"),wxFONTENCODING_DEFAULT);
	StaticText9->SetFont(StaticText9Font);
	FlexGridSizer3->Add(StaticText9, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	FlexGridSizer3->Add(20,20,1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	StaticText10 = new wxStaticText(ScrolledWindow1, ID_STATICTEXT10, wxEmptyString, wxDefaultPosition, wxSize(45,20), 0, _T("ID_STATICTEXT10"));
	wxFont StaticText10Font(11,wxFONTFAMILY_SWISS,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_NORMAL,false,_T("Calibri"),wxFONTENCODING_DEFAULT);
	StaticText10->SetFont(StaticText10Font);
	FlexGridSizer3->Add(StaticText10, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	FlexGridSizer3->Add(28,20,1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	SpinCtrl2 = new wxSpinCtrl(ScrolledWindow1, ID_SPINCTRL2, _T("0"), wxDefaultPosition, wxSize(51,21), 0, 0, 100, 0, _T("ID_SPINCTRL2"));
	SpinCtrl2->SetValue(_T("0"));
	FlexGridSizer3->Add(SpinCtrl2, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	BoxSizer2->Add(FlexGridSizer3, 1, wxALL, 5);
	StaticLine3 = new wxStaticLine(ScrolledWindow1, ID_STATICLINE3, wxDefaultPosition, wxSize(490,1), wxLI_HORIZONTAL, _T("ID_STATICLINE3"));
	BoxSizer2->Add(StaticLine3, 0, wxALL, 0);
	FlexGridSizer4 = new wxFlexGridSizer(0, 8, 0, 0);
	StaticText11 = new wxStaticText(ScrolledWindow1, ID_STATICTEXT11, _("Schere"), wxDefaultPosition, wxSize(125,19), 0, _T("ID_STATICTEXT11"));
	wxFont StaticText11Font(12,wxFONTFAMILY_SWISS,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_NORMAL,false,_T("Calibri"),wxFONTENCODING_DEFAULT);
	StaticText11->SetFont(StaticText11Font);
	FlexGridSizer4->Add(StaticText11, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 10);
	StaticBitmap4 = new wxStaticBitmap(ScrolledWindow1, ID_STATICBITMAP4, wxBitmap(wxImage(_T("C:\\Users\\Thomas\\Documents\\Programmprojekte\\Wall-Mat\\Ordner_gross.jpg")).Rescale(wxSize(46,48).GetWidth(),wxSize(46,48).GetHeight())), wxDefaultPosition, wxSize(46,48), wxSIMPLE_BORDER, _T("ID_STATICBITMAP4"));
	FlexGridSizer4->Add(StaticBitmap4, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	FlexGridSizer4->Add(30,20,1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	StaticText12 = new wxStaticText(ScrolledWindow1, ID_STATICTEXT12, _("Label"), wxDefaultPosition, wxSize(45,20), 0, _T("ID_STATICTEXT12"));
	wxFont StaticText12Font(11,wxFONTFAMILY_SWISS,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_NORMAL,false,_T("Calibri"),wxFONTENCODING_DEFAULT);
	StaticText12->SetFont(StaticText12Font);
	FlexGridSizer4->Add(StaticText12, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	FlexGridSizer4->Add(20,20,1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	StaticText13 = new wxStaticText(ScrolledWindow1, ID_STATICTEXT13, _("Label"), wxDefaultPosition, wxSize(45,20), 0, _T("ID_STATICTEXT13"));
	wxFont StaticText13Font(11,wxFONTFAMILY_SWISS,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_NORMAL,false,_T("Calibri"),wxFONTENCODING_DEFAULT);
	StaticText13->SetFont(StaticText13Font);
	FlexGridSizer4->Add(StaticText13, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	FlexGridSizer4->Add(28,20,1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	SpinCtrl3 = new wxSpinCtrl(ScrolledWindow1, ID_SPINCTRL3, _T("0"), wxDefaultPosition, wxSize(51,21), 0, 0, 100, 0, _T("ID_SPINCTRL3"));
	SpinCtrl3->SetValue(_T("0"));
	FlexGridSizer4->Add(SpinCtrl3, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	BoxSizer2->Add(FlexGridSizer4, 1, wxALL, 5);
	StaticLine4 = new wxStaticLine(ScrolledWindow1, ID_STATICLINE4, wxDefaultPosition, wxSize(490,1), wxLI_HORIZONTAL, _T("ID_STATICLINE4"));
	BoxSizer2->Add(StaticLine4, 0, wxALL, 0);
	FlexGridSizer5 = new wxFlexGridSizer(0, 9, 0, 0);
	StaticText14 = new wxStaticText(ScrolledWindow1, ID_STATICTEXT14, _("Geo-Dreieck"), wxDefaultPosition, wxSize(125,19), 0, _T("ID_STATICTEXT14"));
	wxFont StaticText14Font(12,wxFONTFAMILY_SWISS,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_NORMAL,false,_T("Calibri"),wxFONTENCODING_DEFAULT);
	StaticText14->SetFont(StaticText14Font);
	FlexGridSizer5->Add(StaticText14, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 10);
	StaticBitmap5 = new wxStaticBitmap(ScrolledWindow1, ID_STATICBITMAP5, wxBitmap(wxImage(_T("C:\\Users\\Thomas\\Documents\\Programmprojekte\\Wall-Mat\\Ordner_gross.jpg")).Rescale(wxSize(46,48).GetWidth(),wxSize(46,48).GetHeight())), wxDefaultPosition, wxSize(46,48), wxSIMPLE_BORDER, _T("ID_STATICBITMAP5"));
	FlexGridSizer5->Add(StaticBitmap5, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	FlexGridSizer5->Add(30,20,1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	StaticText15 = new wxStaticText(ScrolledWindow1, ID_STATICTEXT15, _("Label"), wxDefaultPosition, wxSize(45,20), 0, _T("ID_STATICTEXT15"));
	wxFont StaticText15Font(11,wxFONTFAMILY_SWISS,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_NORMAL,false,_T("Calibri"),wxFONTENCODING_DEFAULT);
	StaticText15->SetFont(StaticText15Font);
	FlexGridSizer5->Add(StaticText15, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	FlexGridSizer5->Add(20,20,1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	StaticText16 = new wxStaticText(ScrolledWindow1, ID_STATICTEXT16, _("Label"), wxDefaultPosition, wxSize(45,20), 0, _T("ID_STATICTEXT16"));
	wxFont StaticText16Font(11,wxFONTFAMILY_SWISS,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_NORMAL,false,_T("Calibri"),wxFONTENCODING_DEFAULT);
	StaticText16->SetFont(StaticText16Font);
	FlexGridSizer5->Add(StaticText16, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	FlexGridSizer5->Add(28,20,1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	TextCtrl1 = new wxTextCtrl(ScrolledWindow1, ID_TEXTCTRL1, _("3"), wxDefaultPosition, wxSize(33,21), 0, wxDefaultValidator, _T("ID_TEXTCTRL1"));
	FlexGridSizer5->Add(TextCtrl1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	SpinButton1 = new wxSpinButton(ScrolledWindow1, ID_SPINBUTTON1, wxDefaultPosition, wxDefaultSize, wxSP_VERTICAL|wxSP_ARROW_KEYS, _T("ID_SPINBUTTON1"));
	SpinButton1->SetRange(0, 100);
	FlexGridSizer5->Add(SpinButton1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0);
	BoxSizer2->Add(FlexGridSizer5, 1, wxALL, 5);
	StaticLine5 = new wxStaticLine(ScrolledWindow1, ID_STATICLINE5, wxDefaultPosition, wxSize(490,1), wxLI_HORIZONTAL, _T("ID_STATICLINE5"));
	BoxSizer2->Add(StaticLine5, 0, wxALL, 0);
	BoxSizer5 = new wxBoxSizer(wxHORIZONTAL);
	Button3 = new wxButton(ScrolledWindow1, ID_BUTTON3, _("Warenkorb speichern"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON3"));
	wxFont Button3Font(9,wxFONTFAMILY_SWISS,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_NORMAL,false,_T("Calibri"),wxFONTENCODING_DEFAULT);
	Button3->SetFont(Button3Font);
	BoxSizer5->Add(Button3, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	BoxSizer5->Add(95,20,0, wxALL|wxEXPAND, 5);
	Button2 = new wxButton(ScrolledWindow1, ID_BUTTON2, _("Bestellung abschicken"), wxDefaultPosition, wxSize(209,36), 0, wxDefaultValidator, _T("ID_BUTTON2"));
	wxFont Button2Font(13,wxFONTFAMILY_SWISS,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_BOLD,false,_T("Calibri"),wxFONTENCODING_DEFAULT);
	Button2->SetFont(Button2Font);
	BoxSizer5->Add(Button2, 0, wxALL|wxEXPAND, 5);
	BoxSizer2->Add(BoxSizer5, 0, wxALL|wxEXPAND, 5);
	FlexGridSizer1->Add(BoxSizer2, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	ScrolledWindow1->SetSizer(FlexGridSizer1);
	FlexGridSizer1->Fit(ScrolledWindow1);
	FlexGridSizer1->SetSizeHints(ScrolledWindow1);
	BoxSizer1->Add(ScrolledWindow1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0);
	SetSizer(BoxSizer1);
	BoxSizer1->Fit(this);
	BoxSizer1->SetSizeHints(this);
	Center();

	//*)
}

User_Warenkorb::~User_Warenkorb()
{
	//(*Destroy(User_Warenkorb)
	//*)
}

Code: Select all

#ifndef USER_WARENKORB_H
#define USER_WARENKORB_H

//(*Headers(User_Warenkorb)
#include <wx/sizer.h>
#include <wx/stattext.h>
#include <wx/textctrl.h>
#include <wx/spinctrl.h>
#include <wx/statline.h>
#include <wx/panel.h>
#include <wx/statbmp.h>
#include <wx/button.h>
#include <wx/dialog.h>
#include <wx/spinbutt.h>
#include <wx/scrolwin.h>
//*)

class User_Warenkorb: public wxDialog
{
	public:

		User_Warenkorb(wxWindow* parent,wxWindowID id=wxID_ANY,const wxPoint& pos=wxDefaultPosition,const wxSize& size=wxDefaultSize);
		virtual ~User_Warenkorb();

		//(*Declarations(User_Warenkorb)
		wxStaticText* StaticText10;
		wxStaticText* StaticText9;
		wxStaticBitmap* StaticBitmap2;
		wxStaticBitmap* StaticBitmap5;
		wxSpinCtrl* SpinCtrl1;
		wxStaticText* StaticText13;
		wxStaticText* StaticText2;
		wxStaticLine* StaticLine6;
		wxStaticText* StaticText14;
		wxStaticText* StaticText6;
		wxStaticBitmap* StaticBitmap1;
		wxStaticText* StaticText8;
		wxStaticText* StaticText11;
		wxStaticBitmap* StaticBitmap4;
        wxScrolledWindow* ScrolledWindow1;
		wxStaticText* StaticText1;
		wxStaticText* StaticText3;
		wxButton* Button2;
		wxStaticLine* StaticLine4;
		wxStaticLine* StaticLine2;
		wxSpinButton* SpinButton1;
		wxButton* Button3;
		wxSpinCtrl* SpinCtrl3;
		wxStaticText* StaticText5;
		wxStaticText* StaticText7;
		wxStaticLine* StaticLine3;
		wxStaticLine* StaticLine1;
		wxSpinCtrl* SpinCtrl2;
		wxTextCtrl* TextCtrl1;
		wxStaticText* StaticText15;
		wxStaticText* StaticText12;
		wxStaticText* StaticText4;
		wxStaticText* StaticText16;
		wxStaticBitmap* StaticBitmap3;
		wxStaticLine* StaticLine5;
		//*)

	protected:

		//(*Identifiers(User_Warenkorb)
		static const long ID_STATICTEXT3;
		static const long ID_STATICTEXT2;
		static const long ID_STATICBITMAP1;
		static const long ID_STATICLINE6;
		static const long ID_STATICTEXT6;
		static const long ID_STATICTEXT7;
		static const long ID_STATICLINE1;
		static const long ID_STATICTEXT1;
		static const long ID_STATICBITMAP2;
		static const long ID_STATICTEXT4;
		static const long ID_STATICTEXT5;
		static const long ID_SPINCTRL1;
		static const long ID_STATICLINE2;
		static const long ID_STATICTEXT8;
		static const long ID_STATICBITMAP3;
		static const long ID_STATICTEXT9;
		static const long ID_STATICTEXT10;
		static const long ID_SPINCTRL2;
		static const long ID_STATICLINE3;
		static const long ID_STATICTEXT11;
		static const long ID_STATICBITMAP4;
		static const long ID_STATICTEXT12;
		static const long ID_STATICTEXT13;
		static const long ID_SPINCTRL3;
		static const long ID_STATICLINE4;
		static const long ID_STATICTEXT14;
		static const long ID_STATICBITMAP5;
		static const long ID_STATICTEXT15;
		static const long ID_STATICTEXT16;
		static const long ID_TEXTCTRL1;
		static const long ID_SPINBUTTON1;
		static const long ID_STATICLINE5;
		static const long ID_BUTTON3;
		static const long ID_BUTTON2;
        static const long ID_SCROLLEDWINDOW1;
		//*)

	private:

		//(*Handlers(User_Warenkorb)
		void OnButton2Click(wxCommandEvent& event);
		void OnSpinButton1Change(wxSpinEvent& event);
		void OnSpinButton1ChangeUp(wxSpinEvent& event);
		void OnSpinCtrl1Change(wxSpinEvent& event);
		void OnSpinCtrl1Change1(wxSpinEvent& event);
		//*)

		DECLARE_EVENT_TABLE()
};

#endif

User avatar
doublemax
Moderator
Moderator
Posts: 14982
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Make wxDialog scrollable?

Post by doublemax » Fri Mar 30, 2018 10:17 pm

You need to set the scroll rate. Check if there is a setting for that in the gui editor.

Otherwise, add something like this:

Code: Select all

ScrolledWindow1->SetScrollRate(15, 15);
Use the source, Luke!

Wanderer82
Earned some good credits
Earned some good credits
Posts: 148
Joined: Tue Jul 26, 2016 2:00 pm

Re: Make wxDialog scrollable?

Post by Wanderer82 » Fri Mar 30, 2018 10:23 pm

:P Yes, yes, yes... that was it. Thank you.

Wanderer82
Earned some good credits
Earned some good credits
Posts: 148
Joined: Tue Jul 26, 2016 2:00 pm

Re: Make wxDialog scrollable?

Post by Wanderer82 » Sat Mar 31, 2018 7:38 pm

Another - maybe small - problem. After creating the dialog with all the elements, I have the problem that when the scrollbar shows up on the right side, the content of wxScrolledWindow is pushed to the left so that the StaticTexts aren't aligned with the text above. To describe a bit more: I have a top of the dialog which contains fix items such as a title and subtitles inside a wxPanel (it's a shopping cart saying "Product" on the left side and "Quantity" on the right. This is not scrollable and defines the size of the dialog window. Below that I have a wxScrolledWindow which contains the items in the shopping cart whose product names and quantities should be aligned under "Product" and "Quantity". Now the scrollbars push everything to the left.

Maybe my entire design is bad. But maybe there's an easy way... Here's the code (maybe useful):

Code: Select all

NewDialog::NewDialog(wxWindow* parent,wxWindowID id,const wxPoint& pos,const wxSize& size)
{
	//(*Initialize(NewDialog)
	wxBoxSizer* BoxSizer4;
	wxBoxSizer* BoxSizer6;
	wxBoxSizer* BoxSizer5;
	wxBoxSizer* BoxSizer7;
	wxBoxSizer* BoxSizer8;
	wxBoxSizer* BoxSizer2;
	wxBoxSizer* BoxSizer1;
	wxBoxSizer* BoxSizer3;

	Create(parent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, _T("wxID_ANY"));
	BoxSizer1 = new wxBoxSizer(wxVERTICAL);
	Panel1 = new wxPanel(this, ID_PANEL1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T("ID_PANEL1"));
	BoxSizer2 = new wxBoxSizer(wxVERTICAL);
	BoxSizer3 = new wxBoxSizer(wxHORIZONTAL);
	StaticText1 = new wxStaticText(Panel1, ID_STATICTEXT1, _("Stahel, Thomas"), wxDefaultPosition, wxSize(165,19), 0, _T("ID_STATICTEXT1"));
	wxFont StaticText1Font(12,wxFONTFAMILY_SWISS,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_BOLD,false,_T("Calibri"),wxFONTENCODING_DEFAULT);
	StaticText1->SetFont(StaticText1Font);
	BoxSizer3->Add(StaticText1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	StaticText2 = new wxStaticText(Panel1, ID_STATICTEXT2, _("Warenkorb"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT2"));
	wxFont StaticText2Font(20,wxFONTFAMILY_SWISS,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_BOLD,false,_T("Calibri"),wxFONTENCODING_DEFAULT);
	StaticText2->SetFont(StaticText2Font);
	BoxSizer3->Add(StaticText2, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	BoxSizer3->Add(100,20,0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	StaticBitmap1 = new wxStaticBitmap(Panel1, ID_STATICBITMAP1, wxBitmap(wxImage(_T("C:\\Users\\Thomas\\Documents\\Programmprojekte\\Wall-Mat\\warenkorb2.png"))), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICBITMAP1"));
	BoxSizer3->Add(StaticBitmap1, 0, wxRIGHT|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20);
	BoxSizer2->Add(BoxSizer3, 1, wxTOP|wxBOTTOM|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 10);
	StaticLine1 = new wxStaticLine(Panel1, ID_STATICLINE1, wxDefaultPosition, wxSize(20,3), wxLI_HORIZONTAL, _T("ID_STATICLINE1"));
	BoxSizer2->Add(StaticLine1, 0, wxALL|wxEXPAND, 0);
	BoxSizer2->Add(20,6,0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0);
	BoxSizer4 = new wxBoxSizer(wxHORIZONTAL);
	StaticText3 = new wxStaticText(Panel1, ID_STATICTEXT3, _("Produkt"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT3"));
	wxFont StaticText3Font(10,wxFONTFAMILY_SWISS,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_LIGHT,false,_T("Calibri Light"),wxFONTENCODING_DEFAULT);
	StaticText3->SetFont(StaticText3Font);
	BoxSizer4->Add(StaticText3, 0, wxLEFT|wxALIGN_BOTTOM, 5);
	BoxSizer4->Add(365,10,0, wxALL|wxALIGN_BOTTOM, 5);
	StaticText4 = new wxStaticText(Panel1, ID_STATICTEXT4, _("Menge"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT4"));
	wxFont StaticText4Font(10,wxFONTFAMILY_SWISS,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_LIGHT,false,_T("Calibri Light"),wxFONTENCODING_DEFAULT);
	StaticText4->SetFont(StaticText4Font);
	BoxSizer4->Add(StaticText4, 0, wxALL|wxALIGN_BOTTOM, 0);
	BoxSizer2->Add(BoxSizer4, 0, wxALL|wxEXPAND, 0);
	StaticLine2 = new wxStaticLine(Panel1, ID_STATICLINE2, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL, _T("ID_STATICLINE2"));
	BoxSizer2->Add(StaticLine2, 0, wxTOP|wxEXPAND, 2);
	Panel1->SetSizer(BoxSizer2);
	BoxSizer2->Fit(Panel1);
	BoxSizer2->SetSizeHints(Panel1);
	BoxSizer1->Add(Panel1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	ScrolledWindow1 = new wxScrolledWindow(this, ID_SCROLLEDWINDOW1, wxDefaultPosition, wxDefaultSize, wxVSCROLL|wxHSCROLL|wxFULL_REPAINT_ON_RESIZE, _T("ID_SCROLLEDWINDOW1"));
    ScrolledWindow1->SetMaxSize(wxSize(600,100));
	ScrolledWindow1->SetScrollRate(3,3);
	BoxSizer5 = new wxBoxSizer(wxVERTICAL);
	BoxSizer6 = new wxBoxSizer(wxHORIZONTAL);
	StaticText5 = new wxStaticText(ScrolledWindow1, ID_STATICTEXT5, _("Wasserfarbkasten"), wxDefaultPosition, wxSize(125,19), 0, _T("ID_STATICTEXT5"));
	wxFont StaticText5Font(12,wxFONTFAMILY_SWISS,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_NORMAL,false,_T("Calibri"),wxFONTENCODING_DEFAULT);
	StaticText5->SetFont(StaticText5Font);
	BoxSizer6->Add(StaticText5, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	StaticBitmap2 = new wxStaticBitmap(ScrolledWindow1, ID_STATICBITMAP2, wxBitmap(wxImage(_T("C:\\Users\\Thomas\\Documents\\Programmprojekte\\Wall-Mat\\Ordner_gross.jpg")).Rescale(wxSize(46,48).GetWidth(),wxSize(46,48).GetHeight())), wxDefaultPosition, wxSize(46,48), wxSIMPLE_BORDER, _T("ID_STATICBITMAP2"));
	BoxSizer6->Add(StaticBitmap2, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	BoxSizer6->Add(30,5,0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	StaticText6 = new wxStaticText(ScrolledWindow1, ID_STATICTEXT6, _("A4"), wxDefaultPosition, wxSize(45,20), 0, _T("ID_STATICTEXT6"));
	wxFont StaticText6Font(12,wxFONTFAMILY_SWISS,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_NORMAL,false,_T("Calibri"),wxFONTENCODING_DEFAULT);
	StaticText6->SetFont(StaticText6Font);
	BoxSizer6->Add(StaticText6, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	BoxSizer6->Add(30,5,0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	StaticText7 = new wxStaticText(ScrolledWindow1, ID_STATICTEXT7, _("rot"), wxDefaultPosition, wxSize(45,20), 0, _T("ID_STATICTEXT7"));
	wxFont StaticText7Font(12,wxFONTFAMILY_SWISS,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_NORMAL,false,_T("Calibri"),wxFONTENCODING_DEFAULT);
	StaticText7->SetFont(StaticText7Font);
	BoxSizer6->Add(StaticText7, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	BoxSizer6->Add(28,5,0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	SpinCtrl1 = new wxSpinCtrl(ScrolledWindow1, ID_SPINCTRL1, _T("0"), wxDefaultPosition, wxSize(61,21), 0, 0, 100, 0, _T("ID_SPINCTRL1"));
	SpinCtrl1->SetValue(_T("0"));
	BoxSizer6->Add(SpinCtrl1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	BoxSizer5->Add(BoxSizer6, 0, wxALL|wxEXPAND, 0);
	StaticLine3 = new wxStaticLine(ScrolledWindow1, ID_STATICLINE3, wxDefaultPosition, wxSize(10,-1), wxLI_HORIZONTAL, _T("ID_STATICLINE3"));
	BoxSizer5->Add(StaticLine3, 0, wxALL|wxEXPAND, 5);
	BoxSizer8 = new wxBoxSizer(wxHORIZONTAL);
	StaticText8 = new wxStaticText(ScrolledWindow1, ID_STATICTEXT8, _("Ordner_Gross"), wxDefaultPosition, wxSize(125,19), 0, _T("ID_STATICTEXT8"));
	wxFont StaticText8Font(12,wxFONTFAMILY_SWISS,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_NORMAL,false,_T("Calibri"),wxFONTENCODING_DEFAULT);
	StaticText8->SetFont(StaticText8Font);
	BoxSizer8->Add(StaticText8, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	StaticBitmap3 = new wxStaticBitmap(ScrolledWindow1, ID_STATICBITMAP3, wxBitmap(wxImage(_T("C:\\Users\\Thomas\\Documents\\Programmprojekte\\Wall-Mat\\Ordner_gross.jpg")).Rescale(wxSize(46,48).GetWidth(),wxSize(46,48).GetHeight())), wxDefaultPosition, wxSize(46,48), wxSIMPLE_BORDER, _T("ID_STATICBITMAP3"));
	BoxSizer8->Add(StaticBitmap3, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	BoxSizer8->Add(30,5,0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	StaticText9 = new wxStaticText(ScrolledWindow1, ID_STATICTEXT9, wxEmptyString, wxDefaultPosition, wxSize(45,20), 0, _T("ID_STATICTEXT9"));
	BoxSizer8->Add(StaticText9, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	BoxSizer8->Add(30,5,0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	StaticText10 = new wxStaticText(ScrolledWindow1, ID_STATICTEXT10, wxEmptyString, wxDefaultPosition, wxSize(45,20), 0, _T("ID_STATICTEXT10"));
	BoxSizer8->Add(StaticText10, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	BoxSizer8->Add(28,5,0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	SpinCtrl2 = new wxSpinCtrl(ScrolledWindow1, ID_SPINCTRL2, _T("0"), wxDefaultPosition, wxSize(61,21), 0, 0, 100, 0, _T("ID_SPINCTRL2"));
	SpinCtrl2->SetValue(_T("0"));
	BoxSizer8->Add(SpinCtrl2, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	BoxSizer5->Add(BoxSizer8, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0);
	StaticLine4 = new wxStaticLine(ScrolledWindow1, ID_STATICLINE4, wxDefaultPosition, wxSize(10,-1), wxLI_HORIZONTAL, _T("ID_STATICLINE4"));
	BoxSizer5->Add(StaticLine4, 1, wxALL|wxEXPAND, 5);
	ScrolledWindow1->SetSizer(BoxSizer5);
	BoxSizer5->Fit(ScrolledWindow1);
	BoxSizer5->SetSizeHints(ScrolledWindow1);
	BoxSizer1->Add(ScrolledWindow1, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20);
	Panel2 = new wxPanel(this, ID_PANEL2, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T("ID_PANEL2"));
	BoxSizer7 = new wxBoxSizer(wxHORIZONTAL);
	Button1 = new wxButton(Panel2, ID_BUTTON1, _("Label"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON1"));
	BoxSizer7->Add(Button1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	Panel2->SetSizer(BoxSizer7);
	BoxSizer7->Fit(Panel2);
	BoxSizer7->SetSizeHints(Panel2);
	BoxSizer1->Add(Panel2, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	SetSizer(BoxSizer1);
	BoxSizer1->Fit(this);
	BoxSizer1->SetSizeHints(this);
	Center();

	//*)

User avatar
doublemax
Moderator
Moderator
Posts: 14982
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Make wxDialog scrollable?

Post by doublemax » Sat Mar 31, 2018 9:01 pm

That code is a little too complex to comprehend just by reading it ;)
Can you show a screenshot?
Use the source, Luke!

Wanderer82
Earned some good credits
Earned some good credits
Posts: 148
Joined: Tue Jul 26, 2016 2:00 pm

Re: Make wxDialog scrollable?

Post by Wanderer82 » Sat Mar 31, 2018 9:11 pm

Sure... this is how it looks:

http://www.directupload.net/file/d/5043 ... 7x_jpg.htm

And this is from the resource window in Code::Blocks:

http://www.directupload.net/file/d/5043 ... qb_jpg.htm
http://www.directupload.net/file/d/5043 ... y4_jpg.htm

Actually I think the best thing to do, would be to have more space at the right side where the scrollbars can be placed. Bus this has to be inside the first box sizer somehow. And if the list is not too long, the scrollbars won't be there.

User avatar
doublemax
Moderator
Moderator
Posts: 14982
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Make wxDialog scrollable?

Post by doublemax » Sat Mar 31, 2018 9:42 pm

How do you get them to align in the first place? Do you use absolute sizes for the "cells" and spacers?
Use the source, Luke!

Wanderer82
Earned some good credits
Earned some good credits
Posts: 148
Joined: Tue Jul 26, 2016 2:00 pm

Re: Make wxDialog scrollable?

Post by Wanderer82 » Sat Mar 31, 2018 10:06 pm

Yes, everywhere I use absolute sizes. So I guess that's a problem. Now I rearranged everything so that it looks nice with the scrollbars. It's a bit wider on the right side now and everything is adjusted so that it's exactly aligned under each other when the scrollbars appear. For the case that there is no need for scrollbars (just a few items) I use the former designed window and also made it a bit wider so that both windows have the same size (with and without scrollbar). As I have to create the window with its contents during runtime I can first see how many items have to be displayed and then use the correct layout. But I think that's very beginner-like and actually incorrect and also prone to errors.

Post Reply