Hi RIchard,

The following script comes from my Snapper project <http://snapper.economy-x-talk.com >, which has exactly such a selection area. You'll need an object, e.g. a transparent button, containing this script and an image named "Selection".

on mouseDown
  put the mouseLoc into myLoc
  set the cursor to cross
  repeat until the mouse is up
    put the mouseLoc into myNewLoc
    put quadrant(myLoc,myNewLoc)
    switch quadrant(myLoc,myNewLoc)
    case 1
      put item 1 of myLoc & comma & item 2 of myNewLoc into myTL
      put item 1 of myNewLoc & comma & item 2 of myLoc into myBR
      break
    case 2
      put myLoc into myBR
      put myNewLoc into myTL
      break
    case 3
      put item 1 of myLoc & comma & item 2 of myNewLoc into myBR
      put item 1 of myNewLoc & comma & item 2 of myLoc into myTL
      break
    case 4
      put myLoc into myTL
      put myNewLoc into myBR
      break
    end switch
if item 1 of myBR > the right of me then put the right of me into item 1 of myBR if item 2 of myBR > the bottom of me then put the bottom of me into item 2 of myBR if item 1 of myTL < the left of me then put the left of me into item 1 of myTL if item 2 of myTL < the top of me then put the top of me into item 2 of myTL
    put myTL & comma & myBR into myRect
    if myRect is a rect then
      set the rect of grc "Selection" to (myTL & comma & myBR)
    end if
  end repeat
  set the cursor to arrow
end mouseDown

function quadrant theOldLoc,theNewLoc
if item 1 of theNewLoc > item 1 of theOldLoc and item 2 of theNewLoc < item 2 of theOldLoc then
    return 1
else if item 1 of theNewLoc< item 1 of theOldLoc and item 2 of theNewLoc < item 2 of theOldLoc then
    return 2
else if item 1 of theNewLoc < item 1 of theOldLoc and item 2 of theNewLoc > item 2 of theOldLoc then
    return 3
else if item 1 of theNewLoc > item 1 of theOldLoc and item 2 of theNewLoc > item 2 of theOldLoc then
    return 4
  end if
  return 0
end quadrant


Best regards,

Mark Schonewille

--

Economy-x-Talk Consulting and Software Engineering
http://economy-x-talk.com
http://www.salery.biz

Convert colours between different colour spaces with Color Converter. Download at http://economy-x-talk.com/cc.html



On 2 mrt 2008, at 00:04, R. Hillen wrote:

Hello,

I want to select in an application an rectangle area of an image by dragging the mouse from one edge to another, whereby the selected rectangle is visualized.

As I have no idea how to do it, all tips are welcome! May you help?
Thank you!

Richard.
_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to