Bugfix for Delphi IDE explorer in Delphi 10.3

 Delphi, DelphiIdeExplorer  Comments Off on Bugfix for Delphi IDE explorer in Delphi 10.3
Jul 272019
 

In December 2018 I found out that some of the functionality in my Delhi IDE explorer was broken in Delphi 10.3, namely the function to select the current active control or automatically follow the focus. The reason was that the IDE now used the Screen.ActiveControlChanged event itself, disabling it for to my plugin.

Today I finally found a way to fix it, so the current source code will work with Delphi 10.3 (all three releases).

 Posted by on 2019-07-27 at 14:49

Delphi IDE Explorer is broken in Delphi 10.3 Rio

 Delphi, DelphiIdeExplorer  Comments Off on Delphi IDE Explorer is broken in Delphi 10.3 Rio
Dec 092018
 

I just found out what is wrong with my Delphi IDE Explorer in Delphi 10.3 Rio. The symptom is that the Follow Focus option and the Select Active button no longer work in some forms, in particular in the options dialog (Tools -> Options / Run -> Parameters / Project -> Options). The reason is that this dialog now uses the Screen.OnActiveControlChange event itself and does not bother to call the original event. In previous Delphi versions it did not use this event. Delphi IDE Explorer hooks it to track the control that has the focus and provide the functionality mentioned above. It does call the original event though.

Interestingly the IDE restores the previous event when closing the options dialog so Delphi IDE Explorer gets back its functionality for other dialogs. Unfortunately that does not apply to the dialogs called from within the Options dialog.

Nobody at Embarcadero seems to have read my proposal about Safe event hooking for Delphi IDE plugins or maybe they chose to ignore it. (I guess the number of people who have read it can be counted on the fingers of one hand anyway 😉 )

I have to investigate whether there is any safe method to get my plugin work again. Until then, you will have to live without the Follow Focus feature.

 Posted by on 2018-12-09 at 16:00

New static page for my Delphi IDE Explorer expert

 Delphi, DelphiIdeExplorer  Comments Off on New static page for my Delphi IDE Explorer expert
Jul 012017
 

Since it became rather cumbersome to find the information on my Delphi IDE Explorer expert, which was scattered through multiple blog posts, I have now added a static page for it to my blog which I will keep up to date whenever I change anything in the expert. The sourceforge page now also points to this new page.

 Posted by on 2017-07-01 at 13:09

Delphi IDE Explorer Expert for Delphi 6 to 10.1 Berlin

 Delphi, DelphiIdeExplorer  Comments Off on Delphi IDE Explorer Expert for Delphi 6 to 10.1 Berlin
May 072016
 

I wrote this Delphi IDE Explorer Expert when I was trying find the button for showing and hiding the background for the Firemonkey mobile form designer and turn the bloody thing off for good.

Later, I ported it back to Delphi 2007 to 2010 and also added support for Delphi 10 Seattle.

Then I started improving GExperts (or actually made GExperts improve the Delphi IDE dialogs), so I needed it also for Delphi 6 to 2006.

Now I have added support for Delphi 10.1 Berlin. You can find the sources on SourceForge.

Oh, did I mention, that it accepts user input even if the IDE shows a modal dialog? Very useful feature.

DelphiIDEExplorer-for-Berlin

 Posted by on 2016-05-07 at 23:06

Enabling a form while another form is being shown modally

 Delphi, DelphiIdeExplorer  Comments Off on Enabling a form while another form is being shown modally
Apr 092016
 

There was one shortcoming in my Delphi IDE explorer that has irked me since the beginning: It was disabled while a modal dialog was shown in the IDE, so there was no way to inspect the controls on the current dialog. The option to follow the focus ameliorated this a bit because it was now possible to click on the various controls in the dialog and see their properties, but still: There was no way to inspect non-clickable controls and how they were related to other controls on the form or to switch the different pages showing the properties, events, hierarchy or parents of the current control.

Delphi-Ide-Explorer-with-modal-form

(Click on the picture to see an animation how it works.)

Today, I remembered that I had asked a question on StackOverflow a few days ago: Why do modal Delphi forms not receive WM_SYSCOMMAND when the user clicks the task bar button?

In his answer David Heffernan mentioned the Windows API function EnableWindow and that it is being used by the VCL to disable all windows of an application when one of them is shown modally (and re-enable them afterwards). He explicitly warned me to meddle with that “The consequences are somewhat dire.”.

But being who I am, could of course not resist trying it anyway.

When I asked that question it was about a program at work that was showing a modal progress form which I wanted to allow to minimize the application and restore it when the user clicks on the task bar button. It did not work because the WM_SYSCOMMAND message never reached the program while the modal form was active. I worked around this by re-enabling the main window when the application was minimized (so it would receive the WM_SYSCOMMAND message again), and disabling it again once it got restored. It worked, and so far I have not seen any problems with that approach (but that might still be in store for me).

Today, I used a similar approach to enable the IDE explorer window while a modal form is active in the IDE. My first try was a TTimer that every second called EnabledWindow(Self.Handle, True). While this worked, I thought it might be a bit excessive to call that API every second, so I looked for a better place to put this code. How can a plugin be notified when a modal dialog is being shown? It turned out to be quite easy: Hook Screen.OnActiveFormChange, something I have done before.

And lo and behold: It works and again I have not yet experienced any problems with that approach.

EDIT:
As Ondrej Kelle pointed out in his comment on my Google+ post:

Watching for WM_ENABLE with wParam = 0 in your explorer form, checking if Application.ModalLevel > 0 (meaning a ShowModal call is currently executing), and re-enabling yourself might work, too, and you could avoid the Screen.OnActiveFormChange event hook. (Just an idea.)ï»ż

He even provided an implementation for this:

/// [...]
interface
/// [...]
type
  TForm1 = class(TForm)
    /// [...]
  private
   procedure WMEnable(var _Msg: TWMEnable); message WM_ENABLE;
   /// [...]
  end;
/// [...]
implementation
/// [...]
procedure TExplorerForm.WMEnable(var _Msg: TWMEnable);
begin
  inherited;
  if not _Msg.Enabled and (Application.ModalLevel > 0) then
    EnableWindow(Self.Handle, True);
end;

And yes, it works. One hook less is good. Thanks Ondrey!

 Posted by on 2016-04-09 at 20:27

Delphi IDE Explorer Expert for Delphi 2007 – 10 Seattle

 Delphi, DelphiIdeExplorer  Comments Off on Delphi IDE Explorer Expert for Delphi 2007 – 10 Seattle
Sep 252015
 

I wrote this Delphi IDE Explorer Expert when I was trying find the button for showing and hiding the background for the Firemonkey mobile form designer and turn the bloody thing off for good.

Now I have ported it to all Delphi versions from 2007 to 10 Seattle. You can find the sources on SourceForge.

 Posted by on 2015-09-25 at 19:55

Delphi IDE Explorer Expert for Delphi XEx

 Delphi, DelphiIdeExplorer  Comments Off on Delphi IDE Explorer Expert for Delphi XEx
Jun 012014
 

Based on a similar expert by David Hoyle for Delphi 3/4/5, which I found on Embarcadero CodeCentral, I have written the Delphi IDE Explorer Expert for Delphi XE .. XE6. It is a package based expert that installs into the Delphi IDE and displays its internal component structure.

The original purpose was to find the button for showing and hiding the background for the Firemonkey mobile form designer and turn the bloody thing off for good. Unfortunately I could not find that form and that button, so I assume it’s not written with the VCL but itself a Firemonkey form.

Here are some screenshots of the expert:

Display Properties

Display Events

Display Inheritance

The tree view on the left side displays the hierarchy of the components as it is available via the global VCL Screen object. the right side shows the properties, events and inheritance of the selected component.

Filter Dialog

The expert also allows to filter for specific class types, e.g all TAction, TActionList etc. objects.

The full source code is available from SourceForge.

Please note: The package for Delphi XE3 is actually a Delphi XE2 package for now. I cannot start XE3 because for some reason it thinks it isn’t registered. Did I mention I hate the forced online activation?

Edit: Apparently I am not only the second but at least the third who wrote such an expert. Rudy Velthuis also did it.

 Posted by on 2014-06-01 at 16:21