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

Last change on this file since 150 was 150, checked in by navarro, 18 years ago

english and nicer header (3a)

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