To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.cadOpen lugnet.cad in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 CAD / 7892
7891  |  7893
Subject: 
Can some give me a hand on delphi?
Newsgroups: 
lugnet.cad
Date: 
Thu, 9 May 2002 11:06:54 GMT
Viewed: 
399 times
  
Hello,

After making the my first interactive demo I notice that the are too many
IF and too much code for a simple project so I whould like to know
how to make this if in to a " CASE " you know all a case x of .
Well here is the if.

...............................................................
if (X > 280) and (Y > 20) and (X < 320) and (Y < 220)
and (label1.Caption = 'Spot 1 front') then
begin
  image1.Picture.LoadFromFile('house\house1r.bmp');
  label1.Caption:=('Spot 1 right');
end
else
if (X > 280) and (Y > 20) and (X < 320) and (Y < 220)
and (label1.Caption = 'Spot 1 right') then
begin
  image1.Picture.LoadFromFile('house\house1b.bmp');
  label1.Caption:=('Spot 1 back');
end
else
if (X > 280) and (Y > 20) and (X < 320) and (Y < 220)
and (label1.Caption = 'Spot 1 back') then
begin
  image1.Picture.LoadFromFile('house\house1l.bmp');
  label1.Caption:=('Spot 1 left');
end
  else
if (X > 280) and (Y > 20) and (X < 320) and (Y < 220)
and (label1.Caption = 'Spot 1 left') then
begin
  image1.Picture.LoadFromFile('house\house1f.bmp');
  label1.Caption:=('Spot 1 front');
end
...............................................................

If is not possible to make if in to a case the how can a reduce the code?
Thanks

FTP is on until
24:00 spanish night time
ftp://ldraw:ldraw@217.127.145.136:20202/



Message has 2 Replies:
  Re: Can some give me a hand on delphi?
 
You could make one big if for the (X > 280) and (Y > 20) and (X < 320) and (Y < 220) because that's the same for all. if (X > 280) and (Y > 20) and (X < 320) and (Y < 220) then if (label1.Caption = 'Spot 1 front') then begin (...) (22 years ago, 9-May-02, to lugnet.cad)
  Re: Can some give me a hand on delphi?
 
Also I think this is more an .cad.dev question. Roland (...) (22 years ago, 9-May-02, to lugnet.cad)

4 Messages in This Thread:


Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR