Updated blog series on using GTK with the D language

The second post on the gtkDcoding blog this week continues the series on Dialogs. This one is about opening files

I hope you find it informative.

Tuesday creeps up on us again and it’s time for yet another blog post. Today’s instalment continues from last time with the multi-select version of the file open dialog.

1 Like

Today’s blog post over on gtkDcoding.com is about using a GTK dialog for saving a file. You can find it here

I also redid the titles for all posts to clarify and group them under various themes.

1 Like

Good day to you all.

'Tis another Tuesday and time for a new blog post. This is a continuation of the series on Dialogs and further, a continuation of the mini-series-within-a-series on file Dialogs. The subject is SaveAs and titlebar filename reflection.

May 29, 2019

While doing screenshots for the gtkDcoding blog (See? I’m working on it.) I discovered something cool about signal callback chains in GtkD. So, I ended up rewriting the code and the blog post to include this coolness.

You can read it here.

May 31, 2019

Today’s blog post covers a topic that was requested back in mid-April, the message dialog. Some of the extra info you may glean from today’s post is:

  • tracing widget inheritance to find a complete list of available functions, and
  • where to find the DialogFlags enum.

You can find it here.

June 4, 2019

For the first blog instalment this week, we look at the ColorChooserDialog and discuss the differences between it and the ColorChooserButton as well as how to by-pass white as a default color.

You can find it here.

June 7, 2019

Today starts a mini-series within a series about rolling yer own Dialogs. And because aesthetics is such a big part of doing layout, we start with a mini crash course in design.

June 11, 2019

This is the second in a series (Custom Dialogs) within a series (Dialogs) and deals with the action area. It’s available here.

June 18, 2019

Two announcements today…

First, today’s post covers splitting a window into panes. You can find it here.

Second, you’ll notice some changes in the site. At the prompting of a bunch of people here and elsewhere, I’ve starting making the site more visual.

  • The first step was to color-code the blog entries by topic.
  • You’ll also notice that the first three posts from back in January now have screenshots. And just a quick tip of the hat to Michelle Long, Greatsam4sure, and sanyayss for suggesting it. It just took me a while to get organized enough to do it.

Future Facelist Plans

  • get screenshots and any other appropriate graphics into each blog post. If there are any posts you think need something special, image wise, please let me know at: gtkdcoding over on gmail. (please suffix a dot and a com and shove an ‘at’ in the middle there)

  • icons for each topic will eventually appear alongside each link on the main page so as to make the topics even easier to pick out.

And if anyone has any other suggestions, please let me know those too. Due to time constraints, I won’t promise to implement all of them, but I’ll do my best.

Also, if anyone knows how to implement a non-paid commenting system on GitHub Pages, I’d appreciate some advice on how to go about it. I always have a hard time with systems involving three or more languages (like in this case: Jekyll, Liquid, HTML, markdown, CSS and Ruby.

June 21, 2019

Friday’s post covers the SpinButton and its all-important Adjustment object companion. You can find it here

Facelift Update

Things are moving along nicely and I expect the fully-realized site to be unveiled within the next week.

June 23, 2019.

Stage 1 of the facelift is now complete. Blog entries are color-associated in an effort to make things more visual. Each topic also has its own avatar. Points to anyone who can figure out why each avatar is associated with its topic.

https://gtkdcoding.com/

June 25, 2019

There are a couple of things to watch out for with the ScaleButton and its offspring, the VolumeButton. Read all about it here.

June 28, 2019

Today’s post on gtkdcoding.com is the first in a 9-part series covering GTK’s model/view/controller mechanism and how it’s used in various widgets including the TreeView. Today is mostly theory, a reference (if you will) for the rest of the series.

You can read it here.

July 2, 2019

Continuing the series on Model, View, Controller…

This time around, we look at the ComboBoxText, the simplest of the MVC offerings.

July 5, 2019

Today is a bit of a milestone for the blog as the 50th regular post goes up. Also, the facelift is coming along nicely, the next phase of which should be ready to push by July 9th.

And today’s topic continues with the MVC series by demonstrating how to add and remove items from a ComboBoxText widget. You can read it here.

July 9, 2019

Last week, gtkDcoding saw its 50th regularly-scheduled post. Today marks the launch of stage two of the facelift we’ve been working toward for the last month. The new features are:

  • syntax highlighting for all code snippets,
  • screenshots for every example, and
  • updated color-coding to more easily associate posts with the topics they cover.

Also of note is that each screenshot set includes:

  • a shot (or two or three) of the example code in action,
  • a shot of the terminal window showing any output, and
  • a link (which opens a new browser tab) to the full code example,
  • all these are now found within an in-page box directly below a page title naming the example, and
  • clicking on either of the screenshots displays an overlay with a full-size view of the screenshot.

There will likely be minor tweaks happening over the next few weeks, but this is the big roll-out. I hope you all like it.

And instead of linking directly to the article, here’s a link to the main page so you can see the entire facelift.

July 12, 2019

Today’s post deals with integers in a ComboBox. It’s not exactly tricky, but a little clarification never hurts, right?

Here’s where you’ll find it.

July 16, 2019

Carrying on with installment #6 of the MVC series, we see how to use images in a ComboBox. This is the last bit of peripheral stuff we’ll need to know before tackling the TreeView and (later) the TreeStore.

Here it is.

July 19, 2019

If you’ve been anticipating the TreeView examples, today’s post is where the rubber hits the road with a look at the differences and similarities between populating a ComboBox and a TreeView. You can find it here.

July 23, 2019

Hi y’all,

This week’s first post is entry #8 in the MVC series and covers loading up a TreeView with a decorated list of system fonts. Decorations include varying the size, weight, and style as well as the font face. You can view it here.

July 26, 2019

Today we get to do something unusual. Drawing on and combining a bunch of things we’ve done in past instalments, we’ll build a two-column ComboBox with different images, custom fonts, and background colors for each item in the list. Here’s the post.

1 Like

Ron, I just had a short look at your latest write-up:

I can tell you that with a SpinButton , pageSize is best set to ‘0’ because it seems to add an extra maximum constraint to the spinner. So if your maximum is 50 and pageSize is 20, the SpinButton won’t go above 30. If you set it to 60, that’s a different story. It does have another meaning when the Adjustment is used in other places, but we’ll speak of those cases when we get to them.

As you may know well yourself, readers generally do not like statements as this so much. Readers generally like precise, not too verbose information. For this special case, page-size is a well understood property, it makes much sense for GtkScrollBars for example. So generally, it would be a good solution to start with GtkScrollBar and explain GtkAdjustment well. Or, if that is not possible, just say that for GtkSpinButton we generally set this value to zero. Point.

I have still some hope that you will try to explain some of the more difficult GTK3 topics soon, like GSettings, GAction, GMenu, Property-Binding, CSS-Styling and much more. I have just myself a hard time understanding GAction/GMenu and preparing some Nim examples. Have gained some basic understanding, but it was really hard and very time consuming. The explanations at HowDoI - GNOME Wiki! are really not too helpful.

I think your idea of using some screenshots is nice. Maybe you can activate also some syntax highlighting for your code examples, like we do in Nim: High level GTK4 and GTK3 bindings for the Nim programming language

Point taken. I normally keep things as brief as possible. Rewrite is now live.

That’s the plan. I’m also mindful of the up-coming GTK 4.x release which I’ve only had time to glance at so far.

I do have some CSS examples in the works, but as for when they’ll hit the blog, I can’t say for sure. Scheduling is a bit of a mind bender and lead time ATM is two months, give or take.

These should be in place within the next couple of weeks.

I’ve been looking into this, but it’s difficult to find a D-language syntax plugin that really does more than mimic the C-lang version… which falls short of the mark. Also, training the plugin to deal with GtkD keywords is a whole other nightmare leading me to think that writing one from scratch might be a better idea. However, parsers are far from being my strength.

I may resort to screenshots for the code if I can’t find a solution. It won’t allow copy/paste, but with the code files available as well, I don’t suppose that matters much.

Thanks for taking the time to give me some feedback, Stefan. Have a good weekend.

No, please make code true text!

Syntax highlighting is really not that important. Does D-Lang already supports GTK4? I have recently added GTK4 support to gintro for Nim language, but have not yet shipped it to github. But I will in the next days, have still to convert at least a few examples…

LOL! Okay. I’ll see what can be done without spending too much time being sidetracked. :slight_smile:

The latest GTK version supported by D is 3.24, but work is on-going.

The GTK blog located at https://blog.gtk.org/ may contain some useful information too.

Looking for gsettings, google recently pointed me to First steps with GSettings – GTK Development Blog which seems to be a nice introduction to gsettings. And it seems that its author Matthias Clasen have discovered the core problem of current GTK documentation:

The documentation for GSettings unfortunately makes it appear more complicated than it is, since it doesn’t really try to hide the powerful features that are available to you

Ron, I have just added a GSettings example, see

I am not too happy with my wording, and I am not even sure if all of my short explanations are correct, but at least it is a fast starting point for a new GTK user.

Let me know when you have written something about this topic – I am sure your text will be better, so I will replace my then.

And you’ll ask permission to quote me, right? :slight_smile:

Yes, would be nice if we could just point the Nim users to your fine explanations.

I have not seen you writing about listview/treeview and related stuff. I think that was the most interesting in the Krause book, and the most complicated, I can not remember details.

I think listview/treeview was not changed from gtk2 to gtk3, so the Krause explanations should be still valid, I think I will read it again. But I have no idea if listview/treeview will change for GTK4.

When the time comes, let’s talk about it. :slight_smile:

Definitely the most complex which is why I held back on it until other, related-and-yet-simpler concepts/widgets were covered first. And that has now been done which means the next blog post on the gtkDcoding site starts a new series on MVC (Model, View, Controller) widgets including all things Tree-like (Model, View) and etc. like that.

Off the top of my head, I don’t think it changed from 2.x to 3.x and I’m pretty sure there are no changes going into 4.x. I just had a quick look at this document regarding 3 to 4 migration and didn’t see anything Tree- or List- related.