Need layout help
Udo Baumgart
ubit.de at gmx.de
Tue Jan 16 06:20:44 PST 2007
Hi,
i try....
What i want is the following:
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT
LLLLLLBmmmmmmmmmmmmmmmmmmmmmmmmmm
LLLLLLBmmmmmmmmmmmmmmmmmmmmmmmmmm
LLLLLLBmmmmmmmmmmmmmmmmmmmmmmmmmm
LLLLLLBmmmmmmmmmmmmmmmmmmmmmmmmmm
LLLLLLBmmmmmmmmmmmmmmmmmmmmmmmmmm
LLLLLLBmmmmmmmmmmmmmmmmmmmmmmmmmm
LLLLLLBmmmmmmmmmmmmmmmmmmmmmmmmmm
MMMMMM = Menubar
TTTTTT = Toolbar
LLLLLL = Left userinterface area
B = Button
mmmmmm = Main document area
LLLLLL should become vertically scrollable if the window size is to
small to display all interface elements.
I tried to use a wxScrolledWindow for LLLLL which contains a couple of
sliders (for now as dummy content).
But as soon as the scrollbars appear, the virtual size of the area inside
the scrolledwindow grows and grows and grows... Altough there is no change
inside the elements...
For more details see my first post to this thread which includes a sample
"myframe" which is commented and should be usable to see the effect. Just
compile and link the following sources, try to resize the window to a
small size and look what happens... Looks VERY strange to me and i am not
able to find a solution....
Here is the complete sourcecode (out of Code::Blocks). I am using Windows
XP
with wx2.8.0 monolithic unicode build.
----------app.cpp-----------------
#include "app.h"
#include "main.h"
IMPLEMENT_APP(MyApp);
bool MyApp::OnInit()
{
MyFrame* frame = new MyFrame(0L, _("wxWidgets Application Template"));
frame->Show();
return true;
}
--------- app.h -------------------
#ifndef APP_H
#define APP_H
#include <wx/wxprec.h>
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include <wx/wx.h>
#endif
class MyApp : public wxApp
{
public:
virtual bool OnInit();
};
#endif // APP_H
---------- main.cpp --------------
#include "main.h"
int idMenuQuit = wxNewId();
int idMenuAbout = wxNewId();
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_MENU(idMenuQuit, MyFrame::OnQuit)
EVT_MENU(idMenuAbout, MyFrame::OnAbout)
END_EVENT_TABLE()
MyFrame::MyFrame(wxFrame *frame, const wxString& title)
: wxFrame(frame, -1, title)
{
wxMenuBar* mbar = new wxMenuBar();
wxMenu* fileMenu = new wxMenu(_(""));
fileMenu->Append(idMenuQuit, _("&Quit\tAlt-F4"), _("Quit the
application"));
mbar->Append(fileMenu, _("&File"));
wxMenu* helpMenu = new wxMenu(_(""));
helpMenu->Append(idMenuAbout, _("&About\tF1"), _("Show info about this
application"));
mbar->Append(helpMenu, _("&Help"));
SetMenuBar(mbar);
// 5 Columns - lets try a BoxSizer
wxFlexGridSizer* mainbox = new wxFlexGridSizer(1,3,0,0);
SetSizer(mainbox);
// Add a ScrolledWindow for holding the user interface panel(s)
wxScrolledWindow* leftsc = new wxScrolledWindow(
this, wxID_ANY, wxDefaultPosition, wxDefaultSize,
wxVSCROLL, wxT("LeftScroll"));
mainbox->Add(leftsc, 1,wxEXPAND,0);
// Add a vertical box for the interface elements
wxBoxSizer* leftbox = new wxBoxSizer(wxVERTICAL);
leftsc->SetSizer(leftbox);
// Add testbutton and some dummy sliders
wxButton* test = new wxButton(leftsc, wxID_ANY,
_("Test"));
leftbox->Add(test,0,0,0);
wxSlider* sl = NULL;
for (int i=0; i<10; i++)
{
sl = new wxSlider(leftsc, wxID_ANY, 50, 0, 100,
wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL,
wxDefaultValidator, wxT("Slider"));
leftbox->Add(sl,0,0,0);
}
// Add Arrow
wxButton* leftarrow = new wxButton(this, wxID_ANY,
_("<"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT,
wxDefaultValidator, wxT("leftbutton"));
mainbox->Add(leftarrow,0,wxEXPAND,0);
// Add main area
wxTextCtrl* doc = new wxTextCtrl(this, wxID_ANY,
_("The quick brown fox jumps over the lazy dog. "
"The quick brown fox jumps over the lazy dog. "
"The quick brown fox jumps over the lazy dog. "
"The quick brown fox jumps over the lazy dog. "
"The quick brown fox jumps over the lazy dog. "
"The quick brown fox jumps over the lazy dog. "
"The quick brown fox jumps over the lazy dog. "
"The quick brown fox jumps over the lazy dog. "
"The quick brown fox jumps over the lazy dog. "
"The quick brown fox jumps over the lazy dog. "),
wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE,
wxDefaultValidator, wxT("document"));
mainbox->Add(doc, 1,wxEXPAND,0);
mainbox->RemoveGrowableCol(0);
mainbox->RemoveGrowableCol(1);
mainbox->AddGrowableCol(2,1);
Fit();
leftsc->SetScrollbars(5,5,100,100,0,0,true);
}
MyFrame::~MyFrame()
{
}
void MyFrame::OnQuit(wxCommandEvent& event)
{
Close();
}
void MyFrame::OnAbout(wxCommandEvent& event)
{
wxMessageBox(_("wxWidgets Application Template"), _("Welcome to..."));
}
------------ main.h ---------------
#ifndef MAIN_H
#define MAIN_H
#include "app.h"
class MyFrame: public wxFrame
{
public:
MyFrame(wxFrame *frame, const wxString& title);
~MyFrame();
private:
void OnQuit(wxCommandEvent& event);
void OnAbout(wxCommandEvent& event);
DECLARE_EVENT_TABLE();
};
#endif // MAIN_H
------ cut here ---------------------------
Ciao, Udo
Am Tue, 16 Jan 2007 15:01:34 +0100 schrieb Michael M. <michael at mustun.ch>:
>
> Udo Baumgart wrote:
>
>> Hi,
>> really nobody able to help me?
>
> :-)
>
> Maybe a graphic is helpful for explaining the GUI-Problem.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wx-users-unsubscribe at lists.wxwidgets.org
> For additional commands, e-mail: wx-users-help at lists.wxwidgets.org
More information about the wx-users
mailing list