tom
19-05-2004, 18:38
Hi, ich hab grad das Tutorial von wxWidgets durch und möchte nun ein wenig experimentieren ...
Als erstes wollt ich mal ein wxListCtrl darstellen. Das klappt auch soweit, doch egal was ich als "pos" angebe, es wird immer so angezeigt, dass das Ganze Parentframe ausgefüllt ist (wie bei wxDefaultPosition/wxDefaultSize).
Woran liegt das?
MainFrame.h
#ifndef _BITMAPFRAME_H
#define _BITMAPFRAME_H
class MainFrame : public wxFrame
{
public:
// Konstruktor
MainFrame(const wxChar *title,
int xpos, int ypos,
int width, int height);
// Destruktor
~MainFrame();
private:
wxListCtrl *FileList;
};
#endif //_BITMAPFRAME_H
MainFrame.cpp
#include "wx/wxprec.h"
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif // WX_PRECOMP
#include "wx/listctrl.h"
#include "wx/colour.h"
#include "MainFrame.h"
MainFrame::MainFrame(const wxChar *title, int xpos, int ypos, int width, int height)
: wxFrame((wxFrame *) NULL, -1, title, wxPoint(xpos, ypos), wxSize(width, height))
{
const wxPoint FileListPos(10, 10);
const wxSize FileListSize(50, 100);
wxListCtrl *FileList = new wxListCtrl(this, -1,
FileListPos, FileListSize,
wxLC_REPORT|wxLC_VRULES|wxLC_HRULES,
wxDefaultValidator,
wxT("FileList"));
// FileList->SetBackgroundColour(*wxBLUE);
FileList->InsertColumn(1, "Erste Spalte", wxLIST_FORMAT_LEFT, -1);
FileList->InsertColumn(2, "Zweite Spalte", wxLIST_FORMAT_LEFT, -1);
FileList->InsertItem(1, "Hallo Welt");
FileList->InsertItem(2, "Soso");
}
MainFrame::~MainFrame()
{
}
Als erstes wollt ich mal ein wxListCtrl darstellen. Das klappt auch soweit, doch egal was ich als "pos" angebe, es wird immer so angezeigt, dass das Ganze Parentframe ausgefüllt ist (wie bei wxDefaultPosition/wxDefaultSize).
Woran liegt das?
MainFrame.h
#ifndef _BITMAPFRAME_H
#define _BITMAPFRAME_H
class MainFrame : public wxFrame
{
public:
// Konstruktor
MainFrame(const wxChar *title,
int xpos, int ypos,
int width, int height);
// Destruktor
~MainFrame();
private:
wxListCtrl *FileList;
};
#endif //_BITMAPFRAME_H
MainFrame.cpp
#include "wx/wxprec.h"
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif // WX_PRECOMP
#include "wx/listctrl.h"
#include "wx/colour.h"
#include "MainFrame.h"
MainFrame::MainFrame(const wxChar *title, int xpos, int ypos, int width, int height)
: wxFrame((wxFrame *) NULL, -1, title, wxPoint(xpos, ypos), wxSize(width, height))
{
const wxPoint FileListPos(10, 10);
const wxSize FileListSize(50, 100);
wxListCtrl *FileList = new wxListCtrl(this, -1,
FileListPos, FileListSize,
wxLC_REPORT|wxLC_VRULES|wxLC_HRULES,
wxDefaultValidator,
wxT("FileList"));
// FileList->SetBackgroundColour(*wxBLUE);
FileList->InsertColumn(1, "Erste Spalte", wxLIST_FORMAT_LEFT, -1);
FileList->InsertColumn(2, "Zweite Spalte", wxLIST_FORMAT_LEFT, -1);
FileList->InsertItem(1, "Hallo Welt");
FileList->InsertItem(2, "Soso");
}
MainFrame::~MainFrame()
{
}