Improved keyboard navigation in the GExperts configuration dialog

 Delphi, GExperts  Comments Off on Improved keyboard navigation in the GExperts configuration dialog
Jul 222018
 

The GExperts configuration dialog, while I like the general look, has always been a keyboard navigation nightmare for me.

Assume you want to change the configuration of the Formatter Expert:

You first open the configuration dialog pressing Ctrl+H + X. Then you press Ctrl+Tab to switch to the Editor Experts tab. You type “form” which filters the list of experts to only display the “Code Formatter” and “Add To Formatter Capitalization” entries. So far, so good. Now, how to press the “Configure” button? You could of course now press Tab nine times until the focus has moved to the “Configure” button and press enter, but who wants to do that? I certainly don’t, so I usually resorted to using the mouse.

This has irked me for quite a while because I am more a keyboard person. So, today I added two functions that solve the issue for me:

First, you can now scroll the expert list using the up/down arrow and page up/down keys while the focus is on the filter control.

Second, when scrolling (or filtering) the list, the configuration button of first visible expert now automatically gets the Alt+C hotkey.

So, in order to open the Formatter Expert’s configuration dialog, you simple press Alt+C after you filtered the list. Much more to my liking!

Selecting alignment and anchors in the Rename Components expert

 Delphi, GExperts  Comments Off on Selecting alignment and anchors in the Rename Components expert
Jul 212018
 

A few weeks ago I added the option to set the alignment and anchors properties for controls that support them to the GExperts Rename Component expert. After having used it for a while I found that the navigation using arrow keys left something to desire. It just wasn’t intuitive, e.g.: Pressing the down arrow key while the “Top” button had the focus moved the focus to the “Left” button. Pressing down again moved it to the “Client” button and again to the “Right” button.

The intuitive way would be that the up arrow key moves the focus to the control above the current one, the down arrow key move the focus to the control below the current one etc., like this:

So, how do you get the dialog to behave like this?

My first try was to write OnKeyDown handlers for the buttons, but that didn’t work, the handlers were never called. The second try was an OnKeyDown handler for the form and setting its KeyPreview property to true. Again, this didn’t work, the handler was never called. WTF?

Some googling turned up this question on StackOverflow and an answer that worked for me: Adding a DialogKey message handler to the form. (Thanks Sertak Kyuz”! I always appreciate it when somebody supports my lazyiness.). So I added the following code to GX_CompRename:

procedure TfmCompRename.DialogKey(var Msg: TWMKey);
begin
  // make the selection of alignment and anchors via arrow keys more intuitive
  case Msg.CharCode of
    VK_DOWN: begin
        if ActiveControl = b_AlignTop then
          b_AlignClient.SetFocus
        else if (ActiveControl = b_AlignClient) or (ActiveControl = b_AlignLeft) or (ActiveControl = b_AlignRight) then
          b_AlignBottom.SetFocus
        else if (ActiveControl = b_AnchorTop) or (ActiveControl = b_AnchorLeft) or (ActiveControl = b_AnchorRight) then
          b_AnchorBottom.SetFocus
        else
          inherited;
      end;
    VK_UP: begin
        if ActiveControl = b_AlignBottom then
          b_AlignClient.SetFocus
        else if (ActiveControl = b_AlignClient) or (ActiveControl = b_AlignLeft) or (ActiveControl = b_AlignRight) then
          b_AlignTop.SetFocus
        else if (ActiveControl = b_AlignNone) or (ActiveControl = b_AlignCustom)then
          b_AlignBottom.SetFocus
        else if (ActiveControl = b_AnchorBottom) or (ActiveControl = b_AnchorLeft) or (ActiveControl = b_AnchorRight) then
          b_AnchorTop.SetFocus
        else
          inherited;
      end;
    VK_RIGHT: begin
        if ActiveControl = b_AlignLeft then
          b_AlignClient.SetFocus
        else if ActiveControl = b_AlignClient then
          b_AlignRight.SetFocus
        else if (ActiveControl = b_AnchorTop) or (ActiveControl = b_AnchorBottom) or (ActiveControl = b_AnchorLeft) then
          b_AnchorRight.SetFocus
        else
          inherited;
      end;
    VK_LEFT: begin
        if ActiveControl = b_AlignRight then
          b_AlignClient.SetFocus
        else if ActiveControl = b_AlignClient then
          b_AlignLeft.SetFocus
        else if (ActiveControl = b_AnchorTop) or (ActiveControl = b_AnchorBottom) or (ActiveControl = b_AnchorRight) then
          b_AnchorLeft.SetFocus
        else
          inherited;
      end;
  else
    inherited;
  end;
end;

Now it works as shown in the picture.

It’s a small improvement, but one that makes me a bit more efficient. It took me about 2 hours to implement and test properly. So, according to XKCD it’s time well spent: I definitely use it more that 5 times a day, so spending 2 hours to save one second is fine. It saves those two hours across five years. And since I am not the only one using GExperts I hope I have saved a lot more than those two hours.

Speaking about saving time: Did you know that you can configure the Rename Components expert to automatically pop up for new controls when you drop them on a form?

Some information about Embarcadero Licence Center

 Delphi  Comments Off on Some information about Embarcadero Licence Center
Jul 142018
 

I switched “my” (meaning the license my employer bought for me) Delphi “Named User License” with subscription to a “Network Named User License” in April 2018. The rationale behind that was, that it happened far too often that I needed yet another Delphi installation to debug a problem. Most of the time that was on a Friday and since my activation limit had been reached years ago, I needed somebody at Embarcadero to bump it up again. Of course that never happens on a weekend, so after I complained about this for the thousandth time, somebody suggested I switch to a different license scheme: Welcome to “Network Named User” (NNU) and the “Embarcadero License Center” (ELC).

Since that topic has come up in a recent discussion in the Delphi Developers community on Google+, I thought I’ll blog about my experience so I can simply link to this blog post when I need to tell that story again.

So, what is it about?

  • A NNU license allows an unlimited number of Delphi installations and activations for a given “named user”. A “named user” is defined as a unique user name for Windows logon. It does not matter whether that’s a domain logon or local logon. So, if JoeUser has got a NNU license for Delphi 2007 (which is the first version that supportes NNUs) he can install it on his workstation, his laptop, a customer’s computer (for debugging something that simply cannot be debugged any other way) and multiple virtual machines. There are only two restrictions:
    1. The Windows logon name must be JoeUser.
    2. The computer/VM must have a network connection to the ELC server.
  • He can even actively use up to three different installations at the same time.
  • If an installation loses contact to the ELC server (e.g. you take your laptop with you on a trip) it will keep working for up to 30 days.
  • The administrator of the ELC can change the user name assigned to a NNU license, so if JoeUser leaves the company, his successor JaneUser can simply use that license to install Delphi on her own computers. The old installations (under the Windows user JoeUser) will become defunct.
  • As far as I know the ELC does not require a permanent internet connection (e.g. to phone home to Embarcadero). It only needs it once to activate the license (and for each new license).
  • The ELC server is a Java application which is available for Windows and Linux (and possibly other OSes, I don’t remember). It runs fine in a virtual machine (I use Ubuntu Server on a XenServer VM.)
  • With a bit of ssh magic, it’s possible to connect to the ELC via a ssh tunnel from offsite. (I would not trust the ELC to be directly accessible from the internet.)

As far as I was told, it’s possible to switch a Named User License to a Network Named User License any time provided you have got an active subscription. According to Embarcadero Germany it is easier to make that switch before extending a subscription.

Note that a few weeks after you switched, all the non NNU installations using the old license keys will stop working (Embarcadero will turn them off). You will have to activate them again with the NNU license.

So far it has worked great for me. I have installations on my Work PC, Work Laptop, Home Office PC (which both use the ssh tunneling magic), private Laptop (with my employer’s consent of course), various VMs and on the computers on many of the measurement vehicles my employer operates to conduct road condition surveys.

Getting the ELC to work was a bit of a pita, but I got great support from Embarcadero for that. In particular from Matthias Ei├čing who also has published a video on YouTube (in German) on that topic.

As a side note: NNU licenses are not the only kind of licenses that are available through ELC. There are also concurrent licenses which work in a different way and are more expensive. See the ELC documentation or contact Embarcadero on how they work.

Some bit of trivia: Does anybody remember AppWave? Apparently ELC is the only remaining part of AppWave that still exists. There are several references to AppWave in the ELC documentation and web sites it generates.

Experimental GExperts feature: Automatically close Messages window

 Delphi, GExperts  Comments Off on Experimental GExperts feature: Automatically close Messages window
Jul 012018
 

You might have become used to it, but probably every Delphi developer has at one time wondered why the Messages window is still visible (and takes up valuable screen real estate) even if it is empty. And even worse, if you close it manually, it automatically comes back when you compile your project.

I too, had become used to it, but got reminded of this nuisance by a recent post from Graeme Geldenhuys on Google+:

How to auto close Message View window on successful compilation.
This was asked for in Delphi 7, but it seems with Delphi XE3 (what I’m using) it’s still not possible. Anybody know of a 3rd party add-in or hidden Delphi setting that will close the Message View after a successful compilation?

If I save my “desktop environment” while the Message View window is closed, then compile it doesn’t display the Message View – if no errors occurred. If a error occurs, then the Message View automatically appears. After I fixed the compilation error and recompile, the Message View stays there and doesn’t close. At this point I want it to close automatically. It is so damn annoying. I need all the screen (editor) space I can get, and the always visible Message View is taking up vital space.

Any known solution for this? Once again, Lazarus IDE does this perfectly.

As far as I know, there is no solution, neither in the Delphi IDE itself nor in any plugin I am aware of. (Update: There actually is one) Until today that is: I have just committed a change to the GExperts repository with the following description:

new IDE enhancement: Automatically close message window (if no errors, warnings or hints)

It is, like most IDE enhancements in GExperts, a hack. It works by hooking the Progress window and when it closes, checks whether there were any hints, warnings or errors. If there are none, it starts a timer that will wait for 1000 ms and then search and close the Messages window.

It works for me, your mileage may vary, of course. If you want to test it, for now you have to compile your own GExperts DLL. Don’t forget to actually enable that option on the IDE page of the configuration dialog!

Some statistics about GExperts downloads

 Delphi, GExperts  Comments Off on Some statistics about GExperts downloads
Jun 242018
 

I always wanted to know how many people use my experimental version of GExperts but never came around to actually evaluate the download counts. Today I finally did it. In total there were 9092 file downloads from downloads.dummzeuch.de/GExperts. Since in 2016-05-07 I switched from ZIP files containing all DLLs to installers for each Delphi version it is a bit difficult to know how many downloads for which version there were, so I evaluated the ZIP files and installers separately.

The ZIP files had 1663 downloads where the three most popular ones were the releases from:

  • 2016-02-15 (388 downloads)
  • 2015-04-11 (277 downloads)
  • 2015-09-06 (258 downloads)

There is much more information to be gained from the 7429 installer downloads:

The most popular Unicode-Delphi versions seem to be

  • Delphi 10.1 (5366 downloads)
  • Delphi 10.2 (416 downloads)
  • Delphi 10 (377 downloads)
  • Delphi XE7 (123 downloads)

The pre-Unicode versions in descending popularity are:

  • Delphi 2007 (218 downloads)
  • Delphi 7 (209 downloads)
  • Delphi 2006 (55 downloads)
  • Delphi 6 (46 downloads)
  • Delphi 2005 (18 downloads)

The most popular releases in descending order are:

  • 2016-10-03 (1497 downloads)
  • 2016-06-05 (1488 downloads)
  • 2017-03-19 (1349 downloads)
  • 2011-01-15 (1255 downloads)

All others had less than 500 downloads.

The downloads for the most recent releases are:

  • 2018-06-03 228 downloads
  • 2018-03-31 133 downloads
  • 2017-04-01 256 downloads
  • 2017-03-19 1349 downloads

I think it’s a bit worrying that the last release with more than 1000 downloads is more than a year old.

These statistics can of course not count those people who rather than using an installer just check out the sources and compile their own DLLs, but I don’t think there are that many who do that.

Also, there are of course the downloads from SourceForge which still remain popular even though the latest release there is my experimental release from 2017-03-19. There have been 1292 downloads from SourceForge in 2018-06 to date and about 2000 monthly for the last few months. The all time high peak was in 2012-03 with more than 100000 downloads (I’m not sure that this is correct though, it’s so much higher than the all time average.).

My conclusion is that I probably couldn’t make a living from working on GExperts even if everyone who downloads it did actually donate the suggested 50 Euros per year which is by far not the case.

Removing Google Fonts from WordPress driving you crazy?

 Delphi  Comments Off on Removing Google Fonts from WordPress driving you crazy?
Jun 082018
 

I just tried to remove all references to Google Fonts from my blog (which is using WordPress) because they can be a issue under the GDPR. There are many descriptions on how to do that and various plugins that claim to do it for you. I tried several ways, but none seemed to work. There was always one GET request going to Google.

Then I realized that I was still looking at my blog logged in as admin, which calls several WordPress tools, one of them apparently is using Google Fonts. So, I used a different web browser which is not logged in on my site. And guess what? No requests going to Google at all.

So I had – again – wasted more than an hour for a bloody GDPR issue.

GExperts 1.3.10 experimental twm 2018-06-03 released

 Delphi, GExperts  Comments Off on GExperts 1.3.10 experimental twm 2018-06-03 released
Jun 032018
 

Given that the last Delphi release was more than a year ago and that I am about to go on vacation so I won’t be able to download and install a new version I would expect a new Delphi release pretty soon. On the other hand this time I actually managed to extend “my” subscription on time so in theory I could download the new version immediately when it becomes available, so the release might still be some time off.
(Greetings from Mr. Murphy)

Anyway, I thought it to be the right time to make a new GExperts release. I even managed to update the version number to 1.3.10 in the executables as well as in the installers and update a few of the auxiliary files.

I have created installers for all supported Delphi versions and I even tested them a bit on some fresh Delphi installations. They do work! How amazing is that?

New features include:

There were also several bug fixes including 3 Unicode issues.

I am pretty sure this new release is more stable than the previous one.

But anyway:

Please be aware that I mostly work with Delphi 2007, so this version can be regarded as tested quite well, followed by Delphi XE2. The others are only known to compile and new features are usually tested superficially with all versions. This is particularly true for Delphi 6/7 and 2005/2006.

Head over to the Experimental GExperts page to download the latest release it.

Remote access to the Embarcadero License Center via SSH tunnel

 Delphi  Comments Off on Remote access to the Embarcadero License Center via SSH tunnel
Apr 282018
 

Once you have set up an Embarcadero License Center (ELC) for your company (with network named user or concurrent licenses) you will need network access to it in order to start the Delphi IDE.

Usually the server will only be accessible from within your intranet (I for one would not trust the ELC security to be good enough to let that server directly face the Internet.). So, in order to access it from a remote computer (e.g. your notebook on a customer’s site or your PC in your home office), that computer must have access to your intranet. If the connection is not available, Delphi will revert to offline usage which will work fine until the offline usage period expires which by default is 7 days but can be configured to up to 30 days.

There are multiple options to provide that access, the one I use is SSH tunneling via Putty.

By default the ELC listens on port 5567 for clients to connect to it, that port is specified when importing a license into ELC and cannot be changed later. The license manager reads the server name and port from the .slip file you provided to it, so you need a way to

  1. Resolve the name to the IP address
  2. Tunnel the port to your intranet

Let’s say, the name of your server is elc.yourcompany.local, its internal IP address is 192.168.1.200 and it listens on the default port 5567.

Name resolution can easily be done by adding an entry to the hosts file, but which IP do put there? If you add the IP of the actual server, it will not work, because that IP is in the intranet and your computer is not, so routing will fail. But using ssh you can tunnel local ports to remote ports, so we add our localhost IP (127.0.0.1) to the hosts file:

# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host
#
# localhost name resolution is handle within DNS itself.
#       127.0.0.1       localhost
#       ::1             localhost
127.0.0.1 elc.yourcompany.local

This will tell the client to expect the server to be listening on 127.0.0.1:5567. Now we only need to tunnel that local port to the actual ELC server by adding an entry to Putty:

Don’t forget to save that session configuration in order for it to be available later.

Now, simply connect your ssh session, start Delphi and voila, it will connect to the ELC, request a license and you are done.