En el ejemplo que adjunto, se puede abrir la ventana mdichild y al pulsar "Esc" la cierra correctamente. Pero cuando esto se hace varias veces, a partir de la segunda o tercera vez que se cierra ya no la limpia de la ventana principal.
Prg:
#include "FiveWin.ch"
#include "Splitter.ch"
function Main()
local oWnd
Define Window oWnd Title "Principal" Mdi Menu ps_Menu(oWnd) Brush TBrush():New(, CLR_WHITE ) VSCROLL HSCROLL
Activate Window oWnd MAXIMIZED Valid MsgYesNo('Desea salir')
return nil
static func ps_Menu(oWnd)
local oMenu
Menu oMenu
MenuItem "Child" Action ps_Child(oWnd)
EndMenu
return oMenu
static proc ps_Child( oWnd )
local oChild
Define Window oChild MdiChild Title 'Child' of oWnd
Activate Window oChild On Init ps_Dialog(oChild) Valid ps_Salir(oChild)
return
static func ps_Salir(oChild)
oChild := ''
hb_gcAll(.T.)
return .T.
static proc ps_Dialog( oChild )
local oDlg, aGet[8], aVar[8]
local oOutlook, oControl, aRect, oSplitOut, nWidth, nHeight
DEFINE DIALOG oDlg Resource "Dialogo" OF oChild Transparent Gradient { { 1, RGB(229, 233, 238), RGB(255, 255, 255) } }
SetParent( oDlg:hWnd, oChild:hWnd )
DEFINE OUTLOOK2003 oOutLook OF oChild PROMPTS "Accesos"
SetParent( oOutLook:hWnd, oChild:hWnd )
oChild:oLeft := NIL
aVar[1] := space(2)
Redefine Get aGet[1] Var aVar[1] Id 102 Update Message 'Indique el c贸digo del usuario' Of oDlg
aVar[2] := space(50)
Redefine Get aGet[2] Var aVar[2] Id 103 Update Message 'Indique el nombre del usuario' Of oDlg
aVar[3] := space(50)
Redefine Get aGet[3] Var aVar[3] Id 104 Update Message 'Indique el c贸digo de la empresa' Of oDlg
aVar[4] := space(50)
Redefine Get aGet[4] Var aVar[4] Id 105 Update Message 'Indique el nombre de la empresa' Of oDlg
for each oControl in oDlg:aControls
聽 oControl:bLClicked = GenBlock( oChild, oControl )
next 聽 聽
aRect := oOutLook:aDialogs[ 1 ]:GetCliRect()
@ 0, aRect:nRight SPLITTER oSplitOut ;
聽 聽VERTICAL _3DLOOK ;
聽 聽PREVIOUS CONTROLS oOutLook ;
聽 聽HINDS CONTROLS oDlg ;
聽 聽SIZE 4, oChild:nHeight - 70 PIXEL ;
聽 聽OF oChild
SetParent( oSplitOut:hWnd, oChild:hWnd )
ACTIVATE DIALOG oDlg NoWait Valid oChild:End()
oDlg:Move( 0, oSplitOut:nRight,,, .F. )
nWidth 聽:= oDlg:nWidth
nHeight := oDlg:nHeight
oSplitOut:bLDblClick := {|| oSplitOut:SetPosition(oSplitOut:nFirst) }
Eval( oSplitOut:bLDblClick )
oChild:bResized := {|| oSplitOut:AdjClient()}
oDlg:bResized := {|| Ghe_Resize(oDlg)}
nWidth += oOutLook:nWidth
nWidth += oSplitOut:nWidth
nWidth += 7
if oChild:nWidth > nWidth
聽 nWidth := oChild:nWidth
endif
nHeight += 7
if oChild:nHeight > nHeight
聽 nHeight := oChild:nHeight
endif
oChild:SetSize(nWidth, nHeight, .F.)
return
function GenBlock( oWndChild, oControl )
return { || oWndChild:SetFocus(), oControl:SetFocus() }
Proc Ghe_Resize( oDlg )
if oDlg:oBrush<>NIL
聽 oDlg:SetColor(,, oDlg:oBrush:Resized( oDlg:nWidth, oDlg:nHeight, 2) )
endif
returnRc:
DIALOGO DIALOG DISCARDABLE 0, 0, 332, 86
STYLE WS_CHILD|WS_VISIBLE
FONT 8, "MS Sans Serif"
{
聽 CONTROL "123", 102, "Edit", ES_AUTOHSCROLL|WS_BORDER|WS_TABSTOP, 89, 31, 39, 12
聽 CONTROL "123456", 103, "Edit", ES_AUTOHSCROLL|WS_BORDER|WS_TABSTOP, 136, 31, 146, 12
聽 CONTROL "12", 104, "Edit", WS_BORDER|WS_TABSTOP, 89, 58, 32, 12
聽 CONTROL "1", 105, "Edit", WS_BORDER|WS_TABSTOP, 136, 58, 105, 12
聽 CONTROL "Usuario:", -1, "Static", SS_CENTERIMAGE|WS_GROUP, 50, 33, 31, 12
聽 CONTROL "Empresa:", -1, "Static", SS_CENTERIMAGE|WS_GROUP, 50, 60, 31, 12
}Fernando Gonz谩lez Diez
ALSIS Sistemas Inform谩ticos
