Re: GtkTable cells resizing
On 15/05/12 14:45, Tristan Van Berkom wrote: On Mon, May 14, 2012 at 10:29 PM, James Steward jamesstew...@optusnet.com.au wrote: On 15/05/12 11:56, Tristan Van Berkom wrote: ... perhaps it's worth trying an extra call to gtk_widget_queue_resize() after modifying your table. I'm trying that. I have signals connected thus; g_signal_connect(G_OBJECT(p-canvas), expose-event, G_CALLBACK(plot_expose_event), p); g_signal_connect(G_OBJECT(p-canvas), select-item, G_CALLBACK(plot_select_event), p); and get the plot_select_event() routine to calculate and set new canvas sizes with gtk_plot_canvas_set_size(GTK_PLOT_CANVAS(p-canvas), width, height); then call gtk_widget_queue_resize(GTK_WIDGET(p-table)); This causes plot_expose_event() to get called, which calls gtk_plot_canvas_paint(GTK_PLOT_CANVAS(canvas)); But the table rows seem to expand to the largest canvas and don't seem to take on variable heights. Feel I've been around and around the mulberry bush on this ;-) Hard to say whats going on here, I wonder who is responding to the size requests for these items which are getting drawn. It seems you connect to a signal to draw on a widget, which means the content is not the widget, so probably you need to also connect a signal to override the size request of the said widget you intend painting onto ? Perhaps you are using forced size requests to accomplish this (using gtk_widget_set_size_request() or such), and have somehow mixed up the size requests while swapping your content onto new rows/columns ? Other than that, child 'expand' properties will be considered by the GtkTable (if all children can expand, then it's quite possible that after reaching a large window size the content will be evenly spread). Thanks for your ideas. I had another. I could define the table as having twice as many rows, then (hopefully) just reassigning the attach points. I.e. where I now have; gtk_table_attach_defaults(table1, canvas1, 0, 1, 0, 1); gtk_table_attach_defaults(table1, canvas2, 0, 1, 1, 2); gtk_table_attach_defaults(table1, canvas3, 0, 1, 2, 3); instead I'll define a 6 row table and initialise as; gtk_table_attach_defaults(table1, canvas1, 0, 1, 0, 2); gtk_table_attach_defaults(table1, canvas2, 0, 1, 2, 4); gtk_table_attach_defaults(table1, canvas3, 0, 1, 4, 6); Then to zoom canvas2, I can hopefully somehow move the attachment points to; gtk_table_attach_defaults(table1, canvas1, 0, 1, 0, 1); gtk_table_attach_defaults(table1, canvas2, 0, 1, 1, 5); gtk_table_attach_defaults(table1, canvas3, 0, 1, 5, 6); I'd obviously need to fix the row size by making the table homogeneous. What do you think? Regards, James. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
GtkTable cells resizing
Hi, I have an application with a tabbed view. On two tabs I have a table, one is a 2x2 table, the other a 3x1 table (3 rows). In each cell is a canvas that has a gtk plot. I want to be able to click one of the plots in the 3x1 table and change the canvas size to 2/3 the original, with the other two canvases being 1/6 the original size. After redrawing and resizing and mucking about, I can't get the table rows to be different sizes, accommodating the different sized canvases properly, even though I have gtk_table_set_homogeneous (table, FALSE); Any clues how to do this? Regards, James. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GtkTable cells resizing
On 15/05/12 11:56, Tristan Van Berkom wrote: Are you using GTK+ 3 ? Still on GTK+ 2.0. If so, use GtkGrid instead... possibly just that will fix things for you. Short of that, if I understand correctly, you have a target state/configuration of a GtkTable (or GtkGrid), if you construct the table in the target configuration from scratch, I take it things work as you want... but dont work properly after performing some kind of a transformation to reach your target state... That's about it. ... perhaps it's worth trying an extra call to gtk_widget_queue_resize() after modifying your table. I'm trying that. I have signals connected thus; g_signal_connect(G_OBJECT(p-canvas), expose-event, G_CALLBACK(plot_expose_event), p); g_signal_connect(G_OBJECT(p-canvas), select-item, G_CALLBACK(plot_select_event), p); and get the plot_select_event() routine to calculate and set new canvas sizes with gtk_plot_canvas_set_size(GTK_PLOT_CANVAS(p-canvas), width, height); then call gtk_widget_queue_resize(GTK_WIDGET(p-table)); This causes plot_expose_event() to get called, which calls gtk_plot_canvas_paint(GTK_PLOT_CANVAS(canvas)); But the table rows seem to expand to the largest canvas and don't seem to take on variable heights. Feel I've been around and around the mulberry bush on this ;-) Regards, James. On Mon, May 14, 2012 at 9:21 PM, James Steward jamesstew...@optusnet.com.au wrote: Hi, I have an application with a tabbed view. On two tabs I have a table, one is a 2x2 table, the other a 3x1 table (3 rows). In each cell is a canvas that has a gtk plot. I want to be able to click one of the plots in the 3x1 table and change the canvas size to 2/3 the original, with the other two canvases being 1/6 the original size. After redrawing and resizing and mucking about, I can't get the table rows to be different sizes, accommodating the different sized canvases properly, even though I have gtk_table_set_homogeneous (table, FALSE); Any clues how to do this? Regards, James. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Trouble with button mask
Hi, I've been trying to get a canvas select item event to fire for a gtk_plot_canvas. Upon left clicking inside a plot canvas, I can see that gtk_plot_canvas_button_press(...) gets called, and the following lines near the beginning of that function (in the gtkextra lib) cause the function to exit without anything being selected. gdk_window_get_pointer(widget-window, NULL, NULL, mods); if(!(mods GDK_BUTTON1_MASK)) return FALSE; Upon inspection of the variable mods, it appears to have a value of GDK_MOD2_MASK, according to GDB. Anyone know why a GDK_BUTTON1_MASK isn't read when I left click? Regards, James. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Trouble with button mask
Stupid question below. Please ignore. James. On 14/05/12 15:47, James Steward wrote: Hi, I've been trying to get a canvas select item event to fire for a gtk_plot_canvas. Upon left clicking inside a plot canvas, I can see that gtk_plot_canvas_button_press(...) gets called, and the following lines near the beginning of that function (in the gtkextra lib) cause the function to exit without anything being selected. gdk_window_get_pointer(widget-window, NULL, NULL, mods); if(!(mods GDK_BUTTON1_MASK)) return FALSE; Upon inspection of the variable mods, it appears to have a value of GDK_MOD2_MASK, according to GDB. Anyone know why a GDK_BUTTON1_MASK isn't read when I left click? Regards, James. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Trouble with TreeView
Hi All, I've built a TreeModel by creating a new TreeStore, and populating it with; for (rp = parent; rp; rp = rp-next) { gtk_tree_store_append(store, iter, NULL); gtk_tree_store_set(store, iter, 0, rp-number, -1); for (ep = rp-child; ep; ep = ep-next) { gtk_tree_store_append(store, child, iter); gtk_tree_store_set(store, child, 0, ep-number, 1, ep-name, 2, ep-mean, 3, ep-std_dev, -1); } } Then created a new view, associated the model with it, and inserted columns. I add the view to a scrolled window, which is in turn added to a dialog content area. When I display the dialog, the tree is not quite what I expect. In the first row (0), the values for name, mean and std_dev have not been defined, yet the mean and std_dev (which are floats) are shown as 0.00. I don't want them to be displayed at all. So to clarify, the first part of the tree looks like 1 | | 0.00 | 0.00 5 | Fu Bar | 0.345123 | 0.051234 3 | Snafu | 0.765432 | 0.145678 Is there a way to suppress the display of some columns that don't make sense for the parent node, I.e. columns 1, 2, 3 in row 0? Regards, James. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: misc and a question...
On 29/12/11 11:05, Gary Kline wrote: ... due to people on this list who have been patient and 'splained things ... and who have NOT said: 'go read the man page' --well, nutshell, in ~ 3 weeks, i'm starting to see how gtk works. i just learned that TRUE == 1 and not 0. i haven't used the access() call in awhile. i am trying to catch catch errors before they crop up. the way i see my application being used, there won't be any xterms or konsoles open to print a stderr or stdout. So: is there a way in gtk to have a message dialog open that prints warning or whatever to the new user? #define eprintf(...) do { \ GtkWidget *dialog; \ dialog = gtk_message_dialog_new ((GtkWindow *)window, \ GTK_DIALOG_DESTROY_WITH_PARENT, \ GTK_MESSAGE_ERROR, \ GTK_BUTTONS_CLOSE, \ __VA_ARGS__); \ gtk_dialog_set_default_response(GTK_DIALOG (dialog), GTK_RESPONSE_CLOSE); \ gtk_dialog_run (GTK_DIALOG (dialog)); \ gtk_widget_destroy (dialog); \ } while (0) -- JS. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: gtk_tree_view_column_set_cell_data_func gives GTK-CRITICAL error
On 30/11/11 20:04, Tadej Borovšak wrote: Hi. 2011/11/30 James Stewardjamesstew...@optusnet.com.au: col = gtk_tree_view_insert_column_with_attributes ( GTK_TREE_VIEW (view), -1, Title, renderer, text, i, strikethrough, j, background, k, background-set, TRUE, NULL); gtk_tree_view_column_set_cell_data_func( gtk_tree_view_get_column(GTK_TREE_VIEW(view), col), renderer, render_float, GINT_TO_POINTER(i), NULL); IIRC, gtk_tree_view_insert_column_with_attributes() returns number of columns and gtk_tree_view_get_column() expects to get column number where first column is 0. So you may be off-by-one in your call to gtk_tree_view_column_set_cell_data_func(). Well spotted! Thanks very much. Regards, James. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
gtk_tree_view_column_set_cell_data_func gives GTK-CRITICAL error
Hi, Wanting to display floats with a particular format in a tree view. void render_float(GtkTreeViewColumn *column, GtkCellRenderer *renderer, GtkTreeModel *model, GtkTreeIter *iter, gpointer user_data) { gfloat f; gchar buf[20]; int col = GPOINTER_TO_INT(user_data); gtk_tree_model_get(model, iter, col, f, -1); g_snprintf(buf, sizeof(buf), %.2f, f); g_object_set(renderer, text, buf, NULL); } G_MODULE_EXPORT gboolean on_menu_show_results_activate( GtkWidget *w, GdkEvent *event, gpointer user_data) { ... renderer = gtk_cell_renderer_text_new (); col = gtk_tree_view_insert_column_with_attributes ( GTK_TREE_VIEW (view), -1, Title, renderer, text, i, strikethrough, j, background, k, background-set, TRUE, NULL); gtk_tree_view_column_set_cell_data_func( gtk_tree_view_get_column(GTK_TREE_VIEW(view), col), renderer, render_float, GINT_TO_POINTER(i), NULL); ... } When I run the app I get: Gtk-CRITICAL **: gtk_cell_layout_set_cell_data_func: assertion `GTK_IS_CELL_LAYOUT (cell_layout)' failed Can anyone spot what I've done wrong? There's no compiler warnings, just this runtime error. -- James. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Maximize on Windows 7 seems broken.
On 11/05/2011 8:07 AM, James Steward wrote: Hi, I'm developing on Windows 7, 64 bit, using MinGW/MSYS for familiarity with a Posix type system. I have installed gtk+-bundle_2.22.1-20101227_win32.zip, and building a 32bit app for compatibility. My application calls gtk_window_maximize(GTK_WINDOW(window)); but the resulting window is not maximized properly. It sits below the top of the screen, and is cut off at the bottom of the screen. Also, restoring the window, then dragging to the top of the screen to allow Bill to maximize it results in the same. Running on an XP machine, the maximize works fine, as it does on Linux. Is this a known Windows 7 (possibly also Vista) problem with GTK+ apps? Is there a fix? I've googled around, but not hit on any solutions yet. I have a v small test case. Can I attach it here? Let's find out... I also have a screenshot if anyone is interested. Regards, James. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Maximize on Windows 7 seems broken.
On 13/05/2011 8:03 AM, James Steward wrote: On 11/05/2011 8:07 AM, James Steward wrote: Hi, I'm developing on Windows 7, 64 bit, using MinGW/MSYS for familiarity with a Posix type system. I have installed gtk+-bundle_2.22.1-20101227_win32.zip, and building a 32bit app for compatibility. My application calls gtk_window_maximize(GTK_WINDOW(window)); but the resulting window is not maximized properly. It sits below the top of the screen, and is cut off at the bottom of the screen. Also, restoring the window, then dragging to the top of the screen to allow Bill to maximize it results in the same. Running on an XP machine, the maximize works fine, as it does on Linux. Is this a known Windows 7 (possibly also Vista) problem with GTK+ apps? Is there a fix? I've googled around, but not hit on any solutions yet. I have a v small test case. Can I attach it here? Let's find out... I also have a screenshot if anyone is interested. Well, that didn't seem to work very well. In the meantime I've found the answer. I had these properties set on the main window. property name=window_positioncenter-always/property property name=default_width1024/property Removing them and the window maximizes properly. The hint came from bug https://bugzilla.gnome.org/show_bug.cgi?id=587591 . Hope this helps someone else. Regards, James. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Maximize on Windows 7 seems broken.
Hi, I'm developing on Windows 7, 64 bit, using MinGW/MSYS for familiarity with a Posix type system. I have installed gtk+-bundle_2.22.1-20101227_win32.zip, and building a 32bit app for compatibility. My application calls gtk_window_maximize(GTK_WINDOW(window)); but the resulting window is not maximized properly. It sits below the top of the screen, and is cut off at the bottom of the screen. Also, restoring the window, then dragging to the top of the screen to allow Bill to maximize it results in the same. Running on an XP machine, the maximize works fine, as it does on Linux. Is this a known Windows 7 (possibly also Vista) problem with GTK+ apps? Is there a fix? I've googled around, but not hit on any solutions yet. James. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Maximize on Windows 7 seems broken.
On 11/05/2011 8:19 AM, Matteo Landi wrote: On Wed, May 11, 2011 at 12:07 AM, James Steward jamesstew...@optusnet.com.au wrote: Hi, I'm developing on Windows 7, 64 bit, using MinGW/MSYS for familiarity with a Posix type system. I have installed gtk+-bundle_2.22.1-20101227_win32.zip, and building a 32bit app for compatibility. My application calls gtk_window_maximize(GTK_WINDOW(window)); but the resulting window is not maximized properly. It sits below the top of the screen, and is cut off at the bottom of the screen. Also, restoring the window, then dragging to the top of the screen to allow Bill to maximize it results in the same. Running on an XP machine, the maximize works fine, as it does on Linux. Is this a known Windows 7 (possibly also Vista) problem with GTK+ apps? Is there a fix? I've googled around, but not hit on any solutions yet. Is it maybe a problem with the window manager? I had problem trying to raise a window up if covered. Just guessing... Whether a problem with Bill's window manager or not, there must be a solution from Gtk. JS. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list