Results 1 to 4 of 4

Thread: CorrectBox

  1. #1
    Join Date
    Dec 2009
    Location
    Newcastle, Australia
    Posts
    888
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default CorrectBox

    This procedure swaps x1 and x2 and/or y1 and y2 so that the 1 values are less than the 2 values, and as such form a correct box, cause if the 2nd value is larger than the 1st it doesn't work.

    SCAR Code:
    Procedure CorrectBox(var Box:TBox);
    var
      TPnt:TPoint;
    begin
      if Box.X1 > Box.X2 then
      begin
        TPnt.X := Box.X1;
        Box.X1 := Box.X2;
        Box.X2 := TPnt.X
      end;
        if Box.Y1 > Box.Y2 then
      begin
        TPnt.Y := Box.Y1;
        Box.Y1 := Box.Y2;
        Box.Y2 := TPnt.Y
      end;
    end;

  2. #2
    Join Date
    Jan 2010
    Posts
    5,227
    Mentioned
    6 Post(s)
    Quoted
    60 Post(s)

    Default

    I think this could be shortened with try..except? Nifty idea, though.

  3. #3
    Join Date
    Jan 2007
    Posts
    8,876
    Mentioned
    123 Post(s)
    Quoted
    327 Post(s)

    Default

    I know Simba already does that in some places if not all

  4. #4
    Join Date
    Jul 2007
    Location
    Right now? Chair.
    Posts
    8,488
    Mentioned
    3 Post(s)
    Quoted
    12 Post(s)

    Default

    Quote Originally Posted by Zyt3x View Post
    I know Simba already does that in some places if not all
    Exactly. Instead of repeating it all over the place, have a function for it

    ~RM

    I & I know Zion. It is in the spirit, body and mind of every one of us
    RMouse(obj: TMSIObject): boolean;

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •