GExperts Enhancements for docking in the Delphi IDE

 Delphi, GExperts  Comments Off on GExperts Enhancements for docking in the Delphi IDE
Sep 022018
 

The Delphi IDE has supported docking of various forms for a long time (I don’t remember if it ever did not). Unfortunately if not docked, the floating forms always seem to be in the way, and if you dock them, they take up screen space that you might rather use for the editor window. Given that most of us have got more than one monitor, wouldn’t it be nice to move some of these docking forms to the second monitor?

You can already do that by just undocking one form and docking other forms to it. The resulting floating window can be moved freely, even to another monitor. What you can’t do with it is minimize it or use WIN+Arrow Keys to snap them to the left or right monitor edge.

There are now two enhancements in GExperts that address this:

The first one is the new IDE enhancement “Enhance Dock Forms to allow minimize and Win+arrow positioning” which can be enabled on the IDE tab of the configuration dialog.

Once set, those floating forms get a minimize button (which of course works) and can be moved to the left or right half of the monitor with Win-Left or Win-Right arrow keys. The usual mouse gestures you can do with any window are also available.

Unfortunately this only works if more than one form have been docked together, so a single floating form will not show these enhancements.

The second enhancement is the new “Add dock window” expert. It creates a new top level window to which any docking form can be docked. It too allows all the usual Windows shortcuts for placing and moving forms. In addition it has got a button on the taskbar so you can minimize it and restore it easily. It can also be put behind the IDE main window or on a different monitor. The taskbar button makes it easy to bring it back.

You can even have multiple of these GExperts dock windows.

Unfortunately they have some drawbacks too:

  • You cannot close them as long as anything is docked to them. I tried to allow that but it crashed the IDE. To really get rid of the window, undock all docked forms from it and then close it.
  • Also, if you dock only a single form to it, you won’t get a caption for it to move it elsewhere. Tip: Disable docking using its context menu (which will make it float) and enable it again. Alternatively select one of your saved desktop layouts or restart the IDE.
  • There is no option to save the currently docked forms and their layout yet.

I’ll try to address these problems in a later version.

Both enhancements work for all supported Delphi IDEs, btw.

There is no release with these features yet. To get them, for now you have to compile your own GExperts dll which isn’t exactly rocket sciences anyway.

This idea is based on a question by Codehunter on the German Delphi board Delphi Praxis.

Using escape characters in GExperts Grep replace

 Delphi, GExperts  Comments Off on Using escape characters in GExperts Grep replace
Aug 262018
 

If you enable regular expressions in the GExperts Grep search form, you can search for escape sequences like \t which is expanded to a tab character or \x20 which is expanded to char($20), the space character.

Up to now it was not possible to use \t (and similar escape sequences) in the Grep replace dialog. They were not expanded properly but the \ was treated as escaping the character following it, meaning \t was replaced by a simple t character.

I changed that, so now the same escape characters that are allowed in the search expression are also allowed in the replace expression. Note though, that \x{nnnn} for Unicode characters is not supported, maybe I’ll add that later.)

This solves Bug #82.

I also removed the restriction, that you could not search for space character(s). (Bug #81)

A word of warning:
Please keep in mind, that the Grep Replace functionality is still pretty much experimental. It replaces literal characters, so it is probably not a good idea to replace ‘\r\n’ with “\n” only, it will break the editor. Also, be very careful with replacing matches in all files. It might completely destroy your source code as it also replaces matches in the dpr file and dfm files (I had to revert the full project using SubVersion the first time I tried it. I lost all my not committed changes because of that. You learn from your mistakes, especially when they hurt you like this.)

There is no release with this functionality yet, but you can always compile your own dll.

GNUGetText support for the GExperts Message Dialog expert

 Delphi, GExperts  Comments Off on GNUGetText support for the GExperts Message Dialog expert
Aug 182018
 

Based on an idea and partial implementation submitted by Sven Harazim from Landrix Software I have just added support for GNUGetText to the GExperts Message Dialog expert. It now looks like this:

And generates Code like this:

MessageDlg(_('first line'+#13#10+'second line'), mtWarning, [mbOK], 0);

Or, if you’d rather use the Windows API:

which generates code like this:

MessageBox(0, PChar(_('first line'+#13#10+'second line')), PChar(_('The Caption')), MB_ICONWARNING or MB_OK);

There are even two new configuration options:

Depending on the settings the code could look like any of this:

MessageDlg(_('first line'+#13#10+'second line'), mtWarning, [mbOK], 0);
MessageDlg(GetText('first line'+#13#10+'second line'), mtWarning, [mbOK], 0);
MessageDlg(_('first line')+#13#10+_('second line'), mtWarning, [mbOK], 0);
MessageDlg(GetText('first line')+#13#10+GetText('second line'), mtWarning, [mbOK], 0);

or this:

MessageBox(0, PChar(GetText('first line')+#13#10+GetText('second line')), PChar(GetText('The Caption')), MB_ICONWARNING or MB_OK);
MessageBox(0, PChar(_('first line')+#13#10+_('second line')), PChar(_('The Caption')), MB_ICONWARNING or MB_OK);
MessageBox(0, PChar(_('first line'+#13#10+'second line')), PChar(_('The Caption')), MB_ICONWARNING or MB_OK);
MessageBox(0, PChar(GetText('first line'+#13#10+'second line')), PChar(GetText('The Caption')), MB_ICONWARNING or MB_OK);

It also generates code for C++, but I have no idea whether it works:

MessageDlg(GetText("first line\nsecond line"), mtWarning, TMsgDlgButtons() << mbOK, 0);
MessageBox(0, GetText("first line\nsecond line"), GetText("The Caption"), MB_ICONWARNING|MB_OK);

I hope it will be useful for some. I myself don't use that expert at all.

There is no release with this feature yet. If you want to use it, you will have to compile your own DLL.

GExperts 1.3.11 experimental twm 2018-08-05 released

 Delphi, GExperts  Comments Off on GExperts 1.3.11 experimental twm 2018-08-05 released
Aug 052018
 

After the massive improvement to the Uses Clause Manager it’s time for another GExperts release.

New features include:

New features include:

There were also several bug fixes.

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.

Broken download links for GExperts 1.3.10

 Delphi, GExperts  Comments Off on Broken download links for GExperts 1.3.10
Aug 052018
 

No idea why nobody told me about this, but today I discovered that the download links for the GExperts 1.3.10 installers were broken due to a superfluous dash in the date part. It’s fixed now. I could have sworn that I tested those links when I released that version.

But before you now go to that download page: I have just released GExperts 1.3.11. Maybe you would prefer that one instead?

Improved Uses Clause Manager in GExperts

 Delphi, GExperts  Comments Off on Improved Uses Clause Manager in GExperts
Aug 042018
 

The Uses Clause Manager Expert in GExperts used to look like this:

While it was a very useful tool as it was, I have added to it quite a lot in the recent weeks:

Let’s start with the simple changes:

Interface and Implementation uses clauses are now visible at the same time. This allowed me to add buttons to delete from each and to move from one to the other. These Buttons also have corresponding popup menu entries and keyboard shortcuts that depend on the context:

  • Del always deletes from the currently focused list. This is also the default action executed with a double click (Actually it has always been the default action.).
  • Ctrl+M moves from the current list to the other
  • Ins adds the currently selected unit(s) to the favorite units list (also works in the Sarch Path, Project and VCL/RTL lists).
  • Ctrl+O opens the currently selected unit in the editor and closes the dialog
  • In addition to drag and drop from the available units lists to the uses lists it’s now also possible to drag and drop entries between the two uses lists.

There are also buttons to add or remove the dotted unit prefixes, e.g. they convert “Registry” to “System.Win.Registry” and vice versa.

Then there is an Open Unit button which can be used to open the currently selected unit in all lists.

Also, there is a new button to add all units from a list to the Favorite list. This list has become more important than it used to be, see below.

And last but not least there is a context menu entry to unalias all units. This means that it will replace units like WinTypes and WinProcs which have been declared as aliases to Windows for ages with their actual unit. The same goes for dbiTypes, dbiProcs and dbiErrs which will be replaced with BDE.

I have also replaced the ListViews with StringLists which makes the display much faster for large lists (see below) and allows me to distinguish between the currently selected item(s) in each list (dark gray) and the currently focused control (blue).

And now to the huge change:

It’s a new tab with a list of all identifiers that are declared in the interface sections of all units in your favorite list. Similar to the already existing filter for unit names it allows to filter for identifiers. In the screen shot, I typed “TWinControl” and the list was filtered down to just 7 of the several thousand entries. This is a replacement for the IDE feature Refactor -> Find Unit, but in contrast to that feature, it works (Find Unit fails for me in about 30% of all calls.). And of course it also works for the old IDEs which did not have that feature.

Btw.: Did you known that you can scroll within the lists while the focus in on the filter edit?

I plan to make a new release including these features later this weekend. So stay tuned!

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?

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.