Solved

Why does Autcomplete work for assignemt (a:=b) but not for comparison (a=b)?

Posted on 2004-09-17
4
138 Views
Last Modified: 2010-04-05




If I'm using AutoComplete (or code sense? ) where it gives a list of
possible variables that can complete a command:

If I am making an ASSIGNMENT (Varabile:=....) then auto complete works
with sys constants like clRed, etc.

If I am making a COMPARISON (if Variable=...) then ac does NOT work with
clRED, vk_RETURN, etc.

Anyone know why this is?

TIA!

0
Comment
Question by:clay111296
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 17

Accepted Solution

by:
Wim ten Brink earned 50 total points
ID: 12089157
Probably because the just-in-time compilation isn't as smart as the real compiler. If you use a writeln statement to write to a text file, you could notice something similar. The problem is probable that Delphi just can't determine what variable or type would be valid in this location.
0
 

Author Comment

by:clay111296
ID: 12098770
So, are you saying that the compiler is smarter about ASSIGNMENT statments than it is about COMPARISON statements?

Also, I've tried defining a variable as ColorRef so the compiler KNOWS the variable data type.


EXAMPLE:
var
  clColor: COLORREF;

  begin
  clcolor:=clBlue;  //ON THIS LINE I *DO* GET AUTOCOMPLETE HELP

  if clColor=xy then ShowMessage('it worked');  //ON THIS LINE I DO *NOT* GET AUTOCOMPLETE HELP.

AND YET, I DON'T GET AUTO COMPLETE HELP AFTER THE "=" SIGN.


WORKS IN D6 BUT NOT IN DELPHI 8.

This may be due to an addin called Castalia. Need to test more.


0
 
LVL 17

Expert Comment

by:Wim ten Brink
ID: 12100233
Yep, the compiler is smarter with ASSIGNMENTS because it knows which type to expect. With comparisons, it's a bit more complicated.

Hmmm. Maybe it's related because in your example, one variable is called "Varabile" and the other is called. "Variable". ;-)

I have tried in Delphi 5, though. Code completion with comparisons are a bit mixed up. I could get the Autocomplete combobox bt pressting <CTRL><SPACE> but eben then it does not find the clBlue or other color constant that I want.

The reason seems to be that the background compiler has less problems with assignments than comparisons. That''s all, it seems.
0
 

Author Comment

by:clay111296
ID: 12103643

Further testing with D7


if I do :
clColor=clR     >>>> I get  choices that autocomplete it (clRed, etc.)

If I do
IF clColor=clR  >>>>  I do NOT get choices that autcomplete.

In Delphi 8 (for .net)
I get choices in both cases.

CASTALIA NOT THE CAUSE
Same results with or without Castalia.

0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question