Re: Howto : new widget new container
- Original Message - From: Stephane Wirtel [EMAIL PROTECTED] To: gtkmm-list@gnome.org Sent: Tuesday, June 21, 2005 11:50 PM Subject: Howto : new widget new container Hi all, I want to create a new widget with a new container. Theses news objects are to draw a P.E.R.T. diagram. With the example from the tutorial, how to implement the on_button_press_event signal ? Is there an example or a small documentation ? in the example: in void MyWidget::on_realize() change attributes.event_mask = get_events () | Gdk::EXPOSURE_MASK; to attributes.event_mask = get_events () | Gdk::EXPOSURE_MASK | Gdk::BUTTON_PRESS_MASK; and add bool MyWidget::on_button_press_event (GdkEventButton* event) {std::cout button pressed std::endl; } -- Marco ___ gtkmm-list mailing list gtkmm-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtkmm-list
weird behavior with TreeModel
Has anyone else had problems with TreeModel? 1) If I try to append rows after using TreeModel.clear(), it segfaults. 2) If I try to define a column as reorderable - it does not compile but if I put it in a loop thru all the columns it compiles okay. 3) I'm getting weird behavior when using a table refresh function (setListToDisplay) - sometimes the view does not load the data, some times I get a glibmm memory error. I'm running gtkmm 2.6.1 with gtk 2.6.4 with gcc 3.3.5 on debian sid Here's excerpt of what I've been using - anything wrong in what I'm doing? in .h file: virtual void menuTreeOnClicked(const Gtk::TreeModel::Path path, Gtk::TreeViewColumn* column); //-- menu tree -- class ModelColumns : public Gtk::TreeModel::ColumnRecord { public: ModelColumns() { add(id); add(name); } Gtk::TreeModelColumnintid; Gtk::TreeModelColumnstd::stringname; }; ModelColumns menuColumns; Gtk::ScrolledWindow menuWindow; Gtk::TreeView menuTreeView; Glib::RefPtrGtk::ListStore menuTreeModel; in .cpp file //-- menu tree - menuTreeModel = Gtk::ListStore::create(menuColumns); menuTreeView.set_model(menuTreeModel); //Gtk::TreeModel::Row row = *(menuTreeModel-append()); //row[menuColumns.id] = 0; //row[menuColumns.name] = ; menuTreeView.append_column(ID, menuColumns.id); //(menuColumns.id).set_reorderable(); menuTreeView.append_column(Name, menuColumns.name); for(int i=0;i2;i++) { Gtk::TreeView::Column* mColumn = menuTreeView.get_column(i); mColumn-set_reorderable(); } menuWindow.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); menuWindow.add(menuTreeView); menuTreeView.signal_row_activated().connect(sigc::mem_fun(*this, LanduseListDialog::menuTreeOnClicked) ); . void LanduseListDialog::setListToDisplay(std::vectorData*data) { if (data.empty()) {return;} //menuTreeModel.clear(); Gtk::TreeModel::Row row; for (uint i=0;idata.size();i++) { row = *(menuTreeModel-append()); row[menuColumns.id] = data[i]-getid(); row[menuColumns.name] = data[i]-getname(); } } ___ gtkmm-list mailing list gtkmm-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtkmm-list
Callback to parent dialog
I've tried the following but it's not right. Can someone help out - thks. Gtk::GtkWidget* toplevel = gtk_widget_get_toplevel(this); if (GTK_WIDGET_TOPLEVEL (toplevel)) { toplevel-editDialog(data); } ___ gtkmm-list mailing list gtkmm-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtkmm-list
How to move widget inside Gtk::Layout?
How can I move widget with the mouse that is child of Gtk::Layout? Should I use Drag and Drop, and how? ___ gtkmm-list mailing list gtkmm-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtkmm-list
Re: weird behavior with TreeModel
Thanks very much for the clear explanations. It all makes sense now. Nalin Singal wrote: Sorry for breaking up the reply. Regarding the reorderable columns. When you do menuColumns.id.set_reorderable(), you are trying to set the column in the treeModel as reoderable. But actually the column in the treeView is the one which should be reorderable. Remember there are two different sets of columns - one in the treemodel and one in the treeview which are backed up by the treemodel columns. So the columns in the treeview are the ones which can be reordered and not the ones in the treemodel because reordering is just a view thing. So as you are doing the for loop, get the column you want to set as reorderable from the treeview and call set_reorderable on it. Hope this helps :) -Nalin --- John Taber [EMAIL PROTECTED] wrote: Has anyone else had problems with TreeModel? 1) If I try to append rows after using TreeModel.clear(), it segfaults. 2) If I try to define a column as reorderable - it does not compile but if I put it in a loop thru all the columns it compiles okay. 3) I'm getting weird behavior when using a table refresh function (setListToDisplay) - sometimes the view does not load the data, some times I get a glibmm memory error. I'm running gtkmm 2.6.1 with gtk 2.6.4 with gcc 3.3.5 on debian sid Here's excerpt of what I've been using - anything wrong in what I'm doing? in .h file: virtual void menuTreeOnClicked(const Gtk::TreeModel::Path path, Gtk::TreeViewColumn* column); //-- menu tree -- class ModelColumns : public Gtk::TreeModel::ColumnRecord { public: ModelColumns() { add(id); add(name); } Gtk::TreeModelColumnintid; Gtk::TreeModelColumnstd::stringname; }; ModelColumns menuColumns; Gtk::ScrolledWindow menuWindow; Gtk::TreeView menuTreeView; Glib::RefPtrGtk::ListStore menuTreeModel; in .cpp file //-- menu tree - menuTreeModel = Gtk::ListStore::create(menuColumns); menuTreeView.set_model(menuTreeModel); //Gtk::TreeModel::Row row = *(menuTreeModel-append()); //row[menuColumns.id] = 0; //row[menuColumns.name] = ; menuTreeView.append_column(ID, menuColumns.id); //(menuColumns.id).set_reorderable(); menuTreeView.append_column(Name, menuColumns.name); for(int i=0;i2;i++) { Gtk::TreeView::Column* mColumn = menuTreeView.get_column(i); mColumn-set_reorderable(); } menuWindow.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); menuWindow.add(menuTreeView); menuTreeView.signal_row_activated().connect(sigc::mem_fun(*this, LanduseListDialog::menuTreeOnClicked) ); . void LanduseListDialog::setListToDisplay(std::vectorData*data) { if (data.empty()) {return;} //menuTreeModel.clear(); Gtk::TreeModel::Row row; for (uint i=0;idata.size();i++) { row = *(menuTreeModel-append()); row[menuColumns.id] = data[i]-getid(); row[menuColumns.name] = data[i]-getname(); } } ___ gtkmm-list mailing list gtkmm-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtkmm-list __ How much free photo storage do you get? Store your friends 'n family snaps for FREE with Yahoo! Photos http://in.photos.yahoo.com ___ gtkmm-list mailing list gtkmm-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtkmm-list