views:

120

answers:

1

I'm just wondering if anyone else has come across this rather obtuse error. I have a procedure that looks loosely like this:

procedure dostuff();
begin
  if session_started = true then // global var
  begin
   // do bunch of calculations
   // goes on for a while
   // then at the end we enable the save button 
   save_score.enabled := true; // save_score is a tbutton - nothing special about it!
  end;
end;

With that declaration the structure view tells me that 'TButton' does not contain a member named 'Enabled' at line 4499. But the code compiles and executes just fine! And if I do it this way:

procedure dostuff();
begin
  if session_started = true then // global var
  begin
    // do bunch of calculations
    // goes on for a while
    // then at the end we enable the save button 
    with save_score do
    begin
      enabled := true;
    end;
  end;

end;

Then I get no complaint from the viewer and it still compiles.

So anyone know what the deal is here? It's not earth shattering by any means, but its just weird that it would complain about such a seemingly innocuous piece of code.

A: 

This feature is called "Error Insight": it is supposed to show you errors in your source code before you do a compile.
You can see the nodes corresponding to the errors in the "Structure" viewer (Press Shift+Alt+F11 to show it).

From the beginning, Error Insight has been buggy.
Nowadays it is less buggy than it used to, but still.

Some things in the Delphi IDE depend on Error Insight, and suffer from these bugs too.
For instance some of the built-in refactor possibilities don't work when error insight thinks the underlying code is in error.

You can disable Error Insight, but that doesn't solve some of the dependencies (i.e. the refactorings still don't work, but now you can't see a priori).

That is one of the reasons like ModelMaker Code Explorer (MMX) so much.
MMX is a cheap Delphi extension that has a ton of refactor actions that just work.

--jeroen

Jeroen Pluimers
Ok, so it's an error in the ide. Error insight in this case. Thanks for the tips.
Rafe