home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / lang / pascal / 5310 < prev    next >
Encoding:
Text File  |  1992-09-10  |  2.7 KB  |  77 lines

  1. Newsgroups: comp.lang.pascal
  2. Path: sparky!uunet!europa.asd.contel.com!darwin.sura.net!spool.mu.edu!news.nd.edu!mentor.cc.purdue.edu!pf@bilbo.bio.purdue.edu
  3. From: pf@bilbo.bio.purdue.edu (Paul Furbacher)
  4. Subject: Re: Track double clicks in HandleEvent, etc.
  5. Message-ID: <BuDzKM.4DA@mentor.cc.purdue.edu>
  6. Sender: news@mentor.cc.purdue.edu (USENET News)
  7. Organization: Purdue University
  8. References: <SHEN.92Sep9131200@nil.IRO.UMontreal.CA>
  9. Distribution: comp.lang.pascal
  10. Date: Thu, 10 Sep 1992 23:50:45 GMT
  11. Lines: 64
  12.  
  13. In article <SHEN.92Sep9131200@nil.IRO.UMontreal.CA>, 
  14.   shen@nil.IRO.UMontreal.CA (Yu Shen) wrote:
  15. asking ...
  16. > how to track mouse double clicks ...
  17.  
  18. Peter Roth wrote in a follow-up article: 
  19. > make sure you enable the event. Check the documentation for
  20. >'evXXXX'... 
  21.  
  22. Good advice, but a bit laconic.  
  23.  
  24. If your descendent object is derived from TView, it will recognize
  25. *evMouseDown*, evKeyDown, and evCommand (p. 308 TV Guide).
  26. Other descendents of TView may have modified the TView field called
  27. EventMask.  As pointed out in the manual somewhere, if you want to 
  28. change the status of the EventMask field, do the following:
  29.   ...
  30.   EventMask := EventMask or ...;  { not + }
  31.   ...
  32. in your derived Init() method.
  33.  
  34. > And I don't quite understand the meaning of evMouseAuto. According to
  35. > TP Vision guide: periodic event while mouse button held down. But in
  36. > debugging, I noticed that after mouse button is released, there are
  37. > still endless evMouseAuto events.
  38.  
  39. It seems  to me that using the debugger to track evMouseAuto might be a
  40. little difficult to do.  If you need evMouseAuto for the purpose of dragging 
  41. a view ...
  42.  
  43. > Anyway, I'd like to know how implement dragging a view by helding
  44. > mouse button.
  45.  
  46. .. my question is why?  All descendents of TView are draggable.  Just set
  47. the DragMode field of your descendent in its Init() method (see page 307).
  48. As an example, while playing around with TMenuBox descendents, 
  49. it was easy to set-up a draggable, always visible additional "toolbar".  
  50. So, why re-invent the wheel.  If your object is not a descendent in 
  51. some manner of TView, you might want to redesign its ancestry.
  52.  
  53. So as not to brush off the query of evMouseAuto, try constructing a loop
  54. in your event handler.
  55.   ...
  56.   repeat
  57.     Play(880,100);
  58.     delay(100);
  59.   until not MouseEvent(Event, evMouseAuto);
  60.   ...
  61.  
  62. where Play() is
  63.  
  64.   procedure Play(Pitch, Duration: integer);
  65.   begin
  66.     Sound(Pitch); Delay(Duration); Nosound;
  67.   end;
  68.  
  69. It will be necessary to include "crt" as the first unit in your "uses" clause. 
  70.  
  71. Holding down the mouse button (assuming your descendent uses the 
  72. standard EventMask of  TView) should make some noise.  Play() can be
  73. a useful debugging tool, in general.
  74.  
  75. PF
  76.  
  77.