// Demonstrates the FWD bug: focus change happens ON mouse UP instead OF mouse DOWN

// Defines 2 frames with buttons:
// 1. 'outerFrame'
// 2. 'innerFrame' inside the 'outerFrame'

DEFAULT-WINDOW:TITLE = '8917'.

DEFINE BUTTON focusable1.
DEFINE FRAME outerFrame focusable1 WITH SIZE 80 BY 10.

DEFINE BUTTON focusable2.
DEFINE FRAME innerFrame focusable2 WITH SIZE 20 BY 4 AT ROW 3 COL 1.
FRAME innerFrame:FRAME = FRAME outerFrame:HANDLE.

{functions.i}

{printEntryLeave.i &widget="FRAME outerFrame"}
{printEntryLeave.i &widget="FRAME innerFrame"}
{printEntryLeave.i &widget="focusable1"}
{printEntryLeave.i &widget="focusable2"}

/*ON CHOOSE OF focusable1 DO:     */
/*    MESSAGE 'focusable1 choose'.*/
/*END.                            */

ON 'b' OF focusable1 DO:
    MESSAGE 'focusable1 b'.
END.

ON 'b' OF focusable2 DO:
    MESSAGE 'focusable2 b'.
END.

ON 'a' ANYWHERE DO:
    IF FOCUS <> ? THEN
      MESSAGE 'FOCUS' FOCUS:NAME.
    ELSE
      MESSAGE "FOCUS ?".
END.

ENABLE ALL WITH FRAME outerFrame.
ENABLE ALL WITH FRAME innerFrame.
WAIT-FOR GO OF FRAME outerFrame.

