Bill, Thank you for these explanations - it is very helpful. I have been reading more on J and GTK (and C) lately and now have a little better understanding of those and the addons/gui/gtk.ijs file.
I have figured out how to add the following to gtk.ijs: - how to translate gtk enums (those with bitmasks as well) - what the function parameters n x *x *c f, i etc. mean (and that the first parameter is the return value) so can add the function declarations But I don't know how to 'add'(use) structs like GtkTargetEntry here. I saw that there are some structs in the file like GdkEventKey but I dont understand how these are used: sizeofGdkEventKey =: 56 GdkEventKey =: 24 and then getGdkEventKey =: 3 : '_2 ic memr y, GdkEventKey, 8, JCHAR' (what is happening here ?) or GdkEventButton_state =: 48 (in the gtk reference for struct GdkEventButton both state and button are guint yet here they have different values...) GdkEventButton_button =: 52 How are the above mentioned specific values 56, 24 and 48, 52 determined or for eg. there is also sizeofGdkEventMotion =: 80 ? (how are the appropriate values found in J for gdouble, gint, etc. to get to that number for the size of the struct) And also a question that leads me to the basics of how the gtk addon works: The thing about gtk_target_entry_new is that it is not in the .h files in addons/api/gtkinclude/gtk-2.0/gtk So would it work if I added its declaration to the addons/gui/gtk.ijs file ? (Is this a problem - because the truth is I don't understand which gtk files the gtk.ijs is reading and translating to Jgtk. Does it read directly from the gtk files installed on my pc(by this I mean the bare gtk install unrelated to J) or does gtk(the actual pure gtk files) come with the J package in some folder from where the addon gtk.ijs is reading and translating this to Jgtk ? [I have selected and installed everything from the package manager but don't have a good overview how the addon for gtk basically works] Random remarks for random questions would again be very helpful :) Thanks, Emir Message: 2 Date: Sat, 19 Nov 2011 23:38:58 +0800 From: bill lam <bbill....@gmail.com> Subject: Re: [Jprogramming] Questions on Drag and Drop in J GTK To: jprogramming <programming@jsoftware.com> Message-ID: <20111119153858.GA2892@debian.b2j> Content-Type: text/plain; charset=us-ascii To be honest, I've never tried gtk dnd so I can just make some random remarks, 1.consig, consig3, ... consig7 the suffix indicate the number of parameter of the callback handler, consig is acutally consig2. 2.signal names accept both hyphen and underscore. 3.callback handler the parameters are always 32 or 64-bit intergers depending on J32/J64. the first parameter is the widget that received the signal., the last parameter is user-data that is already used by JGTK, do not use it in your code. eg. for consig 'widget data'=. y for consig3 'widget event data'=. y for consig4 'widget foo bar data'=. y the actual number of parameter depends on signals. You can get this information from gtk api reference, and then use the appropiate consig[n] as needed. drag_begin_handl (GtkWidget *widget, GdkDragContext *context, gpointer user_data){ const gchar *name = gtk_widget_get_name (widget); g_print("%s: drag_begin_handl\n", name); } should be something like (should use consig3 to connect signal) drag_begin_handl=: 3 : 0 'widget context data'=. y name=. memr 0 _1,~ gtk_widget_get_name widget smoutput name, ': drag_begin_handl' ) 4. gtk datatypes are list in api reference, in particular I can see there is gtk_target_entry_new which may be useful. 5. The "drag-data-received" signal void user_function (GtkWidget *widget, GdkDragContext *drag_context, gint x, gint y, GtkSelectionData *data, guint info, guint time, gpointer user_data) there are 8 parameters in its handler, thus consig8 is needed. However the biggest is consig7 in jgtk, I have just added consig8 to Public repo, please add it yourself and also add other dnd related api to run your codes. -- regards, ==================================================== GPG key 1024D/4434BAB3 2008-08-24 gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3 ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm