0115: GTK GIO Application Flags - Opening Files
gtkDcoding
by Ron Tarrant
3y ago
0115 – GTK/GIO Open Flag The next ApplicationFlag, HANDLES_OPEN, gives us a mechanism for opening files from the command line. Such things are relatively straightforward anyway, but perhaps we’ll find an advantage or two by using what GIO has to offer. Let’s dig in and find out, shall we? We’ll do this in two steps. Firstly, we’ll look at the basics—grabbing the file names from the command line—and secondly, we’ll add just enough code to open each file in its own window. Importing the GIO File Abstraction Results of this example: × Demonstration where multiple file names are given on the co ..read more
Visit website
0114: GTK GIO Application Flags and Command Line Arguments
gtkDcoding
by Ron Tarrant
3y ago
0114: GTK/GIO Application Flags and Command Line Arguments Today we’ll dig into passing command line arguments to a GTK/GIO application and start looking at the built-in mechanism that handles them. The Arguments Results of this example: × Current example output × Current example terminal output (click for enlarged view) The code file for this example is available here. As mentioned last time, command-line arguments are passed along to the GIO Application—a class object rather than the Main C-style struct we’ve used all along—and packed into an array. The flow of these arguments is: the ..read more
Visit website
0113: GTK GIO Application IDs and Signals
gtkDcoding
by Ron Tarrant
3y ago
0113: Application IDs and Signals Continuing from last time when we started looking at GTK/GIO Applications, today let’s look at… Application IDs Results of this example: × Current example output × Current example terminal output (click for enlarged view) The code file for this example is available here. Every Application has to have an ID, even if—as in our example from last time—it’s null. The intention is that each Application can be singled out for inter-process communication, even across the vastness of the Internet. This may seem like overkill, but if you think about it, how else c ..read more
Visit website
0112: GTK GIO Applications - Introduction
gtkDcoding
by Ron Tarrant
3y ago
After the Hiatus It’s been more than a year since I made my last post on this blog. When I stopped posting last year, I was burned out, distracted by COVID-19, our tiny apartment was suddenly a hub of work activity for both of us, and I was still disheartened by the changes being made to GTK in version 4. Now, I can see things a little more clearly… sort of. COVID-19 is still here and we may all go into (at least) one more round of lock-downs. But, other things are advancing… My wife and I have both been double-vaccinated and we’ve worked out an arrangement whereby we can both work in this tin ..read more
Visit website
0111: A Scale Widget to Control Graphic Placement
gtkDcoding
by Ron Tarrant
3y ago
0111: A Scale Widget to Control Graphic Placement Results of this example: × Current example output × Current example terminal output (click for enlarged view) The code file for this example is available here. Last time, we did the simple version of a Scale button. If you didn’t read that—depending on your skill level—it might be helpful in understanding what’s going on in today’s post. So, no mucky about, let’s get down to it… The Scale-v-DrawingArea Demo Okay, because we’re doing a bit of graphic work this time, we’ll need to import the usual graphical culprits: import cairo.Context ..read more
Visit website
0110: Scale Button
gtkDcoding
by Ron Tarrant
3y ago
0110: Scale Button Today we’re going to look at the Scale button. Note that this is different from a ScaleButton which we worked with in post #0047. Also, we won’t be stopping with just a simple demo. Instead, we’ll be using it as a springboard into a practical example that grew out of a request by Jan Hönig over on the DLang forum. Jan asked for a demo wherein a slider controls the position of a ball on a DrawingArea. So today, we’ll start with this simple example of a plain-jane Scale button and in the next blog post, we’ll go for the full-on demo Jan asked for. The Scale Button Results of ..read more
Visit website
0109: SFX – Sync Properties Over Multiple Widgets
gtkDcoding
by Ron Tarrant
3y ago
0109: SFX – Using bindProperty() to Sync Properties Over Multiple Widgets This post is the result of a discussion with Ferhat Kurtulmuş on the D Forum. He pointed out that bindProperty() can be used to sync up the sensitivity of a bunch of widgets. Change one and they all change. It sounded rather intriguing, so let’s have a look, shall we? Widget Sync Results of this example: × Current example output × Current example terminal output (click for enlarged view) The code file for this example is available here. Looking at the screen-shot, you’ll see a list of three Switchs and, at the bott ..read more
Visit website
0108: D Snippets IV - Using Arrays in a UI Context
gtkDcoding
by Ron Tarrant
3y ago
0108: D Snippets IV - Using Arrays in a UI Context So, what do you do when you need to pick an object out of a bunch/collection/array for special processing? Or deletion? Last time, we talked about adding and removing Observers from a watched object’s list and this technique ties right into that discussion. It’s the kind of thing that also comes up when you want to remove a tab from a Notebook. Let’s have a look at another D-specific trick for hunting down stuff in arrays… The countUntil() Function Results of this example: × Current example terminal output (click for enlarged view) The code ..read more
Visit website
0107: D Snippets III - A Practical Observer
gtkDcoding
by Ron Tarrant
3y ago
0107: D Snippets III - A Practical Observer Last time, we started with a look at a generic example of an Observer pattern. This time, we’ll pick apart a more practical example in which multiple Observers—a Button, an Image, and an Entry—change their state depending on the state of a watched object. The Observer at Work Results of this example: × Current example output × Current example terminal output (click for enlarged view) The code file for this example is available here. The challenge here is that the watched object needs to see all widgets as being a common type. We’ve got a Button ..read more
Visit website
0106: D Snippets II - A Generic Observer
gtkDcoding
by Ron Tarrant
3y ago
0106: D-language Snippets II - A Generic Observer Picking up from last time… We discussed the difference between the Observer and Singleton patterns, then took a closer look at both the generic Singleton and a specific example of the Singleton at work. This time, we’ll do the same thing with the Observer. The Observer Pattern Note: There is no UI for this example, just the output to the terminal. Results of this example: × Current example terminal output (click for enlarged view) The code file for this example is available here. And because there’s no UI, we’ll start with… The main() Funct ..read more
Visit website

Follow gtkDcoding on FeedSpot

Continue with Google
Continue with Apple
OR