So now you’ve got a library and a GUI for making your GUI. Now, I have mixed up Glade files and used ones that were designed for GTK 2, but I wouldn’t recommend it. There’s another version, 3.8.x, but that’s for GTK 2. You can read more about it on its own page, but if you’re going to download it, you should look at getting v3.18.x, which is for GTK 3. But why do that when there’s Glade? Glade is a RAD tool to make GUIs for GTK, and it works really well. Using GTK and gtk-fortran alone, you can create the entire GUI. The current version of GTK+ is v3.x, so we’ll be concentrating on that rather than the previous v2.x. ![]() It is a “partial GTK+ / Fortran binding 100% written in Fortran.” To do such binding, the ISO_C_BINDING module is used. In order to interface that into Fortran, gtk-fortran was created. GTK, if you didn’t know already, is an open-source, cross-platform API written in C that’s for creating graphical user interfaces. What we need is a free one that you can build a fully-functional program with most of the bells and whistles. There are other GUI libraries around (Winteracter, GINO), but they cost money, too. Not to mention for anything other than your own little home project it costs money to license. And unfortunately, I’m really lazy (in public I call it being “pragmatic”). But because you have to code it by hand and then compile/run to see if you did it right, it can be a lot of work. You can use DISLIN to code a GUI, and it certainly can turn out nice. There are several libraries available to make a GUI, but most don’t have a GUI to make a GUI (i.e. Recently though, I have come across a relatively pain-free way of doing it. Rather than try and reinvent the wheel, I abandoned the project. I even attempted to make my own library based on gtk-fortran, but then I realized that I was just making things more complicated than they needed to be. While I haven’t actually spent an entire year trying to figure it out, I certainly have stumbled during those times when I did try. If there’s one thing that I’ve struggled with in the past year, its been finding an easy way to create a GUI using Fortran. Update (6/27/14): I’ve gone ahead and re-written a major of the second half of the post to include some basic concepts for what you’re doing and also to make the steps a bit more clear. If you have no idea what I’m talking about then don’t worry about it… Everything is great □ I’ve also completely rewritten that section of the post so there won’t be anymore confusion. ![]() ![]() I’ve since made corrections and uploaded the fixes to here: That’s because the test.glade file in the template had the signals (and the objects) named incorrectly, so the window would never launch. zip I first had up here, you probably couldn’t get the window to load. Update (6/26/14): If you downloaded the old project template.
0 Comments
Leave a Reply. |