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 / 7895
7894  |  7896
Subject: 
Re: Can some give me a hand on delphi?
Newsgroups: 
lugnet.cad
Date: 
Thu, 9 May 2002 12:51:56 GMT
Viewed: 
797 times
  
In lugnet.cad, Roland Melkert writes:
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
    image1.Picture.LoadFromFile('house\house1r.bmp');
    label1.Caption:=('Spot 1 right');
  end
  else
    if (label1.Caption = 'Spot 1 right') .....


I think I'll use the big IF for now as I don't know how to do the other way
thanks a lot.


Furthermore you could play with const array's to store the filename and
label names so you can access them via numbers whom are useable via case
and can reduce the source further, but will make it more diffacult to read.

Roland


Eduardo Vazquez Harte wrote:

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 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 is in Reply To:
  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 (...) (23 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