source: trunk/SRC/ToBeReviewed/WIDGET/AUTOUR_de_XXX/identifyclick.pro @ 325

Last change on this file since 325 was 325, checked in by pinsard, 16 years ago

modification of some headers (+some corrections) to prepare usage of the new idldoc

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.5 KB
Line 
1;+
2;
3; @file_comments
4;
5; @categories
6;
7; @param EVENT
8;
9; @returns
10;
11; @uses
12;
13; @restrictions
14;
15; @examples
16;
17; @history
18;
19; @version
20; $Id$
21;
22; @todo
23; seb
24;
25;-
26FUNCTION identifyclick, event
27;
28  compile_opt idl2, strictarrsubs
29;
30   widget_control, event.id, get_uvalue=uval, /no_copy
31   thisEvent = TAG_NAMES(event, /Structure)
32   if thisEvent EQ 'WIDGET_TIMER' then press = 0 ELSE press = event.press
33;
34;  d/0/>1 -------->t/1/0--------->**d/2/0**    long click
35;         -------->d/1/0--------->**t/2/0**  normal click
36;                       --------->**d/2/>1**-------->d/3/0----->t/0/0  double click
37;                                           -------->t/3/0----->d/0/0  double click
38   type = 'inutile'
39   case 1 OF
40; d/0/0 1er reascending
41      thisEvent EQ 'WIDGET_DRAW' AND uval.click EQ 0 AND press EQ 0:
42; d/0/>1 1er click of the series
43      thisEvent EQ 'WIDGET_DRAW' AND uval.click EQ 0 AND press ge 1:BEGIN
44         uval.x = [event.x, 0]
45         uval.y = [event.y, 0]
46         uval.press = press
47         uval.click = 1
48         widget_control, event.id, timer = .3
49      END
50; d/1/0 1er reascending
51      thisEvent EQ 'WIDGET_DRAW' AND uval.click EQ 1 AND press EQ 0:uval.click = 2
52; d/2/0 End of the long click
53      thisEvent EQ 'WIDGET_DRAW' AND uval.click EQ 2 AND press EQ 0:BEGIN
54         type = 'long'
55         uval.x = [uval.x[0],event.x] & uval.x = uval.x[sort(uval.x)]
56         uval.y = [uval.y[0],event.y] & uval.y = uval.y[sort(uval.y)]
57         uval.click = 0
58         uval.press = event.release
59      END
60; d/2/>1
61      thisEvent EQ 'WIDGET_DRAW' AND uval.click EQ 2 AND press ge 1:BEGIN
62         type = 'double'
63         uval.press = press
64         uval.click = 3
65      END
66; d/3/0 reascending and end of the double click
67      thisEvent EQ 'WIDGET_DRAW' AND uval.click EQ 3 AND press EQ 0:uval.click = 0
68; t/0/0 End of the double click
69      thisEvent EQ 'WIDGET_TIMER' AND uval.click EQ 0 AND press EQ 0:
70; t/1/0 long click
71      thisEvent EQ 'WIDGET_TIMER' AND uval.click EQ 1 AND press EQ 0:uval.click = 2
72; t/2/0 normal click
73      thisEvent EQ 'WIDGET_TIMER' AND uval.click EQ 2 AND press EQ 0:BEGIN
74         type = 'single'
75         press = uval.press
76         uval.click = 0
77      END
78; t/3/0 End of the double click
79      thisEvent EQ 'WIDGET_TIMER' AND uval.click EQ 3 AND press EQ 0:uval.click = 0
80; Impossible case in theory:
81      ELSE:BEGIN
82         print, thisEvent, uval.click, press
83         print, 'Probleme, cas normalement impossible!'
84      END
85   endcase
86
87   widget_control, event.id, set_uvalue=uval, /no_copy
88   return, {type:type}
89end
Note: See TracBrowser for help on using the repository browser.