Page 1 of 2
Release CHILD window problem
Posted: Wed Nov 25, 2015 9:49 pm
by esgici
Hi all
I have a problem while releasing a CHILD window :
Code: Select all
/*
* HMG - Harbour Win32 GUI library Demo
*
* Copyright 2010 Roberto Lopez <mail.box.hmg@gmail.com>
* http://www.hmgforum.com//
*/
#include "hmg.ch"
PROC Main()
DEFINE WINDOW frmRelChTest;
AT 0,0 ;
WIDTH 640 HEIGHT 480 ;
TITLE 'Release child window test';
MAIN
ON KEY ESCAPE ACTION ThisWindow.Release
@ 50, 50 BUTTON btnMake CAPTION "Make a child window" ACTION MakeAChild() WIDTH 200 HEIGHT 30
@ 50, 300 BUTTON btnTest CAPTION "Release child window" ACTION ReleaseChild() WIDTH 200 HEIGHT 30
END WINDOW
frmRelChTest.Center()
frmRelChTest.Activate()
RETU // Main()
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PROC MakeAChild()
DEFINE WINDOW frmChild AT 300, 300 ;
WIDTH 400 ;
HEIGHT 200 ;
CHILD ;
TITLE "This is a CHILD window"
END WINDOW
frmChild.Center
frmChild.Activate
RETU // MakeAChild()
*~~~~~~~~~~~~~~~~~~~~~~~~
PROC ReleaseChild()
IF IsWindowDefined( frmChild )
frmChild.Release
MsgInfo( "frmChild released." ) // never seen :(
ELSE
MsgStop( "frmChild not defined" )
ENDIF
RETU // ReleaseChild()
*~~~~~~~~~~~~~~~~~~~~~~~~
After executed frmChild.Release statement, program became unstable ( no responding anything ) only closed via task manager
Any idea ?
Viva HMG
Re: Release CHILD window problem
Posted: Thu Nov 26, 2015 7:32 am
by dragancesu
main window:
Code: Select all
DEFINE WINDOW Win_1 ;
AT 20,20 ;
WIDTH 800 ;
HEIGHT 700 ;
TITLE "Form definition" ;
MAIN ;
ON RELEASE close_3228()
@ 580,250 BUTTON PREVIEW_3228 ;
CAPTION "Preview" ;
ACTION frm_Preview_3228() ;
WIDTH 100 ;
HEIGHT 40
Code: Select all
FUNCTION close_3228()
if IsWindowActive( FormPrev )
DoMethod( 'FormPrev', "RELEASE" )
endif
child window:
Code: Select all
FUNCTION frm_preview_3228 ( )
if IsWindowActive( FormPrev )
DoMethod( 'FormPrev', "RELEASE" )
endif
DEFINE WINDOW FormPrev ;
AT 20, 100 ;
WIDTH 1000 ;
HEIGHT 800 ;
TITLE 'Preview Form' ;
CHILD
it's work
Re: Release CHILD window problem
Posted: Thu Nov 26, 2015 8:38 am
by gfilatov
esgici wrote:Hi all
I have a problem while releasing a CHILD window :
...
After executed frmChild.Release statement, program became unstable ( no responding anything ) only closed via task manager
Any idea ?
Hi Esgici,
It is an expected problem after the following modification in the function _ReleaseWindow ():
SendMessage( _HMG_SYSDATA [ 67 ] , WM_CLOSE, 0, 0 ) // ADD October 2015
instead of the old code
SendMessage ( _HMG_SYSDATA [ 67 ] , WM_SYSCOMMAND, SC_CLOSE, 0 )
The solution of above problem is a very simple: you should add the DO EVENTS statement after releasing of a Child window for
proper processing of the form's closing.
Hope that helps
Re: Release CHILD window problem
Posted: Thu Nov 26, 2015 9:56 am
by esgici
gfilatov wrote:
...
The solution of above problem is a very simple: you should add the DO EVENTS statement after releasing of a Child window for
proper processing of the form's closing.
Hi Grigory
Problem solved, thank you very much
Viva HMG
Re: Release CHILD window problem
Posted: Thu Nov 26, 2015 10:43 am
by esgici
dragancesu wrote:
...
it's work
Hi Dragan
Thank to interest
Your suggested sample is basically same as mine; only difference is MsgInfo() function after DoMethod() calling.
When added a Msgxxx() call, your sample became as mine : problematic.
This is also an interesting point ( a message function hang up program )
So problem solved with DO EVENTS command suggested by Grigory
Viva HMG and HMG friendship
Re: Release CHILD window problem
Posted: Thu Nov 26, 2015 12:18 pm
by serge_girard
Thanks !
I once also had this problem, can't remember how I solved it....
Serge
Re: Release CHILD window problem
Posted: Thu Nov 26, 2015 12:39 pm
by srvet_claudio
gfilatov wrote:esgici wrote:Hi all
I have a problem while releasing a CHILD window :
...
After executed frmChild.Release statement, program became unstable ( no responding anything ) only closed via task manager
Any idea ?
Hi Esgici,
It is an expected problem after the following modification in the function _ReleaseWindow ():
SendMessage( _HMG_SYSDATA [ 67 ] , WM_CLOSE, 0, 0 ) // ADD October 2015
instead of the old code
SendMessage ( _HMG_SYSDATA [ 67 ] , WM_SYSCOMMAND, SC_CLOSE, 0 )
The solution of above problem is a very simple: you should add the DO EVENTS statement after releasing of a Child window for
proper processing of the form's closing.
Hope that helps
Thanks Grigory,
I will fix
Re: Release CHILD window problem
Posted: Thu Dec 03, 2015 9:08 pm
by andyglezl
Hola, yo no se si sea lo mismo, pero con ventanas MODAL también pasa igual.
Tengo un .prg compilado con HMG3.15 y funciona bien, lo compilé con HMG3.4 y se
"congela" al momento de dar el
WndPidParam.Release.
------------------------------------------------------------------------------------------------------
Hi, I do not know if it is the same, but with windows MODAL also happens alike.
I have compiled a .prg HMG3.15 and works well, and compiled with HMG3.4
"freezes" when giving the
WndPidParam.Release.
FUNCTION PideFechas()
LOCAL cSizeFontTB:=12, lCanc:=.F., cSelec, ffecDesd, ffecHast
DEFINE WINDOW WndPidParam AT 0, 0 WIDTH 300 HEIGHT 200 ;
TITLE O2A("Reporte de Cobranza") MODAL NOSIZE NOSYSMENU BACKCOLOR MALVA
DEFINE DATEPICKER T_fecDesd
ROW 25 ; COL 30 ; WIDTH 115 ; HEIGHT 24
VALUE Date()
FONTNAME "Arial" ; FONTSIZE cSizeFontTB
TABSTOP .T. ; VISIBLE .T.
ONCHANGE (WndPidParam.T_fecHast.SetFocus)
END DATEPICKER
DEFINE DATEPICKER T_fecHast
ROW 98 ; COL 30 ; WIDTH 115 ; HEIGHT 24
VALUE Date()
FONTNAME "Arial" ; FONTSIZE cSizeFontTB
TABSTOP .T. ; VISIBLE .T.
ONCHANGE (WndPidParam.btnOk.SetFocus)
END DATEPICKER
@ 045,190 BUTTON btnOk ;
CAPTION "&Aceptar" ;
ACTION {|| lCanc:=.F.,ffecDesd:=WndPidParam.T_fecDesd.Value, ;
ffecHast:=WndPidParam.T_fecHast.Value, ;
WndPidParam.Release } ;
WIDTH 70 HEIGHT 25 FONT "Verdana" SIZE 8
@ 085,190 BUTTON btnCnc ;
CAPTION "&Cancelar" ;
ACTION {|| lCanc:=.T., WndPidParam.Release } ;
WIDTH 70 HEIGHT 25 FONT "Verdana" SIZE 8
END WINDOW
CENTER WINDOW wndPidParam
ACTIVATE WINDOW wndPidParam
RETURN( { lCanc, ffecDesd, ffecHast } )
Re: Release CHILD window problem
Posted: Thu Dec 03, 2015 10:05 pm
by andyglezl
Si oprimo 2 veces cualquiera de los botones, entonces se cancela...
--------------------------------------------------------------------------------
If I press 2 times either of the buttons, then canceled ...
- Release WIN MODAL.jpg (134.72 KiB) Viewed 5051 times
Re: Release CHILD window problem
Posted: Sat Jan 16, 2016 1:58 pm
by srvet_claudio
I fixed.