Re: Gtk::Calendar problem



Thanks for your reply. Here is a minimal example. Bug appears after
two clicks on the "Add" button.

main.cpp
------------------------------
#include <gtkmm/main.h>
#include "testwindow.h"

int main(int argc, char *argv[])
{
    Gtk::Main kit(argc, argv);
    ExampleWindow window;
    Gtk::Main::run(window);
    return 0;
}

testwindow.h
------------------------------
#ifndef GTKMM_EXAMPLEWINDOW_H
#define GTKMM_EXAMPLEWINDOW_H

#include <gtkmm/window.h>

namespace Gtk
{
    class VBox;
    class Notebook;
    class Button;
}

class ExampleWindow : public Gtk::Window
{
public:
  ExampleWindow();
  virtual ~ExampleWindow();

protected:
  virtual void on_button_add();

  Gtk::VBox *m_pVBox;
  Gtk::Notebook *m_pNotebook;
  Gtk::Button *m_pButton_add;
};

#endif //GTKMM_EXAMPLEWINDOW_H

testwindow.cpp
------------------------------
#include "testwindow.h"
#include <gtkmm/box.h>
#include <gtkmm/notebook.h>
#include <gtkmm/button.h>
#include <gtkmm/calendar.h>

ExampleWindow::ExampleWindow()
:   m_pVBox(Gtk::manage(new Gtk::VBox()))
,   m_pNotebook(Gtk::manage(new Gtk::Notebook()))
,   m_pButton_add(Gtk::manage(new Gtk::Button("Add")))
{
    m_pVBox->pack_start(*m_pNotebook);
    m_pVBox->pack_start(*m_pButton_add);
    add(*m_pVBox);

    m_pButton_add->signal_clicked().connect(sigc::mem_fun(*this,
&ExampleWindow::on_button_add));

    show_all_children();
}

ExampleWindow::~ExampleWindow()
{
}

void ExampleWindow::on_button_add()
{
    m_pNotebook->append_page(*Gtk::manage(new Gtk::Calendar()), "Calendar");
    show_all_children();
}


2008/5/17 Jonathon Jongsma <jonathon quotidian org>:
> On Sat, 2008-05-17 at 04:40 +0400, Nikolay Shibalov wrote:
>> The problem in my code or something else?
>> Sorry, but i really need an answer. If something is not clear in my
>> message, I will try rewrite it.
>> Thank you in advance.
>>
>> 2008/5/13 Nikolay Shibalov <networm87 gmail com>:
>> >
>> > Hi. The problem is when i dynamically(then press a button for example) add  page containing Gtk::Calendar to Gtk::Notebook, Gtk::Calendar widget is partially visible through the first page, until I switch all tabs.
>> >
>> > The problem appears only with dynamic page addition(if i do this in constructor all ok) and may be only with Gtk::Calendar.
>> >
>> > Gtkmm version: gtkmm-2.12.5 built under MS Visual C++ Express 2008.
>> > OS: MS Vista x64.
>> >
>> > //---Code
>> >
>> > void ExampleWindow::on_button_add()
>> > {
>> >     m_pNotebook->append_page(*Gtk::manage(new Gtk::Calendar()), "Calendar");
>> >     show_all_children();
>> > }
>> >
>> > //--------
>> >
>> > Sorry for my bad english.
>
> If you want people to try to help solve the problem, it's best if you
> provide a *minimal* compilable example that illustrates the problem.
> Then we can easily compile it on our own systems and try it out.
> --
> Jonner
>
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list
>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]