home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / sys / mac / hypercar / 2857 < prev    next >
Encoding:
Internet Message Format  |  1992-07-22  |  3.6 KB

  1. Xref: sparky comp.sys.mac.hypercard:2857 comp.sys.mac.misc:13636 comp.sys.mac.apps:12299
  2. Path: sparky!uunet!stanford.edu!rutgers!cmcl2!acfcluster.nyu.edu!drennan
  3. From: drennan@acfcluster.nyu.edu (XIXAX)
  4. Newsgroups: comp.sys.mac.hypercard,comp.sys.mac.misc,comp.sys.mac.apps
  5. Subject: Re: Supercard: Dragging objects in Browse mode
  6. Message-ID: <1992Jul22.235205.1@acfcluster.nyu.edu>
  7. Date: 23 Jul 92 04:52:05 GMT
  8. References: <1992Jul21.143452.12628@news.cs.brandeis.edu>
  9. Sender: notes@cmcl2.nyu.edu (Notes Person)
  10. Organization: New York University
  11. Lines: 89
  12. Nntp-Posting-Host: acf1.nyu.edu
  13.  
  14. In article <1992Jul21.143452.12628@news.cs.brandeis.edu>, slanka@chaos.cs.brandeis.edu (Ishantha Lokuge) writes:
  15. > Hello!
  16. > I've written script to drag a graphic object while in Browse mode
  17. > but the speed is quite slow and there is a time lag between the mouse moving
  18. > and the graphic moving. I do the following:
  19. > On mouseStilldown
  20. >    Global X,Y    /* Displacement of object to mouse loc*/
  21. >    put mouseH() - X into X1
  22. >    put mouseV() - Y into Y1
  23. >    move graphic ZZZ to X1,Y1 jump 1
  24. > End MouseStilldown
  25. > I would greatly appreciate if anyone out there has a better soulution
  26. > for moving quite complex (grouped) graphic objects fast, while the mouse
  27. > is down and is moving. Thanks a lot for any suggestions.
  28. > -Ishantha.
  29.  
  30. Ishantha,
  31.  
  32. First, you are discovering why the Apple user interface suggests that we drag
  33. the outline of the object around instead, or the outline of the enclosing
  34. rectangle, the way the Finder does.
  35.  
  36. On older and slower Macs, even dragging an icon graphic in real-time would be
  37. slow and sluggish.
  38.  
  39. Your method of dragging is one of a variety of possibilities. 
  40.  
  41. Another approach, which would speed things up, would be to go into a loop and
  42. stay there while the graphic is being dragged. Your current method takes on
  43. the overhead of handling idle messages, and invoking XCMDs, between every
  44. movement.
  45.  
  46. Try something like this...  (off the top of my head)
  47.  
  48. --------------------------------------------------
  49.  
  50. on mouseDown
  51.   -- Calculate the diff between the cursor
  52.   --   and the center of the graphic.
  53.  
  54.   put item 1 of the loc of grc bigGraphic - 
  55.       item 1 of the mouseLoc into xOffset
  56.   put item 2 of the loc of grc bigGraphic - 
  57.       item 2 of the mouseLoc into yOffset
  58.  
  59.   -- Loop continuously
  60.  
  61.   repeat until the mouse is up
  62.     set the loc of grc bigGraphic to 
  63.       item 1 of the mouseLoc + xOffset,
  64.       item 2 of the mouseLoc + yOffset
  65.   end repeat
  66.  
  67. end mouseDown
  68. --------------------------------------------------
  69.  
  70. I'm sure I probably have the plusses and minuses reversed, knowing Murphy's
  71. Law.:)
  72.  
  73. Also, when it comes to mouseDown actions, such as dragging the grow box of a
  74. window, or pulling down a menu, it is common for any software to go into a
  75. loop which consumes all of the processor, and does not give any time to any
  76. other task or processes.  This helps speed the responsiveness. Most mouseDown
  77. actions are very brief.
  78.  
  79. Should you decide to try dragging the enclosing rectangle instead, you can
  80. use the DragRect external from the "Support Tools Externals 1.2.5" stack from
  81. Apple, or FullDrag from Rinaldi, or others I have seen.
  82.  
  83. I think another method is available. When we are in the "edit" mode in
  84. SuperCard, and we drag around a complex draw graphic, SuperCard automatically
  85. draws the gray outlines of all the objects, to aid the visual positioning of
  86. the graphic. There is a way to invoke that same action under script control. 
  87.  
  88. Unfortunately, I don't have the opportunity to try it out for you to make
  89. sure I'm not dreaming. :)
  90.  
  91. Hope this helps.
  92.  
  93. Mark Hanrek
  94. America Online SuperCard SIG Leader
  95. hanrekm@aol.com
  96.