[gtkmm] I am stuck with a C++ problem
- From: "Andreas B. Thun" <abt gmx de>
- To: gtkmm-list gnome org
- Subject: [gtkmm] I am stuck with a C++ problem
- Date: Thu, 15 Jan 2004 11:38:33 +0100
Hi members,
I have a C++ problem I just cannot solve.
I am new to C++ so maybe you can help easily:
I want to create 10 ParameterLines holding
4 widgets within class ParameterLine.
ParameterLine is derived from HBox.
class Parameters is calling ParameterLine
to create those boxes. Parameters is
derived from VBox, holding all objects
of ParameterLine.
My problem is I cannot see any widget
in my table! Something is wrong with
creation of my objects.
When I create the widgets directly in
main.cpp without classes involved it works....
main.h
Parameters m_Parameters;
main.cpp:
myTable->attach(m_Parameters, 0, 6, 1, 2);
Parameters.h:
-------------
class Parameters : public Gtk::VBox {
public:
Parameters();
virtual ~Parameters();
};
Parameters.cpp:
---------------
// An object of this class represents all ParameterLines in a VBox
Parameters::Parameters()
{
// Generate ParameterLines
for (int i=0; i<10; i++)
{
ParameterLine pLine;
pack_start(pLine);
}
}
ParameterLine.h:
----------------
class ParameterLine : public Gtk::HBox {
public:
ParameterLine();
virtual ~ParameterLine();
protected:
Gtk::Label m_paramNameLabel;
Gtk::Entry m_paramValEntry;
Gtk::Label m_paramTypeLabel;
Gtk::Button m_descButton;
};
ParameterLine.cpp:
------------------
ParameterLine::ParameterLine() : m_descButton("Help")
{
// View Name of Parameter as Label
m_paramNameLabel.set_alignment(Gtk::ALIGN_LEFT);
m_paramNameLabel.set_text("m_name");
// View Value of Parameter in an entry
m_paramValEntry.set_text(m_value);
m_paramValEntry.set_editable("true");
// View Type of Parameter as Label
m_paramTypeLabel.set_text("m_type");
// Pack all widgets into this object
pack_start(m_paramNameLabel);
pack_start(m_paramValEntry);
pack_start(m_paramTypeLabel);
pack_start(m_descButton);
}
TIA,
Andi
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]