Signal of a button dynamically created
Hi, I'm building a popup window that has a Gtk::Grid inside it. The first row has a form with three Gtk::Entry and a button to add the information to the program. The rest of the rows has the items created before in that way (just with Gtk::Label) and a button to remove the information. Like this: |--| | Gtk::Entry | Gtk::Entry | Gtk::Entry | Gtk::Button (add) | |--| |--- rows dynamically added --| | Gtk::Label | Gtk::Label | Gtk::Label | Gtk::Button (remove) | |--| | Gtk::Label | Gtk::Label | Gtk::Label | Gtk::Button (remove) | |--| | Gtk::Label | Gtk::Label | Gtk::Label | Gtk::Button (remove) | |--| ... The point here is: how can I know what button was pressed in order to remove a row? Thanks! :) Borja. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Signal of a button dynamically created
Thank you all guys, you're incredible! :) I've finally implemented the Jon Zabala's answer, I think it's the easiest. Thank you again!! ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Loading glade in a weird way
Hi all! I'm developing an application using gtkmm with glade. The problem that I have is that when the main window is loaded, another window appears and it is the practical main window, that is to say, if you close that window you close the program. I attach an image of what is happening at [1]. I followed the steps at [2] to create my application and, then, I created a class that implements a Window loads all the widgets as in [3]. I don't want to have a main program that loads all the widgets because I don't want to have shared memory with the widgets (buttons, dialogs, etc.), so I thought that was the best way to implement a window loaded with glade. The code of my application is at [4]. The main.cpp file is like the HelloWorld example and visualhfsm.cpp is the class that implements a Gtk::Window and loads the glade file. I don't know what I'm doing wrong, could you please give me a pointer in order to solve my problem? :) Thank you very much, Borja. [1] - https://dl.dropboxusercontent.com/u/11143437/visualhfsm_weird.png [2] - https://developer.gnome.org/gtkmm-tutorial/3.4/sec-helloworld.html.en [3] - https://developer.gnome.org/gtkmm-tutorial/3.2/sec-builder-accessing-widgets.html.en [4] - https://svn.jderobot.org/users/bmenendez/tfm/trunk/src/visualHFSM-4/ ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Items on canvas disappear after saving file with filechooser dialog
Hi all, I'm developing an app to create hierarchical finite state machines for a robot platform. For this app I need to save the automata designed in a xml file, so I launch a filechooser dialog when the user picks in the save button. Then, for saving the file, I iterate into the data structure to save every property of each node and transition and it saves the file correctly, but when the filechooser dialog closes, the canvas hides all the items and I cannot see them (although I know they are already stored in the data structure). I tried to show all the items again (using its properties) and repaint the canvas using update(), but nothing happened. Do you know what am I doing wrong? Thanks! Borja. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Mouse events on a Cairo Context
Hi, Thank you for your help, guys. Finally I tried with goocanvasmm and everything works fine, as I wanted. There are some simple examples in the libgoocanvasmm-2.0-doc package for Ubuntu, so I could deal with the problem :) The most similar example there is moving_shapes. Thank you! ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Mouse events on a Cairo Context
Hi Colomban This is probably the simplest solution, it's meant for this kind of things. 4 - Handle the events yourself: listen to the button-press-event/button-release-event of your DrawingArea and do the math to know whether the click is on your circle or not. Maybe Cairo has this kind of thing, like is that point in that shape, not sure. The problem with (4) is dragdrop. I think it could be very difficult to deal with it, so I'm going to try the third solution, with goocanvasmm. Do you know any example of use of goocanvasmm? Thank you! :) ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Mouse events on a Cairo Context
Hi all, I'm developing an application with C++ and GTK3 but I'm stucked. I've created a visual application with glade which has three columns and one of them, the middle one, is a DrawingArea. In that DrawingArea I want to draw some circles at the point I want to after pressing a button and have different mouse events on that circles (like drag and drop, double click, right click...). I've made the first thing (draw a circle after pressing a button) following the official documentationhttps://developer.gnome.org/gtkmm-tutorial/3.2/chapter-drawingarea.html.en, but the problem is that I don't know how to do the mouse events, but I thought about it and I have some different solutions (I don't know if they are the bests solutions or maybe there are better): 1 - I think the best way is to create a signal to the cairomm context, but I didn't see anything to do that. Maybe the way would be to create a cairo surface or something like that. 2 - Every time I click to create a circle, I would have to create a gtk widget in which I can handle mouse events. The problem here is that I think it is impossible to put a widget on a DrawingArea, is it possible? 3 - Use goocanvasmm. The problem here is that goocanvasmm has a little documentation https://developer.gnome.org/goocanvasmm/stable/ and I think this is not the best solution, I prefer to use cairomm. This application was written in C using GTK2, and the circles were drawn using gnomecanvas, adding signals in an easy way to each circle; and now I'm moving this application to C++ and GTK3 to renew it. I'm very new to GTK (and graphical interfaces in general), but I looked for solutions for hours and I don't know what is the best way in order to continue my work. I also looked for similar messages in this list, but I didn't find it. Although I think the best way is the first option, I tried to make the second because I think it is the regular way. Anyway, if you know how to deal with this problem, could you give me an example of how to do that? Thank you for your help :) ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list