Re: sprintf and clists
gchar buffer[1024]; static gchar *cclist[1]; sprintf(buffer, %d, some_dumb_int); cclist[0] = strdup(buffer); gtk_clist_append(GTK_CLIST(clist1), cclist); This is assuming you have a 1 column clist. check out if the string is '\0' terminated. best initialize it after the declaration with memset(buffer,'\0',1024); I don't think you need to check for the '\0' as the buffer is large enough to hold an integer. An integer might be at max 32bits, so for an unisgned int, approx. 4 000 000 000 (4 billion) or 4.0e9. So there is a maximum of 10 digits or caracteres. As the buffer is 1024 large, it is surelly big enough not to risk to have a buffer overflow. BTW wouldn't it be enough to use a buffer of size sizeof(int) ? No you cannot do that. Sizeof(int) give the size in octet allocate for one integer, depending on the compiler and the machine, it might be 2 or 4 octets. If you declare your buffer as sizeof(int), then at max you have a table of 4 caracteres. So you cannot put 1000 for example into such a buffer, it's too big number (it's 4 digits! so there is no place left for the '\0') Jean-Christophe ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Visible size of GnomeCanvas
Hello, We have a GnomeCanvas set to a size larger than the window. The user uses the scrollbars to move the canvas and see the hidden parts. For a certain purpose, we need to know the size of the visible area (the area which is currently visible within the border of the window). How to get this size? We packed the Canvas inside a ViewPort which is inside a scrollwindow. Maybe the information can be retrieved from one of those parents? Any help would be greatly appreciated, Best regards, --- Jean-Christophe Berthon ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: gdk_window_set_decorations doesn't work
When I'm creating the window and I want to set it's decoration to 0. Then I use gtk_widget_realize on the toplevel widget, then I retrieve the -window of this object and apply to it the gdk_window_set_decoration. Works fine for me! Best regards, --- Jean-Christophe Berthon - Original Message - From: Christian Biesinger [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, April 02, 2002 7:26 PM Subject: gdk_window_set_decorations doesn't work Hello! I've got a problem with gdk_window_set_decorations. The problem is: I'm calling it like this: GdkWindow *wnd = gtk_widget_get_toplevel(my_widget)-window; gdk_window_set_decorations(wnd, 0); However, it doesn't work - the decorations don't change. It only works if I set the decorations before the window is shown, but this is unusable for me. Hiding the window, setting the decorations and then showing it again doesn't either. Does anybody have any ideas how to make it work? Thanks, Christian [please cc me on replies, I'm not subscribed to this list] -- They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety. -- Benjamin Franklin ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Getting a nultiple selection from a CList
Hello Neil, When you are in MULTIPLE SELECTION mode, you can select multiple row by just clicking then one after one. And if you don't want anymore one row, just click on it. It doesn't use the ctrl and shift button! If you want it to be like under windows explorer, by using shift and ctrl, to select group or individual files, then you should set the mode to EXTENDED SELECTION. It is also about multi-selection! Best regards, --- Jean-Christophe Berthon - Original Message - From: Neil Hodge [EMAIL PROTECTED] To: Jean-Christophe Berthon [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Friday, March 29, 2002 1:50 AM Subject: Re: Getting a nultiple selection from a CList Jean: Thanks for the information. Now I have one more question related to this. I have activated GTK_SELECTION_MULTIPLE on the CList in question. However, when I try to actually do a multiple selection (mouse + shift or ctrl), nothing happens. Is this behavior not built in? If not, then how can I create it??? Thanks. Neil On Thu, 2002-03-28 at 02:30, Jean-Christophe Berthon wrote: Hello Neil, Here is how I'm doing it (I have a Selection Extended CList) GList *pxGList= NULL; gint32 iColumn; pxGList = GTK_CLIST(lstTemplate)-selection; pxGList = g_list_first(pxGList); while (pxGList != NULL) { gtk_clist_set_text(GTK_CLIST(lstTemplate), GPOINTER_TO_INT(pxGList-data), iColumn, Hello); pxGList = g_list_next(pxGList); } Best regards, --- Jean-Christophe Berthon - Original Message - From: Neil Hodge [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, March 27, 2002 7:23 PM Subject: Getting a nultiple selection from a CList All: I can't find any documentation regarding how to get the results from a multiple selection in a CList. Any help would be much appreciated. Thanks. Neil Hodge __ Do You Yahoo!? Yahoo! Movies - coverage of the 74th Academy Awards® http://movies.yahoo.com/ ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list -- Neil Hodge [EMAIL PROTECTED] ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Getting a nultiple selection from a CList
Hello Neil, Here is how I'm doing it (I have a Selection Extended CList) GList *pxGList= NULL; gint32 iColumn; pxGList = GTK_CLIST(lstTemplate)-selection; pxGList = g_list_first(pxGList); while (pxGList != NULL) { gtk_clist_set_text(GTK_CLIST(lstTemplate), GPOINTER_TO_INT(pxGList-data), iColumn, Hello); pxGList = g_list_next(pxGList); } Best regards, --- Jean-Christophe Berthon - Original Message - From: Neil Hodge [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, March 27, 2002 7:23 PM Subject: Getting a nultiple selection from a CList All: I can't find any documentation regarding how to get the results from a multiple selection in a CList. Any help would be much appreciated. Thanks. Neil Hodge __ Do You Yahoo!? Yahoo! Movies - coverage of the 74th Academy Awards® http://movies.yahoo.com/ ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Window size
Did you try this : gdk_window_resize (GdkWindow *window, gint width, gint height); To get the GdkWindow object of your Widget, just do it that way : GTK_WIDGET(MyWindow)-window (N.B. if MyWindow is a GtkWidget* then you don't need to cast it with GTK_WIDGET, simply write : MyWindow-window) Best regards, --- Jean-Christophe Berthon Cap Gemini -- Ernst Young France Skill IS -- Image Quality Email: [EMAIL PROTECTED] Tel: (+33) 561 31 6671 - Original Message - From: Jean-Yves Lamoureux [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, March 26, 2002 12:10 PM Subject: Window size Hi all, I'm walking through gtk 1.2 doc since 1 or 2 hours and I can find a working way to set the size of a window. gtk_window_set_geometry_hints don't works, gtk_window_set_default_size too. Have I misunderstanding something ? (note the window is opened, but in something like 10x10) Thanks a lot Jylam Here is my code : void OpenWindow(int width, int height, unsigned char *title) { MyWindow = (LnxWindow*) malloc(sizeof(LnxWindow)); MyWindow-MyGeometry.base_width = width; MyWindow-MyGeometry.base_height = height; gtk_init(NULL, NULL); MyWindow-window=gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_default_size (GTK_WINDOW(MyWindow-window), MyWindow-MyGeometry.base_width, MyWindow-MyGeometry.base_height); gtk_window_set_geometry_hints (GTK_WINDOW(MyWindow-window), NULL, MyWindow-MyGeometry, GDK_HINT_BASE_SIZE); gtk_window_set_title(GTK_WINDOW(MyWindow-window), title); gtk_signal_connect(GTK_OBJECT(MyWindow-window), destroy, GTK_SIGNAL_FUNC(gtk_main_quit), NULL); gtk_window_set_policy (GTK_WINDOW(MyWindow-window), FALSE, FALSE, FALSE); gtk_widget_show((GtkWidget*)MyWindow-window); gdk_flush(); } ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Window size
gdk_window_resize (GTK_WINDOW(MyWindow-window), width, height); (becauseMyWindow-window IS a GtkWindow). Then if your window is a GtkWindow object, you should cast it : gdk_window_resize(GTK_WIDGET(MyWindow)-window, width, height); Respect the parenthesis as you need to cast your GtkWindow object in a GtkWidget one. And once you casted it, you can access the window property of your GtkWidget which is the GdkWindow corresponding to your object (take care I said gDkwindow...) And it don't work ... :(( maybe written like above, it is going to work :-) Don't know if the fact that I don't use a gtk_main() or gtk_loop() or something change something, I think gdk_flush() do the work. ??? I'm not understanding you... a window is typed as a GtkWindow is most of the cases I think, no ? :) Well, I'm using only GtkWidget object, that I'm casting to the right type when needed, so I find my data structure more coherent. Geysí ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Position of Widget
Hello, I would like to know if there is a way to know at which position is a widget compare to another one. For example, at which position is the GtkCList that is included in a GtkNotebookTab that is included in a GtkBox that is included in a GtkWindow. I'd like to know the position of this CList compare to the GtkWindow, but I've no idea of how to do it... Any help would be appreciate :-) Best regards, --- Jean-Christophe Berthon ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
SegFault with GnomeCanvas (Polygon)
Hello, When using the Polygon item in a GnomeCanvas (with the aa option ON : it's about using libart instead of GDK to draw, I think...) we are getting a segmentation fault after having changing a few times the fill and borderline color of this object. We are changing the colors each time the user select a polygon. We are using the following code to create and change the color of a polygon : gtkRoot = gnome_canvas_root(GNOME_CANVAS(cnvDrawableObject)); gtkPoints = gnome_canvas_points_new(4); gtkPoints-coords[0] = (ast_double)aPointPxlBG.lX; gtkPoints-coords[1] = (ast_double)aPointPxlBG.lY; gtkPoints-coords[2] = (ast_double)aPointPxlBD.lX; gtkPoints-coords[3] = (ast_double)aPointPxlBD.lY; gtkPoints-coords[4] = (ast_double)aPointPxlHG.lX; gtkPoints-coords[5] = (ast_double)aPointPxlHG.lY; gtkPoints-coords[6] = (ast_double)aPointPxlHD.lX; gtkPoints-coords[7] = (ast_double)aPointPxlHD.lY; gtkGfxItem = gnome_canvas_item_new ( gtkRoot, gnome_canvas_polygon_get_type(), points,gtkPoints, fill_color_rgba, 0xAFCAE980, outline_color_rgba, 0xAFCAE9FF, width_pixels, TAGR_LINE_WIDTH, NULL ); And to change the color : gnome_canvas_item_set ( gtkGfxItem, fill_color_rgba,iFillColor, outline_color_rgba, iOutlineColor, NULL ); /* With iFillColor and iOutlineColor two gint32 numbers representing the selection color */ After a few selection (about 1à different ones) we're getting a segmentation fault when executing the change color `gnome_canvas_item_set' NB: If I change the item for another form (rectangular or ellipse have been tryed) there is no problem! Why we are not changing to those items is because it will not represent anymore what it should be, we need to use polygons. Best regards, --- Jean-Christophe Berthon ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: SegFault with GnomeCanvas (Polygon)
1) how big are your polygons? 2) which version of libart? 3) do you know how to use gdb? reporting a segmentation fault is not particularly useful by itself. either use gdb to get a backtrace so you can see precisely what goes wrong, and/or produce a little test case on the order of 100 lines or so. Hy Paul, First thank you for your reply :-) 1) Do you mean if they are pentagons, hexagons, or bigger? In fact I'm displaying quadrilatere (4 sides polygons), I cannot use rectangle are I don't have always a rectangular angle and it can be looking sometimes a bit trapezoid or parallelogram-ish... They are about a 100 pixels wide for 50 heigth. 2) I'm using libart_lgpl 2.2.0 -- Gtk 1.2.10 -- Gnome 1.2.13 3) I don't have debug feature for Gtk/GNOME so the only thing I know is that I'm getting seg-fault (and no core dump) on the call of gnome_canvas_item_set. I can make a little test case and send it to the list once it is done (later in the afternoon or maybe tomorrow...) Once again, thank you :-)) Jean-Christophe ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: SegFault with GnomeCanvas (Polygon)
Hello Iain, Thank you for your reply, I did what you proposed and got the following trace on the shell : (gdb) r Starting program: /home/spatio/V1/dev/bin/spatio [New Thread 1024 (LWP 31938)] Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 1024 (LWP 31938)] 0x4030b365 in art_uta_add_line () from /usr/lib/libart_lgpl.so.2 (gdb) bt #0 0x4030b365 in art_uta_add_line () from /usr/lib/libart_lgpl.so.2 #1 0x in ?? () Seems that it is a libart problem then? Shall I send my post to the libart mailing list? (is there existing one?) After looking on internet, I found a newer version than mine, I'll try to check if it solves the problem! Thank you for your help, Best regards, --- Jean-Christophe Berthon - Original Message - From: iain [EMAIL PROTECTED] To: Jean-Christophe Berthon [EMAIL PROTECTED] Cc: Gtk List [EMAIL PROTECTED] Sent: Monday, March 25, 2002 3:45 PM Subject: Re: SegFault with GnomeCanvas (Polygon) 3) I don't have debug feature for Gtk/GNOME so the only thing I know is that I'm getting seg-fault (and no core dump) on the call of gnome_canvas_item_set. I can make a little test case and send it to the list once it is done (later in the afternoon or maybe tomorrow...) Run gdb program-name then type r to run the program, make it segfault and type bt to see exactly where it crashed. iain -- Everybody thinks of changing humanity and nobody thinks of changing himself - Leo Tolstoy. ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Keeping focus of a TextBox (GtkEntry) (one more try)
Hello, I didn't get any answer to my problem, maybe I'm not clear enough. I just want to know how to keep the mouse focus in a GtkEntry widget, so when the mouse move outside the border of the GtkEntry, it still has the focus (so it can receive user keyboard input) Thank you for any help or tips :-) PS: below is the original email send to this list last Wednesday. Hello, I'm using a GtkEntry (editable) in a widget. I have a custom widget that on certain events shows up a textbox where the user can type some information. Inside my widget, I'm packing the GtkEntry using the foloowing code : gtk_container_add(GTK_CONTAINER(MyWidget-window), GTK_WIDGET(MyEditableBox)); My problem is that the user can only type in the textbox if the Mouse pointer is within the border of this object. When the Mouse moves away, the focus is lost (eventhough I've tried the function gtk_widget_grab_focus)! What am I doing wrong? Thanks for any help that you can provide :-) Best regards, --- Jean-Christophe Berthon ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Checkbox and Style
Hello, I have another problem which is how to change the state of a checkbox to Partially Checked. Explanation: The user select a column. Each data in this column can be TRUE or FALSE. So if a column contain only TRUE rows, then a checkbox should be Checked, if it contains only FALSE then it should be Unchecked and finally if there is a mix of TRUE and FALSE the checkbox should be Partialy Checked. I've seen that behaviour under a few application, where when it was checked, there was a black V drawn on the button of the checkbox, when unchecked the V was cleared, and when partially cheked, the V was grey-ish. I've tryed using the fg fields of the Style of the checkbox, but it had no effect! It seems that Gtk is using a picture to draw the checkbox. How can I do it? Thank you for any help, Best regards, --- Jean-Christophe Berthon ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Checkbox and Style
Thank you Havoc for your help, So there is no way to do it under gtk-1.2.10? My application link to this version of gtk for now, and we are not planning to move to 2.0 in the comming month but later in the year. Is there any solution or shall I just wait to move to the next version for having this feature? Best regards, --- Jean-Christophe Berthon - Original Message - From: Havoc Pennington [EMAIL PROTECTED] To: Jean-Christophe Berthon [EMAIL PROTECTED] Cc: Gtk List [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, March 11, 2002 5:00 PM Subject: Re: Checkbox and Style Jean-Christophe Berthon [EMAIL PROTECTED] writes: I have another problem which is how to change the state of a checkbox to Partially Checked. GTK 2 has this feature, gtk_toggle_button_set_inconsistent() or something like that is the function name. Havoc ___ gtk-app-devel-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Problem compiling GTK program (scrollkeeper not exists)
Hy, I don't know what is the exact use of this library but I needed it already to compile and install Glade. You can find the package file at : http://scrollkeeper.sourceforge.net/ Best regards, --- Jean-Christophe Berthon - Original Message - From: Flávio Alberto Lopes Soares [EMAIL PROTECTED] To: gtk-list [EMAIL PROTECTED] Sent: Monday, March 11, 2002 12:43 PM Subject: Problem compiling GTK program (scrollkeeper not exists) Hello all, I installed the Debian 2.2r5 in my system in the place of Conectiva 7.0 (Red Hat like), I attempt to compile a program that I made in GTK (interface made by Glade) but when I run ./configure this says that hasn't installed scrollkeeper and the Makefile doesn't generated, what package is this program ? Thanks a lot Flavio Alberto ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Retrieving data from a GtkList
Hello, I'm not using the GtkList but the GtkCList, maybe there are similar function. Here is anyway the function I'm using for it (N.B.: I'm looking for all the selected fields as my CList can handle multiple selection): GList *pxGList= NULL; ast_shortsLoop; /* Get the list of all the selected row out of the CList */ pxGList = GTK_CLIST(lstMyList)-selection; pxGList = g_list_first(pxGList); sLoop = 0; while (pxGList != NULL) { /* The arguments are CList, Row, Column, String |I guess you don't need the column argument */ gtk_clist_get_text(GTK_CLIST(lstMyList), GPOINTER_TO_INT(pxGList-data), 0, pcMyString); pxGList = g_list_next(pxGList); sLoop++; } Best regards, --- Jean-Christophe Berthon Cap Gemini -- Ernst Young France Skill IS -- Image Quality Email: [EMAIL PROTECTED] Tel: (+33) 561 31 6671 - Original Message - From: Ramon Alberto Triay Espinosa [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, March 03, 2002 6:11 PM Subject: Retrieving data from a GtkList Hi... This time i found myself looking for a function to retrieve the text of a selected item i'm displaying in a GtkList but found none. Do i have to keep my string values (or any data i want to retrieve from the list) in a separate GList and then mark them with the same index used in the gtk_list_select_item function? I usually do stuff like that in Visual Basic since the MS bound controls are very unstable. SALUDOS!!! rtriay :) ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: problem while configuring
Hello, Maybe I can help you, but I'm really new to the worl of automake and autoconf. But I had this problem with the automake I build when porting the package under another system : I build my package under Linux and was testing it under Solaris. As I didn't know what was the file config.guess and ltconfig (that's the files which are used to guess the host type, so your problem), I just run in this problem. So to fixed it, I would advise you to copy the 'ltmain.sh', 'ltconfig', 'config.guess' and 'config.sub'files, that you can found in /usr/share/libtool (or maybe /usr/local/share/libtool depending on where you installed libtool), in the installation directory of gtk and to run again ./configure. For me it solved the problem... Sorry for my english, if I'm not clear enough write me back, I'll try to make myself more understandable Best regards,---Jean-Christophe Berthon Cap Gemini -- Ernst YoungFranceSkill IS -- Image QualityEmail: [EMAIL PROTECTED]Tel: (+33) 561 31 6671 - Original Message - From: Javed To: [EMAIL PROTECTED] Sent: Monday, February 18, 2002 9:58 AM Subject: problem while configuring hi, I'm unable to configure the gtk+1.2.0 as it gives an error saying: checking host system type...configure:error:cannot guess host type;you must specify one How can I solve this problem? thanks, Javed
Re: Please help me with a widget for multi columned data entry.
Title: RE: Please help me with a widget for multi columned data entry. You should then have a look at GtkExtra --http://gtkextra.sourceforge.net (if I'm correct) Best regards,---Jean-Christophe Berthon Cap Gemini -- Ernst YoungFranceSkill IS -- Image QualityEmail: [EMAIL PROTECTED]Tel: (+33) 561 31 6671 - Original Message - From: zze-coframi balr001 To: 'Dino Cherian K' ; zze-coframi balr001 Cc: [EMAIL PROTECTED] Sent: Wednesday, January 30, 2002 11:44 AM Subject: RE: Please help me with a widget for multi columned data entry. Yes you are right but in GTK I don't think it'spossible to have a clist with one column with editable field and another with label. -Message d'origine- De : Dino Cherian K [mailto:[EMAIL PROTECTED]] Envoye : mercredi 30 janvier 2002 17:05 A : zze-coframi balr001 Cc : [EMAIL PROTECTED] Objet : Re: Please help me with a widget for multi columned data entry. Hi But I think, the GtkTable is only a container widget, so that we can place widgets in it. Really can we use it for the tabular data entry purpose. Thanks Dino zze-coframi balr001 wrote: Hello, try to use GtkTable. Isabelle -Message d'origine- De : Dino Cherian K [mailto:[EMAIL PROTECTED]] Envoye : mercredi 30 janvier 2002 16:01 A : [EMAIL PROTECTED] Objet : Please help me with a widget for multi columned data entry. Hi all, Anybody please help me with a widget for multi columned data entry. I want to make data entry in a columned fashion so that the user can visually enter the tabular data. I mean the one that can be done with a spread sheet. Thanks Dino _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com
CList column auto-resize (on demand)
Hello, I would like to "auto-resize" the column on demand. I'll be using a combination of gtk_clist_optimal_column_width (to get the width of my column) and gtk_clist_set_column_width (to set it). I want to have this feature working like on most spreadshits : double-clicking on the line separating 2 columns will auto-resize the left column. I didn't find any relevant signal to bind this feature to. I've looked in the gtk_clist.c source file and it seems that they are using internal properties of the clist to do the job and binding the signal button_press. In the source they do something like that : in the button_press callback /* This code is extract from gtkclist.c of the Gtk+ 1.2.10 source code */ /* It is extract from the handler of the button_press event for (i = 0; i clist-columns; i++) if (clist-column[i].resizeable clist-column[i].window event-window == clist-column[i].window) So they are testing for each column if it is resizeable AND if it has its own gdk_window set AND if the gdk_window involved in the event is the same as the column one. I can do the same test on a customized button_press event callback that I will attached to my clist widget instance, and do the trick. But I find it unsafe because I'm using internal data. Do you know of any better way? I hope I've been clear enough. I'm sorry for my english and if you don't understand you can always ask me to say it again differently :-)Thank you in advance for any help,Best regards,---Jean-Christophe Berthon
Re: how to set a button's background?
how to set a button's background?Hello, I'm using this method to paint the background of a CList cell in a different color, maybe you can apply that to your case : GdkColor xColor; GdkColormap *pxColorMap; /* Get the colormap from the GtkCList object */ pxColorMap = gtk_widget_get_colormap(GTK_WIDGET(lstGtkCList_E)); /* Create a new color : Red-Orange-ish */ xColor.red = 61696; xColor.green = 52736; xColor.blue = 45312; /* Alloc the new color to the colormap */ gdk_colormap_alloc_color(pxColorMap, xColor, FALSE, TRUE); /* Set back the colormap to my GtkCList object */ gtk_widget_set_colormap(GTK_WIDGET(lstGtkCList_E), pxColorMap); /* Get a copy of a default style and customize it */ pxUndetStyle = gtk_style_copy(gtk_widget_get_default_style()); pxUndetStyle-base[GTK_STATE_NORMAL] = xColor; pxUndetStyle-base[GTK_STATE_ACTIVE] = xColor; pxUndetStyle-base[GTK_STATE_PRELIGHT] = xColor; pxUndetStyle-base[GTK_STATE_SELECTED] = xColor; pxUndetStyle-base[GTK_STATE_INSENSITIVE] = xColor; gtk_style_ref(pxUndetStyle); /* Apply this style to the cell */ gtk_clist_set_cell_style(lstGtkCList_E, i, j, pxUndetStyle); /* But you can use for your case : gtk_widget_set_style(GTK_WIDGET(Your_GtkButton_Object), pxCustom_Style); */ Best regards, --- Jean-Christophe Berthon Cap Gemini -- Ernst Young France Skill IS -- Image Quality Email: [EMAIL PROTECTED] Tel: (+33) 561 31 6671 - Original Message - From: ¶À¼y Kason Huang To: [EMAIL PROTECTED] Sent: Monday, January 21, 2002 6:44 AM Subject: how to set a button's background? hello,hi: could anyone tell me how to set a button's background? when the button get focus(with updown key in the keyboard),how to let the button's background being red or other color? ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: why that not working?
Hello :-) This is not working because cyan means that you give the address of the variable cyan which then should be declare somewhere. gdk_windows_set_background require as a second argument a pointer to a GdkColor structure. To allocate this structure you need to declare a GdkColor object. You can do that : GdkColorxMyCyanColor; Now to fill up this structure you can use to ways. Or you set the red, green and blue color manually (take care each of this three properties as a value from 0 to ~65535) like in the example I send before or you use a string like cyan or red with this function : if (gdk_color_parse(cyan, xMyCyanColor)) { /* The color is created (enough system ressource) */ /* So now you have to allocate it to the colormap in order to use it */ gdk_colormap_alloc_color(pxColorMap, xMyCyanColor, FALSE, TRUE); /* See my previous email on how to get a colormap */ } else { /* Error not enough system ressource... (well I guess that's the reason or the color doesn't exist, for example you put hello for the color ;-) */ } I hope, I'm clear enough. If you need other help, just ask me :-) PS: btw I'm not sure if you then need to free the color. I just saw that there is a gdk_color_free function in the API. Maybe someone-else can help us about that! Best regards, --- Jean-Christophe Berthon Cap Gemini -- Ernst Young France Skill IS -- Image Quality Email: [EMAIL PROTECTED] Tel: (+33) 561 31 6671 - Original Message - From: ¶À¼y Kason Huang [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, January 21, 2002 9:44 AM Subject: why that not working? hello: for creating a colorful button,I do a testing code,however,that not working? why and how to do?anyone could help me? #includegtk/gtk.h #includegdk/gdkx.h GdkColor cyan = {0,0x,0x,0x}; int main(int argc,char *argv[]) { GtkWidget *window; GttkWidget *button1; GtkWidget *button2; GtkWidget *vbox; gtk_init(argc,argv); window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_signal_connect(GTK_OBJECT(window),destroy,GTK_SIGNAL_FUNC(gtk_exit),NU LL); vbox = gtk_vbox_new(TRUE,2); gtk_container_add(GTK_CONTAINER(window),vbox); button1= gtk_button_new_with_label(1); gtk_widget_realize(button1); gdk_window_set_background(button1-window,cyan); //not working,why? gtk_box_pack_start(GTK_BOX(vbox),button1,TRUE,FALSE,0); button2= gtk_button_new_with_label(2); gtk_widget_realize(button2); gdk_window_set_background(button2-window,cyan); //not working,why? gtk_box_pack_start(GTK_BOX(vbox),button2,TRUE,FALSE,0); gtk_widget_show(button1); gtk_widget_show(button2); gtk_widget_show(vbox); gtk_widget_show(window); gtk_main(); return 1; } Thank you in advance! waiting for your mail back. you can get me by mail : [EMAIL PROTECTED] kason ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: A problem about programming with gtk+ in multiprocess.
Hy, Is it possible so to free the memory of the child process of any Gtk library? Has the memory is duplicate, this can be rather interesting to save a bit of it... Thanks, Best regards, --- Jean-Christophe Berthon - Original Message - From: Paul Davis [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Sunday, December 16, 2001 5:45 PM Subject: Re: A problem about programming with gtk+ in multiprocess. hello all, I have a problem when programming with gtk+ in multiprocess. please look follow codes : what is is that has made some people think that this fork, then have the parent and the child continue to use GTK+ will work? you cannot do this (reliably). X Window is inherently multithread safe, and since the child and parent both share the same connection to X server, using fork() rather than pthread_create() is just a detail that doesn't really change what is going on: two contexts of execution making parallel, unsynchronized requests to the X server on the same connection. we need to make it more clear that after fork(2), the child should never access GTK structures or functions unless the parent never does so again. can we add something to the FAQ about this? --p ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: A problem about programming with gtk+ in multiprocess.
Hello Rusty Thanks for your reply :-) but I have a question So in the case the child is doing computation while the father show progress information and allow the user to stop the computation. I'm modifying the memory of Gtk -- updating the value of progress bar and some labels and status bar. Then is the memory duplicated? If yes, how can I remove it fom the child, else (if no) then it is OK :-) Thanks, Best regards, --- Jean-Christophe Berthon - Original Message - From: Rusty Conover [EMAIL PROTECTED] To: Jean-Christophe Berthon [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Monday, December 17, 2001 10:39 AM Subject: Re: A problem about programming with gtk+ in multiprocess. Hi Jean-Christophe, Freeing memory in the child process is not normally necessary since most kernels (including Linux) employ the copy on write policy for the child process address spaces. This means that the memory actually isn't copied from parent to child unless either process makes changes to the memory, otherwise the child just reads directly from the parent process. Hope that helps, Rusty ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: question on clist
I'm using a private field of the structure CList : lstCList-rows but I guess in the futur there will be a clean way to do it :-) Best regards, --- Jean-Christophe Berthon Cap Gemini -- Ernst Young France Skill IS -- Image Quality Email: [EMAIL PROTECTED] Tel: (+33) 561 31 6639 - Original Message - From: Jyothi [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, November 28, 2001 7:46 AM Subject: question on clist Hi, How can I get the number of items on GtkCList ???... I want to disconnect a signal when the number of rows on the GtkClist reaches 10. So is there any function which can return the number of rows in GtkClist ?? Thanks in Advance, Jyothi. ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Changing the background color of a Label
Hello, I'm imagining simply a label with a background color (usually Grey) and a foreground color (the color of the writing usually black). But I want to change this! I've managed to change the foreground color to white but didn't manage to change the background to green using GtkStyle under Gtk-1.2. Any help would be greatly appreciate :-) Here is the code I'm using : void on_smnuAbout_activate (GtkMenuItem *menuitem, ast_pointer user_data) { GtkWidget*wndAbout= NULL; GtkWidget*ABOUT_lblNameVersion = NULL; GdkColor CouleurTitreFond; GdkColor CouleurTitrePolice; GdkColormap*ColorMap= NULL; GtkStyle*gtkTitleStyle = NULL; /* Creation of the About window (Glade generated function) */ wndAbout = create_wndAbout(); ABOUT_lblNameVersion = lookup_widget(wndAbout, ABOUT_lblNameVersion); /* Retrieve the colormap of the widget to alloc new color to it */ ColorMap = gtk_widget_get_colormap(ABOUT_lblNameVersion); /* Make a green color */ CouleurTitreFond.red = 29184; CouleurTitreFond.green = 41984; CouleurTitreFond.blue = 33536; gdk_colormap_alloc_color(ColorMap, CouleurTitreFond, FALSE, TRUE); gdk_color_parse(white, CouleurTitrePolice); gdk_colormap_alloc_color(ColorMap, CouleurTitrePolice, FALSE, TRUE); /* I don't know if this is needed, but in case... */ gtk_widget_set_colormap(ABOUT_lblNameVersion, ColorMap); gtkTitleStyle = gtk_style_copy(ABOUT_lblNameVersion-style); gtkTitleStyle-bg[GTK_STATE_NORMAL] = CouleurTitreFond; gtkTitleStyle-bg[GTK_STATE_ACTIVE] = CouleurTitreFond; gtkTitleStyle-bg[GTK_STATE_PRELIGHT] = CouleurTitreFond; gtkTitleStyle-bg[GTK_STATE_SELECTED] = CouleurTitreFond; gtkTitleStyle-bg[GTK_STATE_INSENSITIVE] = CouleurTitreFond; gtkTitleStyle-fg[GTK_STATE_NORMAL] = CouleurTitrePolice; gtkTitleStyle-fg[GTK_STATE_ACTIVE] = CouleurTitrePolice; gtkTitleStyle-fg[GTK_STATE_PRELIGHT] = CouleurTitrePolice; gtkTitleStyle-fg[GTK_STATE_SELECTED] = CouleurTitrePolice; gtkTitleStyle-fg[GTK_STATE_INSENSITIVE] = CouleurTitrePolice; gtk_widget_set_style(ABOUT_lblNameVersion, gtkTitleStyle); gtk_style_unref(gtkTitleStyle); gtk_widget_show_all(wndAbout); } Best regards, --- Jean-Christophe Berthon Cap Gemini -- Ernst Young France Skill IS -- Image Quality Email: [EMAIL PROTECTED] Tel: (+33) 561 31 6639 ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Changing the background color of a Label
Hi, This sort of question should not go to gtk-devel-list, only gtk-list. oops sorry I wanted to send it to gtk-app-devel-list, I've typed it too fast... http://pobox.com/~hp/gtk-colors.html has the answer in there. Havoc Yep but my problem was that when I'm applying this code the background color of the label didn't changed. As Skip pointed me, the GtkLabel take the background color form its parent (or some similar stuff) and in fact it is documented for that part in the FAQ. Anyway, I'm using the GtkStyle instead of the GtkRcStyle 'cause I didn't manage to get it working on my example (modifying background color, writing color and font) Only the writing color (using FG) did work. Here is the GtkRcStyle code I've tryed, if somebody can tell me what's wrong? (I have the code working properly using GtkStyle but I've read that it is not the clean way...) /** Modify background color Version label **/ /* After filling in your GdkColor, create a GtkRcStyle */ rc_style = gtk_rc_style_new(); /* Set background (bg) color in normal state to CouleurTitreFond */ rc_style-bg[GTK_STATE_NORMAL] = CouleurTitreFond; /* Indicate which colors the GtkRcStyle will affect; * unflagged colors will follow the theme */ rc_style-color_flags[GTK_STATE_NORMAL] |= GTK_RC_BG; gtk_widget_modify_style(gtkLabelContainer, rc_style); gtk_rc_style_unref(rc_style); /** Modify writing color and Font Version label **/ rc_style = gtk_rc_style_new(); rc_style-fg[GTK_STATE_NORMAL] = CouleurTitrePolice; rc_style-color_flags[GTK_STATE_NORMAL] |= GTK_RC_FG; rc_style-font_name = g_strdup(%s, -*-arial-medium-i-*-*-*-200-*-*-P-*-iso8859-1); /* rc_style-font_name = Arial; */ gtk_widget_modify_style(ABOUT_lblNameVersion, rc_style); gtk_rc_style_unref(rc_style); ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Changing the background color of a Label
also, please don't set colors in source code. use an RC file so that users can change them as they wish using a standard mechanism. there is information on how to do this in the GTK+ FAQ. Yes I think it is good, but my purpose was to use this colors only in my About box to look like Gnome standard about boxes. I was thinking that to have it hard-coded was a good way. Of course for other window of the GUI, I would not do it this way... Thank you all of you for your help :-))) Jean-Christophe ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Changing the background color of a Label
Jean-Christophe Berthon [EMAIL PROTECTED] writes: rc_style-font_name = g_strdup(%s, -*-arial-medium-i-*-*-*-200-*-*-P-*-iso8859-1); You don't need the %s there (this shouldn't compile...) Havoc Yep you right, it's because of a too quick copy and paste, in fact I'm not using directly g_strdup but a macro which is using g_strdup_printf and in this case I need to put %s (if not I get a warning) but if I would use g_strdup, I would removed it. Sorry for the mistake :-) But I guess there shoud be another mistakes in my code. Here thanks to your last reply to : Subject: Re: gtk_widget_modify_style causes App to crash You probably need: g_free (rcstyle-font_name); rcstyle-font_name = g_strdup (Font_Selected); Havoc I manage changing the font style :-) So now I have my code using RC Style almost working, but I can't get the background of the label or it's container to be changed... /** Modify background -- KO **/ rc_style = gtk_rc_style_new(); rc_style-bg[GTK_STATE_NORMAL] = CouleurTitreFond; rc_style-color_flags[GTK_STATE_NORMAL] |= GTK_RC_BG; /* gtkLabelContainer is a EventBox containing the label named ABOUT_lblNameVersion (see below how it is modified) */ gtk_widget_modify_style(gtkLabelContainer, rc_style); gtk_rc_style_unref(rc_style); /** Modify writing color and Font Version label -- OK **/ rc_style = gtk_rc_style_new(); rc_style-fg[GTK_STATE_NORMAL] = CouleurTitrePolice; rc_style-color_flags[GTK_STATE_NORMAL] |= GTK_RC_FG; g_free(rc_style-font_name); rc_style-font_name = g_strdup(-*-arial-medium-i-*-*-*-200-*-*-P-*-iso8859-1); gtk_widget_modify_style(ABOUT_lblNameVersion, rc_style); gtk_rc_style_unref(rc_style); Jean-Christophe ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Borderless window
Some while ago this question has been post and the answer was : gdk_window_set_decorations(GTK_WIDGET(MyWidget_Window)-window, 0); Best regards, --- Jean-Christophe Berthon Cap Gemini -- Ernst Young France Skill IS -- Image Quality Email: [EMAIL PROTECTED] Tel: (+33) 561 31 6639 - Original Message - From: Dinesh Nadarajah [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, November 14, 2001 6:51 AM Subject: Borderless window Hi: How can I create a borderless window (without any of the decorations, any window manager buttons, etc)? Thanks. -D _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Gtk Window
You have to set your window _Modal_ to block access of other window. But to stop the execution of the code, I don't know if there is a Gtk implementation of it. I'm doing this solution. I have a boolean that is initialized to TRUE when I'm showing the modal window and then I have the folowing code : while ((gtk_events_pending()) || (bDlgInfoState_X == TRUE)){gtk_main_iteration();} This loop process the gtk-event, so the modal window respond to user interaction. And as soon as the modal window is hidden, bDlgInfoState_X is set to False, so I'm exiting this loop. Hope this help :-) Best regards,---Jean-Christophe Berthon Cap Gemini -- Ernst YoungFranceSkill IS -- Image QualityEmail: [EMAIL PROTECTED]Tel: (+33) 561 31 6639 - Original Message - From: haojl To: [EMAIL PROTECTED] Sent: Wednesday, November 14, 2001 9:05 AM Subject: Gtk Window how to create a window that i can't access other window , if i don't close the window , and when the code of gtk_widget_show(window) is execute , next code not continue execute if the window don't close (not destroy , hide the window)
Re: Borderless window
Hi: just do GtkWidget *win; win=gtk_window_new(GTK_WINDOW_POPUP); With this solution depending of the window manager you don't get a border-less window but you usualy get a less decorate window. To really get ride of the border use what I told in my previous email. ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Problem with DrawingArea, Rulers and ViewPort
Good day, I would like to do a kind of graphical application with a DrawingArea, rulers and scrollbar. And I'm stuck with the management of the rulers and the scrollbar together. What I need is a DrawingArea which is scrollable and the rulers which should be all the time visible. What I made is a scrollable drawing area and a moving ruler (see picture). I've looked at the Tutorial and other ressources on Internet but didn't find any answer on how to do a correct job. I want the ruler to be the size of the DrawingArea and that when I'm scrolling the drawing and the DrawingArea and the rulers are scrolling so other hidden part are shown. Like under Gimp. Any help would be greatly appreciate :-)) Best regards, --- Jean-Christophe Berthon Cap Gemini -- Ernst Young France Skill IS -- Image Quality Email: [EMAIL PROTECTED] Tel: (+33) 561 31 6639 drawing_area_example.png Description: Binary data
Looking 4 a Matrix Widget with Multi-Selection
Hello, I need a Matrix Widget with the following features : - being able to select multiple-cells (not necesserily contiguous - meaning that they can be spread and not in one block) - displaying Titles menu for each column - displaying at least numbers (or char*) in each cells. I've tryed the : - GtkCList - the problem is that we select rows and not cells. (but the extended selection is perfect) - GtkSheet (GtkExtra) - the problem is that we can only select contiguous cells. (my need is : select a few cells in a column (eg: in column 0, selecting cells of row 2, 7 and 12), right click and popup a menu. Applying an algorithme to the selected cells only) Do you know a widget which can do the job or if it would be easy to modify one of those 2 to behave like I would like. Thank you for any help you can provide me :-) Best regards, --- Jean-Christophe Berthon Cap Gemini -- Ernst Young France Skill IS -- Image Quality Email: [EMAIL PROTECTED] Tel: (+33) 561 31 6639 ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Fw: g_log () Non fatal warning
I also did a simple wrapper that encapsulate malloc and do kind of trace, but I would rather use g_malloc instead of malloc and use the maybe better memory check of the glib. Anyway if I can't change it, art least I know, thank you :-) I'll try to improve my own memchecker so. Thanks a lot :-) Hi Jean-Christophe, Unfortunately I don't think this is possible. You can use g_log_set_fatal_mask() to say which sorts of errors are fatal, but G_LOG_LEVEL_ERROR is always set fatal whatever you do. I think this was decided because for a GUI library, it's very hard to recover reliably from out-of-mem errors. If you use glib for something else, of course, this may not be the right decision. I have an image processing library which uses glib ... but I had to make my own malloc() wrapper, as I needed to be able to recover from out-of-mem errors. John Jean-Christophe Berthon wrote: Another post that I hope you're not going to buried neither... I still don't really understand how not to make fatal warning with the GLib... Please help! Hello, I would like to know if anybody knows how to use g_log () to set it to non fatal warning (if a g_malloc fail, the application stop, I would rather get a returned error and deal with that). ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Fw: Another asks about the CList EXTENDED selection
I think the tutorial is wrong (or misleading?) here. Whatever selection mode, you can always look at clist-seletion and get a list of selected row numbers. If you look at textgtk.c and search for clist_remove_selection(), you'll see that's just what they do. John I was a bit skeptical because when i read the textgtk.c file there was a piece of code just for managing the EXTENDED mode, so anyway I've tryed it and it worked out perfectly :-) So you right in EXTENDED mode the selection propertie of the struct GtkCList is filled up! The documentation might be wrong or misleading! Thanks a lot for your great help :-))) Jean-Christophe ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Fw: g_log () Non fatal warning
you might consider using glib-1.3.x which allows you to plug your own memory handling system into glib and use it through g_malloc() and friends. glib-1.3.x also has g_try_malloc(). That's look interesting but I'll wait for glib-1.3 to be released stable (in a futur 1.4 or 2.0 version) to implement it. Thanks for the tip, I'll think of it when porting my actual version. Jean-Christophe ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Fw: Another asks about the CList EXTENDED selection
As I didn't have any answer about this question, I'm reposting it in case somebody can help me... Hy all, Sorry to ask again a question about that topic but I didn't find a satisfying answer. I want to use the EXTENDED selection mode of the CList to allow the user to select multiple row using primarirly the control and shift key. Once the selection is done, the user can popup a menu to export this selection and then I need a way to know what this selection was! The problem is that in the documentation it is precise that the field selection of the CList is set to NULL in this selection mode. How should I do that then? Best regards, --- Jean-Christophe Berthon ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Fw: g_log () Non fatal warning
Another post that I hope you're not going to buried neither... I still don't really understand how not to make fatal warning with the GLib... Please help! Hello, I would like to know if anybody knows how to use g_log () to set it to non fatal warning (if a g_malloc fail, the application stop, I would rather get a returned error and deal with that). Best regards, --- Jean-Christophe Berthon Cap Gemini -- Ernst Young France Skill IS -- Image Quality Email: [EMAIL PROTECTED] Tel: (+33) 561 31 6639 ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Fw: Another asks about the CList EXTENDED selection
I want to use the EXTENDED selection mode of the CList to allow the user to select multiple row using primarirly the control and shift key... The problem is that in the documentation it is precise that the field selection of the CList is set to NULL in this selection mode. How should I do that then? Won't MULTIPLE selection mode work? (I have no experience with CList, but MULTIPLE works fine with the new TreeView stuff.) Yes MULTIPLE selection work, I'm using that one now, but I find it not as friendly as a extended selection. I rather prefer when I select one line to have all the others unselect. And it is convenient to use the shift key to select a bunch of lines. I could maybe upgrade myself the MULTIPLE selection to do that kind of job but I would rather get the point on how to use the EXTENDED mode. Anyway thanks for your answer :-) Jean-Christophe ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
g_log () Non fatal warning
Hello, I would like to know if anybody knows how to use g_log () to set it to non fatal warning (if a g_malloc fail, the application stop, I would rather get a returned error and deal with that). Best regards, --- Jean-Christophe Berthon Cap Gemini -- Ernst Young France Skill IS -- Image Quality Email: [EMAIL PROTECTED] Tel: (+33) 561 31 6639 ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Another asks about the CList EXTENDED selection
Hy all, Sorry to ask again a question about that topic but I didn't find a satisfying answer. I want to use the EXTENDED selection mode of the CList to allow the user to select multiple row using primarirly the control and shift key. Once the selection is done, the user can popup a menu to export this selection and then I need a way to know what this selection was! The problem is that is the documentation it is precise that the field selection of the CList is set to NULL in this selection mode. How should I do that then? Best regards, --- Jean-Christophe Berthon ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: gtk_object_unref
Jean-Christophe Berthon [EMAIL PROTECTED] writes: (I've read some older threads about it - like the one about the container - but in my case my objects and points are drawings on a gtk-canvas and I want to ref and unref some of the GtkCanvasItem that are shared...) I hope I've been clear enough, if you need more explanation, tell me what you didn't understand and I will try to say it differently. Say you create the canvas item to give it to object A - do you also reference it? first thank you all for your answers. Yes you right I didn't reference it. If not, then you are assuming ownership of the floating reference, which isn't allowed. The canvas will then strip the floating reference off the item when you add the item to the canvas; and object A will end up not owning any reference at all. If you do this: obj = whatever_gtk_object_new (); Then the immediate situation is that obj has one floating reference, and zero owned references. To remove the floating reference, do this: gtk_object_sink (obj); That will finalize the object if it hasn't already been finalized. What the canvas does is this: gtk_object_ref (obj); gtk_object_sink (obj); So then obj has one reference owned by the canvas, and zero floating references. Anyhow, short answer, you need another gtk_object_ref(), rather than taking ownership of the floating reference. No one can ever own the floating reference; if you want to call unref on a GtkObject, you must first call ref; there are no exceptions, even if you created the object yourself. OK. I didn't really understand everything (esp. about the floating reference, I don't exactly what this thing mean or is...). But I've tryed to add to my code a gtk_object_sink just after the creation of the canvas item. Then I've tryed to add instead gtk_object_ref and gtk_object_sink. And finally I've tryed gtk_object_ref only instead of the previous two commands. But in all this case I got the warnings. But I want to precise one thing. The unref operation occur in a callback of the canvas item. So one of them receive an action from the user and I have to unref this item and a second one (passed with the void* of the callback). The item that fired the event has a ref_count of 3 (instead I would expect 1) while the other one has a ref_count of 1 (which should be normal). I'm applying the unref to both of them, so after the unref execute there ref_count decremente of 1 (so respectively to 2 and 0). I'm getting a warning only on the second item but both are destroyed!!! (I guess this job is done when leaving the callback as at this moment I receive a second warning (again about this ref_count).) If you need I can send a extract of my code with all the involved parts. Again thanks all for your help, Have a nice day (or night)... Best regards, Jean-Christophe ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: About gtk_clist_set_row_data
Thank you Mohamed and Jim for your answers. Well I didn't find that much info in the FAQ neither in the tutorial (they say the prototype of the function should speak by itself... well not for me!) I was interested to see if I could post a structure with any kind of data via this function. So after your answer, I've try on one of my GUI which contain a CList (with 11 columns) to set up a structure and send it via gtk_clist_set_row_data. It didn't succeed. I had about 10 fields with int and one with char [] but nothing appear. Here is a sample code of what I wrote : GtkWidget *lstPA_ListOfPA; Totoessai; essai.a = 1; essai.b = 2; essai.c = 3; essai.d = 4; essai.e = 5; essai.f = 6; essai.g = 7; essai.h = 8; essai.i = 9; essai.j = 0; strcpy(essai.k, hello); lstPA_ListOfPA = lookup_widget(aWindowsInfo_X.paIUPAData-wndPA, lstPA_ListOfPA); gtk_clist_freeze(GTK_CLIST(lstPA_ListOfPA)); gtk_clist_set_row_data(GTK_CLIST(lstPA_ListOfPA), 0, (gpointer)essai); gtk_clist_thaw(GTK_CLIST(lstPA_ListOfPA)); Best regards, --- Jean-Christophe Berthon Cap Gemini -- Ernst Young France Skill Integration System -- Image Quality Email: [EMAIL PROTECTED] Tel: (+33) 561 31 6639 - Original Message - From: Mohamed [EMAIL PROTECTED] To: Jean-Christophe Berthon [EMAIL PROTECTED] Sent: Monday, September 10, 2001 3:25 PM Subject: Re: About gtk_clist_set_row_data Salut Jean you can attach any type of data you want to the given row simple example : you want to attach a color name to each row : 8 static gchar *couleur[3]={vert,bleu, rouge} ; for (i=0; i3; i++) gtk_clist_set_row_data (clist, i, (gpointer) couleur[i]); -8--- or attach some kind of data like typedef struct { gint myint; gchar *mychar }SomeStruct; SomeStruct * data; gtk_clist_set_row_data (clist, i, (gpointer) data); bye On Mon, Sep 10, 2001 at 03:10:44PM +0200, Jean-Christophe Berthon wrote: Hello, I would like to know what kind of row (or data) I can give to the function gtk_clist_set_row_data? I'm explaining it better. Here is the prototype of gtk_clist_set_row_data(GtkCList* clist, int row_number, gpointer data) How do I have to format the data I'm giving to this function? Can I pass integers and floats, or is it only char*? If you have any knowledge about it, or any example, I would be glad :-) Thanks a lot in advance. Best regards, --- Jean-Christophe Berthon Cap Gemini -- Ernst Young France Skill Integration System -- Image Quality Email: [EMAIL PROTECTED] Tel: (+33) 561 31 6639 ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list -- Sevenval AG (HRB 32757) ecommerce-base-technologies D-50667 Koeln . Am Alter Markt 36-42 Fon +49 221 65007-51 www.sevenval.de [EMAIL PROTECTED] .. Mohamed Elassadi Programmierer ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: About gtk_clist_set_row_data
Yep, you're right, I've misunderstood it. Sorry for my post :-) OK now I understand it better also! It was looking to me like dark magic if it could do that job like that... Thanks a lot, Best regards, --- Jean-Christophe Berthon Cap Gemini -- Ernst Young France Skill Integration System -- Image Quality Email: [EMAIL PROTECTED] Tel: (+33) 561 31 6639 - Original Message - From: Jim Edwards [EMAIL PROTECTED] To: Jean-Christophe Berthon [EMAIL PROTECTED] Cc: Mohamed [EMAIL PROTECTED]; Gtk List [EMAIL PROTECTED] Sent: Monday, September 10, 2001 6:08 PM Subject: Re: About gtk_clist_set_row_data I think you misunderstand what happens with gtk_clist_set_row_data - it simple assigns a pointer to the clist row so that that pointer can latter be retrieved with gtk_clist_get_row_data. The data need not (and usually does not ) have anything to do with the number of columns in your clist. It sounds like what you are trying to do is set or change the text that appears on the displayed widget? try gtk_ctree_set_text Jean-Christophe Berthon wrote: Thank you Mohamed and Jim for your answers. Well I didn't find that much info in the FAQ neither in the tutorial (they say the prototype of the function should speak by itself... well not for me!) I was interested to see if I could post a structure with any kind of data via this function. So after your answer, I've try on one of my GUI which contain a CList (with 11 columns) to set up a structure and send it via gtk_clist_set_row_data. It didn't succeed. I had about 10 fields with int and one with char [] but nothing appear. Here is a sample code of what I wrote : GtkWidget *lstPA_ListOfPA; Totoessai; essai.a = 1; essai.b = 2; essai.c = 3; essai.d = 4; essai.e = 5; essai.f = 6; essai.g = 7; essai.h = 8; essai.i = 9; essai.j = 0; strcpy(essai.k, hello); lstPA_ListOfPA = lookup_widget(aWindowsInfo_X.paIUPAData-wndPA, lstPA_ListOfPA); gtk_clist_freeze(GTK_CLIST(lstPA_ListOfPA)); gtk_clist_set_row_data(GTK_CLIST(lstPA_ListOfPA), 0, (gpointer)essai); gtk_clist_thaw(GTK_CLIST(lstPA_ListOfPA)); Best regards, --- Jean-Christophe Berthon Cap Gemini -- Ernst Young France Skill Integration System -- Image Quality Email: [EMAIL PROTECTED] Tel: (+33) 561 31 6639 - Original Message - From: Mohamed [EMAIL PROTECTED] To: Jean-Christophe Berthon [EMAIL PROTECTED] Sent: Monday, September 10, 2001 3:25 PM Subject: Re: About gtk_clist_set_row_data Salut Jean you can attach any type of data you want to the given row simple example : you want to attach a color name to each row : 8 static gchar *couleur[3]={vert,bleu, rouge} ; for (i=0; i3; i++) gtk_clist_set_row_data (clist, i, (gpointer) couleur[i]); -8--- or attach some kind of data like typedef struct { gint myint; gchar *mychar }SomeStruct; SomeStruct * data; gtk_clist_set_row_data (clist, i, (gpointer) data); bye On Mon, Sep 10, 2001 at 03:10:44PM +0200, Jean-Christophe Berthon wrote: Hello, I would like to know what kind of row (or data) I can give to the function gtk_clist_set_row_data? I'm explaining it better. Here is the prototype of gtk_clist_set_row_data(GtkCList* clist, int row_number, gpointer data) How do I have to format the data I'm giving to this function? Can I pass integers and floats, or is it only char*? If you have any knowledge about it, or any example, I would be glad :-) Thanks a lot in advance. Best regards, --- Jean-Christophe Berthon Cap Gemini -- Ernst Young France Skill Integration System -- Image Quality Email: [EMAIL PROTECTED] Tel: (+33) 561 31 6639 ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list -- Sevenval AG (HRB 32757) ecommerce-base-technologies D-50667 Koeln . Am Alter Markt 36-42 Fon +49 221 65007-51 www.sevenval.de [EMAIL PROTECTED] .. Mohamed Elassadi Programmierer ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
[WIDGET] Picture Viewer
Good day, I'd like to know if there is a widget existing which allow the followings features: - display pictures (rather small at max. 300x300 pxl) - zoom in out (at least zoom 50, 100 200%. But the more the better!) - dynamic stretching like : histograms or levels, etc. If it doesn't exist, I'd like to know of a small Linux/UNIX standard tool (like xv or ee) which do a similar job. Thanks for your help. Best regards, --- Jean-Christophe Berthon Cap Gemini -- Ernst Young France Skill Integration System -- Image Quality Email: [EMAIL PROTECTED] Tel: (+33) 561 31 6639 ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: null parameter warning issue.
I would suggest that you try this : gtk_menu_popup( GTK_MENU (context_menu), (GtkWidget *)NULL, // GtkWidget *parent_menu_shell, (GtkWidget *)NULL, // GtkWidget *parent_menu_item, GTK_SIGNAL_FUNC(NULL), // not really GTK_SIGNAL_FUNC but works anyway. NULL, // gpointer data, event-button, event-time ); Best regards, --- Jean-Christophe Berthon - Original Message - From: David Robin [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, July 25, 2001 12:17 PM Subject: null parameter warning issue. hi everyone, when i use this piece of code: gtk_menu_popup( GTK_MENU (context_menu), GTK_WIDGET (NULL), // GtkWidget *parent_menu_shell, GTK_WIDGET (NULL), // GtkWidget *parent_menu_item, GTK_SIGNAL_FUNC(NULL), // not really GTK_SIGNAL_FUNC but works anyway. NULL, // gpointer data, event-button, event-time ); I get twice Gtk-WARNING **: invalid cast from (NULL) pointer to `GtkWidget' during execution. It seems to be caused by the GTK_WIDGET (NULL) parameters. I'd like to know how to get ride of those warnings, because i'd like to output data on stdout/err. David. ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Fw: How to deallocate memory?
Oespie, I've made a mistake in the email address while replying to this post, sorry for the inconvenience. Below is the email I've sent, if somebody can help me... Thanks a lot :-) Jean-Christophe - Original Message - From: Jean-Christophe Berthon [EMAIL PROTECTED] To: Havoc Pennington [EMAIL PROTECTED] Sent: Tuesday, July 24, 2001 10:41 AM Subject: Re: How to deallocate memory? Hy everyone, Sorry to only reply now to this old post, but I have a question regarding the gtk_widget_destroy feature. For each windows, I'm puting code on the delete event to check if the data of the window have been modify and in this case displaying a dialog box asking the user for saving. If he push cancel, then I return TRUE and the widget is not destroy. This is working perfectly when the user click on the cross button (to close the window). But I put a close feature in a menu, and I was trying to use the gtk_widget_destroy function. The problem is that in this case the only event fired is the unrealize one. Which cannot stop the process of destroying the widget... Is that something normal (or standard) or is it a bug? I mean (thinking logical) if I destroy a widget I would expect the destroy event to be fired! PS: Anyway I found a workaround, on the close menu callback, I'm checking if the data is modifyed prior to call gtk_widget_destroy. But I don't find it a good solution as I have code duplicated now which is not a smart thing to do... And so I would prefer to find out why the behaviour of the gtk_widget_destroy is like that. Best regards, --- Jean-Christophe Berthon Cap Gemini -- Ernst Young Toulouse FR Skill Aerospace -- Image Quality - Original Message - From: Havoc Pennington [EMAIL PROTECTED] To: Esteban Quijano Vincenzi [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Friday, July 13, 2001 7:44 PM Subject: Re: How to deallocate memory? Esteban Quijano Vincenzi [EMAIL PROTECTED] writes: Is it possible to free the memory allocated for a widget using gtk_widget_destroy(). However, when I try to free a window or a button with gtk_widget_destroy(GTK_WIDGET(widget)) I have a run-time error saying that it is not a widget. A bug in your program. Maybe you are freeing things twice and the second time you have junk memory instead of a widget. Havoc ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: GtkList number of items? gtk_object_set_data (GList)?
Well I just get into the same problem... (see one of my post, still waiting moderator approval) In fact with a GtkCList there is noway (official) to get the number of items or rows (well at least it is well kept in the other case...) So one bad way to get it is that : GtkWidget*clist; guintiNbItems; iNbItems = GTK_CLIST(clist)-rows; But I would advise you to encapsulate it (to make a function or macro doing this job)! So if you use it in many points in your code and in the future this call is not working. You just have to change it in one point, and the change will apply to all your program :-) Best regards, --- Jean-Christophe Berthon Cap Gemini -- Ernst Young Toulouse FR Skill Aerospace -- Image Quality Email: [EMAIL PROTECTED] Tel : (+33) 561 31 6639 - Original Message - From: Andrés Giraldo [EMAIL PROTECTED] To: Jean-Christophe Berthon [EMAIL PROTECTED] Sent: Tuesday, July 10, 2001 5:22 PM Subject: Re: GtkList number of items? gtk_object_set_data (GList)? Ok! Thanks by your help! g_list_length works pretty well with GList widgets, but I need to work with a GtkList... There's any way to pass from one to another? I mean.. can I use g_list_length with a GtkList, if I can... how should I do this? because I already tried something like ... g_list_length ((GList *)mygtklsit) and it doesn't work Thanks again! __ Do You Yahoo!? Get personalized email addresses from Yahoo! Mail http://personal.mail.yahoo.com/ ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: GtkList number of items? gtk_object_set_data (GList)?
1) you should try : g_list_length 2) you should define a structure... I'm explaining it better. Maybe you have now something like that (based on the idea that you have a combo box behind...) GList*list = NULL; gchar*comboitem; comboitem = g_malloc(sizeof(gchar)*20); strcpy(comboitem, toto); liste = g_list_insert(liste, comboitem, (GCompareFunc) compare); strcpy(comboitem, tata); liste = g_list_insert(liste, comboitem, (GCompareFunc) compare); /* ... */ OK now you change it for this: typedef struct _MyComboItem { gchar*pcItem; gpointer*pvData; } MyComboItem; GList*list = NULL; MyComboItem *comboitem; comboitem = g_malloc(sizeof(MyComboItem)); comboitem.pcItem = toto; comboitem.pvData = ComplementaryInfo; liste = g_list_insert(liste, comboitem, (GCompareFunc) compare); comboitem.pcItem = tata; comboitem.pvData = ComplementaryInfo; liste = g_list_insert(liste, comboitem, (GCompareFunc) compare); /* ... */ Best regards, --- Jean-Christophe Berthon Cap Gemini -- Ernst Young Toulouse FR Skill Aerospace -- Image Quality Email: [EMAIL PROTECTED] Tel : (+33) 561 31 6639 - Original Message - From: Andrés Giraldo [EMAIL PROTECTED] To: Gtk List [EMAIL PROTECTED] Sent: Tuesday, July 10, 2001 4:35 PM Subject: GtkList number of items? gtk_object_set_data (GList)? Hi! 2 questions: 1. How can I know the number of items in a GtkList? 2. How can I add some info (like gtk_object_set_data) to a GList item? That's because I'm working with a combo box and I would to obtain that info on the selected item. Thanks by your help! __ Do You Yahoo!? Get personalized email addresses from Yahoo! Mail http://personal.mail.yahoo.com/ ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Gtk-warning: cannot open display
did you try to open another term and logon as root (for example, or even try it with your own login name) and then type this: xhost + then try to run your program. Is it still showing the same problem? Best regards, --- Jean-Christophe Berthon - Original Message - From: Johan N-P [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, July 11, 2001 1:07 AM Subject: Gtk-warning: cannot open display Hi all, I have a really weird problem. Until yesterday my gtk program worked fine, but suddenly it stopped working. Now it just tells me gtk-warning: cannot open display when I try to run it. $DISPLAY is :0.0 as it should be. And yes, I'm running it as the user who started X. When I compile and run other gtk programs they work fine, it's just my program that behaves like this. I stepped through it in gdb to see where it happens, and I found that it's always gtk_init that gives this error without any apparent reason (there is absolutely nothing wrong with argc and argv or the way I supply them). What could tbe the reason for this? Johan ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Getting the number of row in a CList (add new feature to GTK?)
Hy, I was looking at how to get the number of row of a CList, and I find out that this is not implemented. We can get the number of column via the args n_columns but nothing for the row. (I've looked in the source code of the gtkclist). So I find that in the _GtkClist structure there is a rows field which should maybe linked to a n_rows arguments? Or is it a mistake of conception of me? I know that in futur version, this component will be deprecated. So maybe nobody will work on adding such a feature. But then is there an erzatz (something equiv.) to this widget in the futur implementation of GTK? I couldn't really found out something similar on the web site... Best regards, --- Jean-Christophe Berthon ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: [CList] Making a CList user-modifiable
Thanks a lot all of you :-) I've quite a lot to look at right now and I'm going to work on it. If I have some more problems I'll write again. Again, thanks a lot :-))) Best regards, --- Jean-Christophe Berthon - Original Message - From: Stephen Witkop [EMAIL PROTECTED] To: Jean-Christophe Berthon [EMAIL PROTECTED] Cc: Gtk List [EMAIL PROTECTED] Sent: Sunday, July 08, 2001 8:32 PM Subject: Re: [CList] Making a CList user-modifiable On 06 Jul 2001 10:21:18 +0200, Jean-Christophe Berthon wrote: Hello, I've sent an email (subject About CList 5th July) about the CList and if they were a possibility for the user to modify an element in the same way as with a spreadsheet (like gnumeric or excel). If this object cannot do it, it there a workaround? Or tips? Or maybe another similar object which can do it. I've tried to have a look at gnumeric but it seems that they built there own spreadsheet, drawing each lines, etc. I've pitily not enough time to think of something similar. I'd need an already built widget doing that kind of work. There is a widget called GtkSheet that does what you want. It's part of the GtkExtra package and can be found at: http://gtkextra.sourceforge.net/ Stephen ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
[CList] Making a CList user-modifiable
Hello, I've sent an email (subject About CList 5th July) about the CList and if they were a possibility for the user to modify an element in the same way as with a spreadsheet (like gnumeric or excel). If this object cannot do it, it there a workaround? Or tips? Or maybe another similar object which can do it. I've tried to have a look at gnumeric but it seems that they built there own spreadsheet, drawing each lines, etc. I've pitily not enough time to think of something similar. I'd need an already built widget doing that kind of work. Thanks a lot in advance for any answer. Every tips or suggestion will be really useful, Have a nice day. Best regards, --- Jean-Christophe Berthon ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Transmit an array to a function
I'm not sure about it but try this : gtk_signal_connect (GTK_OBJECT(button),clicked,GTK_SIGNAL_FUNC(function), widget); according that widget is the name of your array (GtkWidget *widget[20]) This should work, I think (thought I never tried it...) Best regards, --- Jean-Christophe Berthon Cap Gemini -- Ernst Young Toulouse FR Skill Aerospace -- Image Quality Email: [EMAIL PROTECTED] Tel : (+33) 561 31 6639 - Original Message - From: Anthony Ferrand [EMAIL PROTECTED] To: GTK [EMAIL PROTECTED] Sent: Thursday, July 05, 2001 12:03 PM Subject: Transmit an array to a function Hello, How can I transmit an array of widget (GtkWidget *widget[20]) to a function using gtk_signal_connect_object gtk_signal_connect_object(GTK_OBJECT(button),clicked,GTK_SIGNAL_FUNC(funct ion),what must I write here?); Thanks in advance, Anthony -- http://www.freeciv.fr.st ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Transmit an array to a function
maybe if you just pass the address of the table like this: gtk_signal_connect (GTK_OBJECT(button),clicked,GTK_SIGNAL_FUNC(function), widget); then in the callback function you should be able to access your table like this : (taking into account that the data pass to the function is of this form : gpointer vpData) printf(%s\n, (*vpData)[3]); try it maybe it work :-) Jean-Christophe Berthon wrote: I'm not sure about it but try this : gtk_signal_connect (GTK_OBJECT(button),clicked,GTK_SIGNAL_FUNC(function), widget); according that widget is the name of your array (GtkWidget *widget[20]) This should work, I think (thought I never tried it...) No it doesn't work. During the compilation I get it: warning: passing arg 4 of `gtk_signal_connect_object' from incompatible pointer type But, anyway the prog works even with this compilation error. I can avoid this error by using (gpointer)widget instead of widget In fact, it's not the point. The pb is that I can transmit widget[1] without any pb but I can't transmit the whole array in the same call. Idem if I want to transmit an array of char: char *caract[20]; gtk_signal_connect (GTK_OBJECT(button),clicked,GTK_SIGNAL_FUNC(function),(gpointer)carac); -- won't work gtk_signal_connect (GTK_OBJECT(button),clicked,GTK_SIGNAL_FUNC(function),(gpointer)carac[1]); -- will work (Of course, I change the receiving function to sync with the call) So, I am really lost... It must exist a solution to transmit an array of any type, no? Anthony -- http://www.freeciv.fr.st ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
About CList
Hy, I want to know if a user can modify a value in a GtkCList? And if not how to workaround it (without being un-ergonomic) or is there another widget more suitable? Any experience or help greatly appreciate :-) Best regards, --- Jean-Christophe Berthon Cap Gemini -- Ernst Young Toulouse FR Skill Aerospace -- Image Quality Email: [EMAIL PROTECTED] Tel : (+33) 561 31 6639 ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list