Page 1 of 1

keeping the boundaries of an img to the outside of the stack

Posted: Wed May 28, 2014 8:27 pm
by magice
Ok here is my situation. At work one of my data entry people has to upload and organize 1200-1500 pictures daily. This process was working well while she was on a windows xp machine. Now they have upgraded her to Windows 7, and the photo viewer opens a new window every time she clicks to look at a picture. This results in hundreds of windows open or lots of clicking to close them. Having been unable to find a suitable viewer to replace Photo Viewer, I decided to write one that works the way we need it to. I have everything working, but i want to make a few tweeks. Specifically, I want the boundaries of the image to stay outside of the window when moved. The code I have for moving the image is as follows.

Code: Select all

on mouseDown
   set the lockcursor to false
   set the cursor to hand
   set the lockcursor to true
   put the first item of the mouseLoc into tWOff
   put the second item of the mouseLoc into tHOff
   put the first item in the loc of img "Image" into tWI
   put the second item in the loc of img "Image" into tHI
   put tWI - tWOff  into tWI
   put tHi -tHOff into tHi
   put true into tMouseD
end mouseDown
on mouseUp
   set the lockcursor to false
   set the cursor to arrow
   set the lockcursor to true
   put false into tMouseD
end mouseUp
on mouseMove tX tY
   if tMouseD
   then
      set the loc of image "image" to (tWI + tX), (tHI + tY)
   end If
end mouseMove
As you can see, when the image is larger than the stack, for instance when it is zoomed, the image can be dragged off the stack. How can I keep the left of the image to the left of the stack, top of the image above the top of the stack etc. without hindering motion in other directions and while preserving image aspect ratio.

Re: keeping the boundaries of an img to the outside of the s

Posted: Wed May 28, 2014 10:44 pm
by Simon
Hi magice,
Isn't this a case for a scrolling group?
http://lessons.runrev.com/m/4071/l/4442 ... chitecture
Maybe I missed something.

Simon

Re: keeping the boundaries of an img to the outside of the s

Posted: Thu May 29, 2014 2:54 am
by keram
Hi magice,

I don't want to counteract the joy of creating your own app, but just in case... FastStone Image Viewer may be what you need - ready to use. http://www.faststone.org/FSViewerDetail.htm

keram

Re: keeping the boundaries of an img to the outside of the s

Posted: Thu May 29, 2014 3:33 pm
by magice
Thank you both. Simon your method works fine. layerMode is fairly new, and it is not something I have run into before. it is exactly what I needed.