home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.pascal
- 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
- From: pf@bilbo.bio.purdue.edu (Paul Furbacher)
- Subject: Re: Track double clicks in HandleEvent, etc.
- Message-ID: <BuDzKM.4DA@mentor.cc.purdue.edu>
- Sender: news@mentor.cc.purdue.edu (USENET News)
- Organization: Purdue University
- References: <SHEN.92Sep9131200@nil.IRO.UMontreal.CA>
- Distribution: comp.lang.pascal
- Date: Thu, 10 Sep 1992 23:50:45 GMT
- Lines: 64
-
- In article <SHEN.92Sep9131200@nil.IRO.UMontreal.CA>,
- shen@nil.IRO.UMontreal.CA (Yu Shen) wrote:
- asking ...
- > how to track mouse double clicks ...
-
- Peter Roth wrote in a follow-up article:
- > make sure you enable the event. Check the documentation for
- >'evXXXX'...
-
- Good advice, but a bit laconic.
-
- If your descendent object is derived from TView, it will recognize
- *evMouseDown*, evKeyDown, and evCommand (p. 308 TV Guide).
- Other descendents of TView may have modified the TView field called
- EventMask. As pointed out in the manual somewhere, if you want to
- change the status of the EventMask field, do the following:
- ...
- EventMask := EventMask or ...; { not + }
- ...
- in your derived Init() method.
-
- > And I don't quite understand the meaning of evMouseAuto. According to
- > TP Vision guide: periodic event while mouse button held down. But in
- > debugging, I noticed that after mouse button is released, there are
- > still endless evMouseAuto events.
-
- It seems to me that using the debugger to track evMouseAuto might be a
- little difficult to do. If you need evMouseAuto for the purpose of dragging
- a view ...
-
- > Anyway, I'd like to know how implement dragging a view by helding
- > mouse button.
-
- .. my question is why? All descendents of TView are draggable. Just set
- the DragMode field of your descendent in its Init() method (see page 307).
- As an example, while playing around with TMenuBox descendents,
- it was easy to set-up a draggable, always visible additional "toolbar".
- So, why re-invent the wheel. If your object is not a descendent in
- some manner of TView, you might want to redesign its ancestry.
-
- So as not to brush off the query of evMouseAuto, try constructing a loop
- in your event handler.
- ...
- repeat
- Play(880,100);
- delay(100);
- until not MouseEvent(Event, evMouseAuto);
- ...
-
- where Play() is
-
- procedure Play(Pitch, Duration: integer);
- begin
- Sound(Pitch); Delay(Duration); Nosound;
- end;
-
- It will be necessary to include "crt" as the first unit in your "uses" clause.
-
- Holding down the mouse button (assuming your descendent uses the
- standard EventMask of TView) should make some noise. Play() can be
- a useful debugging tool, in general.
-
- PF
-
-