Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to get rid of an hint? 2

Status
Not open for further replies.

pierrotsc

Programmer
Nov 25, 2007
358
US
I am trying to remove the dispplay in the message panel of an hint when I compile. It keeps telling me that the value assigned to ... never used.

I looked under the options but could not find this one.
Thanks.
 
So it looks like you cannnot just disable one hint. It's either all or none. Well, i guess i'll stick with it.
Thanks.
 
Aaron, i did find this article before I posted my request on the forum. The thing is I am not sure the hint is valid. In this case, it's telling me that the last 3 locatesuccess variable are not needed. Here's the code:

CurrentImage := ImageEnMView.ImageFileName[ImageEnMView.SelectedImage];
SearchOptions := [loPartialKey, loCaseInsensitive];

LocateSuccess := TableImages.Locate('ImagesPath', CurrentImage,
SearchOptions);

if LocateSuccess and (TableImages.FieldByName('ImagesCurve')
.AsString <> 'No Curve') then
begin
LocateSuccess := TableProjects.Locate('ProjectNo',
TableImages.FieldByName('ProjectNo').AsInteger, SearchOptions);
LocateSuccess := TableXtra.Locate('DataNo',
TableImages.FieldByName('DataNo').AsInteger, SearchOptions);
LocateSuccess := TableTrial.Locate('TrialNo',
TableImages.FieldByName('TrialNo').AsInteger, SearchOptions);
end;

As you can see, the last 3 locatesuccess variable are trying to find a record in a different table.

Maybe i am coding it the wrong way and Delphi is smarter than me...
 
The compiler is likely wondering what you are going to do with LocateSuccess after the code you show above.

In the code you supplied if you find the value you're looking for in the DataNo field but not in the TrialNo field then LocateSuccess will return false. I'm thinking that you want to return True is you find the value in any of those fields. If that is the case then you'll want something like:
Code:
  if LocateSuccess and (TableImages.FieldByName('ImagesCurve')
      .AsString <> 'No Curve') then
  begin
    LocateSuccess := TableProjects.Locate('ProjectNo',
      TableImages.FieldByName('ProjectNo').AsInteger, SearchOptions) or LocateSuccess;
    LocateSuccess := TableXtra.Locate('DataNo',
      TableImages.FieldByName('DataNo').AsInteger, SearchOptions) or LocateSuccess;
    LocateSuccess := TableTrial.Locate('TrialNo',
      TableImages.FieldByName('TrialNo').AsInteger, SearchOptions) or LocateSuccess;
  end;
 
Still get the hint...It is really not a big issue. Thanks...
 
Consider the following code:
Code:
  if true the begin
    a:= 1;
    a:= 2;
    a:= 3;
  end;

When exiting this if statement, the program can NEVER return values 1 or 2 for "a". "a" will ALWAYS equal 3.

I think this is what the compiler is telling you. (in BOTH examples)

Roo
Delphi Rules!
 
Got it...let me modify my code. I get what you are saying...
 
I fixed it. if i just add after each statement:
if locatesuccess then ;
the compiler has now used the variable...
Thanks...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top