Project

General

Profile

8770-explicit-focus.p

Vladimir Tsichevski, 06/12/2024 04:25 PM

Download (1.45 KB)

 
1
// Demonstrates ENTRY/EVENT signals when focus is set explicitly in WAIT-FOR
2
 
3
// In this demo, 3 frames are defined with 2 buttons:
4
// 1. 'outerframe': an outermost frame
5
// 2-3. two frames in 'outerFrame':
6
//    # 'innerFrame' with the 'focusable2' button.
7
//    # 'innerFrame2' with the 'focusable3' button.
8
DEFAULT-WINDOW:TITLE = '8770-explicit-focus'.
9

    
10
DEFINE FRAME outerFrame
11
WITH SIZE 80 BY 15
12
AT COL 1 ROW 1.
13

    
14
DEFINE BUTTON focusable2.
15
DEFINE FRAME innerFrame
16
  focusable2
17
  WITH SIZE 60 BY 2
18
  AT COLUMN 1 ROW 1.
19
FRAME innerFrame:FRAME = FRAME outerFrame:HANDLE.
20

    
21
DEFINE BUTTON focusable3.
22
DEFINE FRAME innerFrame2
23
  focusable3
24
  WITH SIZE 60 BY 2
25
  AT COLUMN 1 ROW 5.
26
FRAME innerFrame2:FRAME = FRAME outerFrame:HANDLE.
27

    
28
{functions.i}
29

    
30
{printEntryLeave.i &widget="DEFAULT-WINDOW"}
31
{printEntryLeave.i &widget="FRAME outerFrame"}
32
{printEntryLeave.i &widget="FRAME innerFrame"}
33
{printEntryLeave.i &widget="FRAME innerFrame2"}
34

    
35
{printEntryLeave.i &widget="focusable2"}
36
{printEntryLeave.i &widget="focusable3"}
37

    
38
ON 'a' ANYWHERE DO:
39
  DEFINE VARIABLE hFocus AS HANDLE NO-UNDO.
40
  hFocus = FOCUS.
41
  DEFINE VARIABLE cFocusName AS CHARACTER NO-UNDO.
42
  IF FOCUS <> ? THEN
43
     cFocusName = FOCUS:NAME.
44
  MESSAGE "FOCUS:" cFocusName.
45
END.
46

    
47
ON ENTRY OF focusable2 DO:
48
   RUN PrintEntry(focusable2:HANDLE).
49
   RETURN NO-APPLY.
50
END.
51

    
52
ENABLE focusable2 WITH FRAME innerFrame.
53
ENABLE focusable3 WITH FRAME innerFrame2.
54
VIEW FRAME outerFrame.
55
WAIT-FOR GO OF FRAME outerFrame FOCUS focusable2.
56