home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / sys / mac / oop / macapp3 / 204 < prev    next >
Encoding:
Internet Message Format  |  1992-12-15  |  3.2 KB

  1. Path: sparky!uunet!stanford.edu!apple!applelink.apple.com
  2. From: D1950@AppleLink.Apple.COM (STM Systems Corp, Don Phillips,PRT)
  3. Newsgroups: comp.sys.mac.oop.macapp3
  4. Subject: MacApp 2 to 3 - Dble Clicking
  5. Message-ID: <724456333.4569782@AppleLink.Apple.COM>
  6. Date: 15 Dec 92 21:31:00 GMT
  7. Sender: daemon@Apple.COM
  8. Organization: AppleLink Gateway
  9. Lines: 108
  10.  
  11.  
  12.  
  13.  
  14. Background :
  15.  
  16. We are currently converting our applications from MacApp 2.0 to 3.0 using
  17. Object Pascal. Our plans are to convert to 3.0 now and then convert to C++ at a
  18. future time.
  19.  
  20. Problem:
  21.  
  22. The conversion has become very difficult since I can't test any changes that I
  23. make until I finish converting everything. Its also difficult when the original
  24. code was written by someone not working for us anymore.
  25.  
  26. I'm currenlty confused on how to double click on an item list view.
  27.  
  28. Scenario:  We have a list of items and need to know if a double click occurred.
  29.    Therefore we are looking for a double click within a certain period
  30.    of time and within the same pixel location.
  31.    I've noticed that many of the global variables used no longer
  32.    exist in 3.0 (ie. gLastClickPart, gClickCount .. )
  33.    I also noticed that the parameters have changed.
  34.  
  35.    Is there an easier way to detect double clicking within a certain
  36.    area using 3.0.
  37.  
  38.     Below is the old code that I'm currently looking at.
  39.    I hope this is enough information for you.
  40.  
  41.  
  42. *****************************************************************************
  43. FUNCTION TTTextListView.DoMouseCommand( VAR theMouse : Point;
  44.    VAR info : EventInfo; VAR hysteresis : Point) :TCommand; OVERRIDE;
  45.  
  46. VAR
  47.    whereMouseDown  : INTEGER;
  48.    aWMgrWindow : windowPtr;
  49.    tmpDialogView   : TTTextDialogView;
  50.    aRow, aCol  : INTEGER;
  51.    aCellSelectCommand  : TTCellSelectCommand;
  52.  
  53. BEGIN
  54.  
  55.    DoMouseCommand := INHERITED DoMouseCommand( theMouse, info, hysteresis );
  56.  
  57.    WITH info, thePEvent^ DO
  58.    BEGIN
  59.    IF thePEvent^.what = mousedown THEN
  60.    BEGIN
  61.    tmpDialogView := TTTextDialogView( SELF.GetParentView );
  62.    tmpDialogView.DeSelectInEverythingBut( SELF );
  63.  
  64.    whereMouseDown := FindWindow( where, aWMgrWindow );
  65.    IF SELF.DoubleClick( thePEvent, whereMouseDown, theMouse  ) THEN
  66.    SELF.ffDoubleClick := TRUE
  67.    ELSE
  68.    SELF.ffDoubleClick := FALSE;
  69.    END;
  70.    END;
  71. END;
  72.  
  73. *****************************************************************************
  74. FUNCTION TTTextListView.DoubleClick( aPDownEvent: PEventRecord;
  75.    whereMouseDown: INTEGER; theMouse : Point ) : BOOLEAN;
  76.  
  77.    VAR
  78.    clickCount: INTEGER;
  79.  
  80. BEGIN
  81.    clickCount := 1;
  82.  
  83.    WITH aPDownEvent^ DO
  84.    BEGIN
  85.  
  86.    IF whereMouseDown = gLastClickPart THEN
  87.  
  88.    IF gClickCount > 0 THEN
  89.    { not the first click and ... }
  90.  
  91.    IF when - gLastUpTime < GetDblTime THEN
  92.    { ... close enough in time and ... }
  93.  
  94.    IF SELF.FirstSelectedItem = SELF.GetItemClicked( theMouse ) THEN
  95.    { If this second click is on the same item as the first click }
  96.    clickCount := gClickCount;
  97.  
  98.    gLastMsePt := where;
  99.    END;
  100.  
  101.  
  102.    { Consider just the even clicks = 2, 4, 6, etc }
  103.    IF ( ( clickCount MOD 2 ) = 0 ) THEN
  104.    DoubleClick := TRUE
  105.    ELSE
  106.    DoubleClick := FALSE;
  107.  
  108. END;
  109. *****************************************************************************
  110.  
  111.  
  112.  
  113. Any guidance would be appreciated.
  114.  
  115. Ett DiNardo
  116. ISM Corp.
  117. AppleLink : D1950
  118.  
  119.