Project

General

Profile

6013-mouse-click.p

Vladimir Tsichevski, 03/14/2022 11:35 AM

Download (1.88 KB)

 
1
// Test for #6013 issue scenario for MOUSE-CLICK event.
2

    
3
// In this program two rectangle widgets are DEFINEd: 'outerRect' and 'innerRect'.
4
// The 'innerRect' is located inside the 'outerRect' and overlaps it almost entirely.
5
// The 'innerRect' is initially hidden (innerRect:HIDDEN = TRUE).
6
// When 'outerRect' receives a mouse down event, the 'innerRect' becomes visible.
7
// When 'innerRect' receives a mouse down event, the 'innerRect' becomes hidden again.
8

    
9
// MOUSE-DOWN and MOUSE-CLICK events are reported with corresponding MESSAGEs for both widgets.
10

    
11
// The expected behavior (as observed in OE) is as follows:
12

    
13
// When the user click the mouse:
14

    
15
// 1. 'outerRect' receives mouse down
16
// 2. 'innerRect' receives the MOUSE-CLICK event.
17

    
18
// When the user click the mouse second time (above the 'innerRect'):
19

    
20
// 1. 'innerRect' receives mouse down
21
// 2. 'outerRect' receives the MOUSE-CLICK event.
22

    
23
DEFAULT-WINDOW:WIDTH-PIXELS = 700.
24
DEFAULT-WINDOW:HEIGHT-PIXELS = 700.
25

    
26
DEFINE RECTANGLE outerRect
27
   SIZE-PIXELS 300 BY 300.
28

    
29
DEFINE RECTANGLE innerRect
30
   SIZE-PIXELS 280 BY 280.
31

    
32
DEFINE FRAME f
33
   outerRect AT X 0 Y 0
34
   innerRect AT X 10 Y 10
35
   WITH SIZE 500 BY 500 TITLE "MOUSE-CLICK event routing test"
36
   .
37

    
38
ON ENTER OF outerRect DO:
39
   MESSAGE "Outer ENTER".
40
END.
41

    
42
ON EXIT OF outerRect DO:
43
   MESSAGE "Outer ENTER".
44
END.
45

    
46
ON LEFT-MOUSE-DOWN OF outerRect DO:
47
   MESSAGE "Outer Down, un-hiding inner".
48
   innerRect:VISIBLE = TRUE.
49
END.
50

    
51
// ON LEFT-MOUSE-UP OF outerRect DO:
52
//    MESSAGE "Outer Up".
53
// END.
54

    
55
ON LEFT-MOUSE-CLICK OF outerRect DO:
56
   MESSAGE "Outer Click".
57
END.
58

    
59
ON LEFT-MOUSE-DOWN OF innerRect DO:
60
   MESSAGE "Inner Down, hiding inner...".
61
   innerRect:VISIBLE = FALSE.
62
END.
63

    
64
// ON LEFT-MOUSE-UP OF innerRect DO:
65
//    MESSAGE "Inner Up".
66
// END.
67

    
68
ON LEFT-MOUSE-CLICK OF innerRect DO:
69
   MESSAGE "Inner Click".
70
END.
71

    
72
ENABLE ALL WITH FRAME f.
73

    
74
innerRect:HIDDEN = TRUE.
75

    
76
WAIT-FOR CLOSE OF THIS-PROCEDURE.