first - thanks a lot!
This is my first variant with Constraints (the cpp-file):
BEGIN_EVENT_TABLE(TARA_Setup_Frame, wxFrame)
...
EVT_PAINT(TARA_Setup_Frame::OnPaint)
END_EVENT_TABLE()
IMPLEMENT_APP(MyApp)
bool MyApp::OnInit(){
wxImage::AddHandler(new wxGIFHandler);
MyFrame *frame = new MyFrame("GUI",wxPoint(250, 50), wxSize(500, 650));
frame->Show(TRUE);
SetTopWindow(frame);
return TRUE;
}
MyFrame::MyFrame(const wxString& titel, const wxPoint& pos, const wxSize& size)
: wxFrame((wxFrame*)NULL, -1, titel, pos, size){
SetAutoLayout(TRUE);
panel_bsc = new wxPanel(this);
wxLayoutConstraints *lc_bsc = new wxLayoutConstraints;
lc_bsc->left.SameAs (this, wxLeft);
lc_bsc->top.SameAs (this, wxTop);
lc_bsc->right.PercentOf (this, wxWidth, 100);
lc_bsc->height.PercentOf (this, wxHeight, 100);
panel_bsc->SetConstraints(lc_bsc);
wxStaticText *label = new wxStaticText( panel_bsc,-1, "&Titel",wxPoint(20,35), wxSize(200, 80), wxST_NO_AUTORESIZE);
label->SetFont(wxFont(18, wxSWISS, wxNORMAL, wxNORMAL, FALSE, ""));
image = new wxImage("./picture.gif", wxBITMAP_TYPE_GIF);
if (!image->LoadFile("picture.gif"))
wxLogError(wxT("Can't load GIF image"));
(void)new wxStaticBox( panel_bsc, -1, "&ProgTitle",
wxPoint(5, 100), wxSize(482, 220));
(void)new wxCheckBox( panel_bsc, ID_1, "&choose 1", wxPoint(40,120), wxSize(170,30) );
(void)new wxCheckBox( panel_bsc, ID_2, "&choose 2", wxPoint(40,160), wxSize(170,30) );
(void)new wxButton( panel_bsc, ID_iO, "&i.O.",wxPoint(100, 530), wxSize(100, 30));
(void)new wxButton( panel_bsc, ID_Quit, "&Abbrechen", wxPoint(300, 530),
wxSize(100, 30));
CreateStatusBar();
if (image->Ok()) SetStatusText("LOADED gif!");
else SetStatusText("FAILED TO LOAD gif!");
}
void TARA_Setup_Frame::OnPaint(wxPaintEvent& WXUNUSED(event)){
wxPaintDC dc(panel_bsc);
PrepareDC(dc);
image_bmp = new wxBitmap;
*image_bmp = image->ConvertToBitmap();
if (image && image->Ok())
dc.DrawBitmap(*image_bmp, 220, 30, FALSE);
}
In this variant I had (I guess) a problemm, becoase I "paint" on one panel...exually I can do 3 panels: on the top: for titel and logo (picture) and the rest..but when I tryed to put picture panel (upper right corner) with
lc_1->right.SameAs(this, wxRight); it wouldn't be accept....
with wxSizer (or wxBoxSizer) I've got a error, that the function "add()" is not defined for wxSizer.... maybe I vergot to include some header? |