//------------------------------------------------
//PRUEBA 4 MDI + MDICHILD + DIALOG NOWAIT INCRUSTADO + ESCAPE
//-------------------------------------------------
#include "FiveWin.ch"
#define COLOR_BTNFACE 15
//-------------------------------------
function Main()
local oWnd, oBar
DEFINE WINDOW oWnd TITLE "MDIChilds" MDI
DEFINE BUTTONBAR oBar _3D OF oWnd
DEFINE BUTTON OF oBar ACTION child(oWnd)
DEFINE BUTTON OF oBar ACTION Dchild(oWnd)
ACTIVATE WINDOW oWnd maximized
return nil
//----------------------------------------------------------------------------//
function Child(oWnd)
local oWndChild, oDlg, oBtn0, oBtn1, oBtn2, oBtn3, oBtn4
local bExit
DEFINE WINDOW oWndChild MDICHILD OF oWnd ;
FROM 5,5 TO 6,6;
COLOR "N/W" ;
BORDER NONE NOMAXIMIZE NOMINIMIZE // prevent resizing
oWndChild:bGotFocus = { || oDlg:SetFocus() }
DEFINE DIALOG oDlg FROM 150, 150 TO 400, 600 STYLE WS_CHILD ;
OF oWndChild TITLE "Dialog from Child- Window" PIXEL TRANSPARENT
@ 10, 80 BTNBMP oBtn0 SIZE 50, 20 OF oDlg 2007 ;
CENTER ;
PROMPT " &Dialog 2" ;
ACTION DChild(oDlg)
oBtn0:lTransparent = .t.
@ 36, 10 SAY "CLASS TBUTTONBMP" OF oDlg PIXEL
@ 50, 10 BUTTONBMP oBtn1 OF oDlg ACTION MsgInfo( "Prueba de Focus" ) ;
PROMPT "&Test" TEXTRIGHT SIZE 80, 20 PIXEL
@ 80, 10 BUTTONBMP oBtn2 OF oDlg ACTION ( oWndChild:End() );
PROMPT "&Exit" TEXTRIGHT SIZE 80, 20 PIXEL
@ 36, 150 SAY "CLASS TBTNBMP" OF oDlg PIXEL
@ 50, 150 BTNBMP oBtn3 SIZE 50, 20 OF oDlg 2007 ;
CENTER ;
PROMPT " &Focus-test" ;
ACTION MsgAlert( "Focus-test", "Attention" )
oBtn3:lTransparent = .t.
@ 80, 150 BTNBMP oBtn4 SIZE 50, 20 OF oDlg 2007 ;
CENTER ;
PROMPT " &Exit" ;
ACTION oDlg:End()
oBtn4:lTransparent = .t.
bExit := {|| MsgInfo("Hello...!!! Do you like music?"+CRLF+;
"Voyage at the bottom of the bath (The Shadows)") }
ACTIVATE DIALOG oDlg NOWAIT ;
VALID if(!GetKeyState(VK_ESCAPE), ( oWndChild:End(), .t. ), .F.) ;
ON INIT oDlg:Move(0,0)
oWndChild:bPostEnd := {|| Eval(bExit) }
ACTIVATE WINDOW oWndChild ;
VALID .T. ; //if(!GetKeyState(VK_ESCAPE),(MsgInfo("I go home."), .t.), .F.) ;
ON INIT oWndChild:SetSize(oDlg:nWidth,oDlg:nHeight)
return nil
//------- 2. Dialog --------------------------------
function DChild(oDlg)
local oDlg1, oBtn4, oBtn5, oBtn6
DEFINE DIALOG oDlg1 FROM 300, 300 TO 550, 750 TITLE "Chilf from Dialog " OF oDlg PIXEL TRANSPARENT
@ 20, 20 BTNBMP oBtn4 SIZE 50, 20 OF oDlg1 2007 ;
CENTER ;
PROMPT " &Focus-test" ;
ACTION MsgAlert( "Focus-test", "Attention" )
oBtn4:lTransparent = .t.
@ 50, 20 BTNBMP oBtn5 SIZE 50, 20 OF oDlg1 2007 ;
CENTER ;
PROMPT " &Focus-test" ;
ACTION MsgAlert( "Focus-test", "Attention" )
oBtn5:lTransparent = .t.
@ 80, 100 BTNBMP oBtn6 SIZE 50, 20 OF oDlg1 2007 ;
CENTER ;
PROMPT " &Exit" ;
ACTION oDlg1:End()
oBtn6:lTransparent = .t.
ACTIVATE DIALOG oDlg1 ;
VALID if(!GetKeyState(VK_ESCAPE), .T., .F.) //<----- here...
return nil