ToshioCP / Gtk4-tutorial

GTK 4 tutorial for beginners
https://toshiocp.github.io/Gtk4-tutorial/
548 stars 50 forks source link

Provide DnD example. #12

Closed gavr123456789 closed 11 months ago

gavr123456789 commented 2 years ago

Here may be as a source, but its too complicated for minimal example.
https://github.com/aeldemery/gtk4_dnd/blob/master/src/MainWindow.vala#L62

ToshioCP commented 2 years ago

Thank you for the post, Gavr.

I saw the repository you linked. There are many Gtk4-Vala examples. I don't know about Vala. So, I need long time to read the codes, but I will try it.

Gtk4-tutorial is a tutorial for beginners and it only covers basics. DnD is beyond the scope of this tutorial so far. However, I want to add it in the future version. Your example will be helpful for me to write about DnD. Thank you.

Regards,

Toshio

gavr123456789 commented 2 years ago

I just want to clarify that I did not mean to rewrite that example in C and explain it in the guide, but on the contrary to write the most minimal and simple and explain it in the form of a new chapter of your wonderful guide.

StefanSalewski commented 1 year ago

DnD is beyond the scope of this tutorial so far.

DnD is actually easy in GTK4, what was missing are tiny examples to learn and understand the basic behaviour. Feel free to translate my latest tiny Nim examples to C, see https://ssalewski.de/gtkprogramming.html#_drag_and_drop_dnd. Should be easy for you. The issue that after clicking the Button DND stops to work is not that nice, my guess is that it is a GTK4 bug. I have currently no motivation to ask at Gnome forum, Mr. Bassi is really too unfriendly, see https://discourse.gnome.org/t/code-of-conduct/11162. And others may not know -- well maybe Mr. Droege? Well, maybe I should create a bugzilla issue, or ask at Reddit or StackOverflow. But then I should provide a C example, and I have really no motivation and not much free time currently.

ToshioCP commented 1 year ago

Thank you Dr. Salewski. I will check your code later. However, I am busy to write a ruby tutorial (in Japanese) now. So I don't have enough time to add a new section into the gtk4 tutorial. DnD is one the most popular topic in Gtk4 programmers. So I will add it in the future. Your advice encourages me very much.

StefanSalewski commented 1 year ago

ruby tutorial

Ruby GTK tutorial? I was using Ruby from 2007 to 2013 with GTK2. Ruby was a nice language, but it has definitely lost the race against Python. And personally I think, that modern statically typed and compiled languages like Julia, Crystal, Nim and some more have a lot advantages over Ruby and Python. Not only performance, the statically typing makes the code cleaner. Python is still OK for tiny scripts. Unfortunately the Nim community seems to be shrinking, so Nim may have the same fate as Ruby and will die.

Best Regards, Stefan Salewski

ToshioCP commented 11 months ago

I've added a drag and drop section, which includes a very simple DND example. So, I will close this issue with this comment. Thank you for your suggestion.