MDIchild problem

Post Reply
User avatar
Rimantas
Posts: 437
Joined: Fri Oct 07, 2005 12:56 pm
Location: Utena , Lithuania

MDIchild problem

Post by Rimantas »

Hi ! I have one problem with MDIChilds windows . The situation looks like that :

1 - open first MDIChild window oWnd1 ;
2 - open second MDIChild window oWnd2 ;
( this second MDI Child have folders ) ;
3 - maximize it .The first window maximized too ;
4 - let to close the second ( oWnd2 ) window ;
- application hangs up ... :-((

It appears not allways , but sometimes . At first I was thinking that this is my problem , because I'm using owns classes for window management - to save states of windows , browses and etc. . But with not maximized window or windows without folders it works OK . With one MDIChild if it's maximized ( with folder too ) it works OK . So why it hangs up only for maximized ( with folders ) and if are open some windows ?
If I will close the first window oWnd1 ( from described sequence ) , then and second will be closelly without problems . It seem that folder dialogs are interfere in sequence of MDI Childs ... That's mine opinion . What it's really - I believe that guru will help to elucidate .

Here is my pieces of sources :

METHOD WCreate() CLASS TMyBasic // to create MDI CHild window
::WndBasic()
if ::nWd == 1
::Bar()
endif
if ::lFld
::oFld := TFolder():New( 5, 5, ::aFold,, ::oWnd,,,, .t.,,,,, .t. )
::oFld:SetOption( ::nFld )
::oFld:bChange := { || ::nOldFld := ::nFld, ::nFld := ::oFld:nOption, ::FldChg() }
::oFld:aDialogs[ ::nFld ]:bLClicked := { || ::nOldFld := ::nFld, ::nFld := ::oFld:nOption, ::FldChg() }
::oFld:SetFont( wndMain():oFont )
if ::nWd == 1
::oWnd:SetControl( ::oFld )
endif
endif
::oBrw := array( len( ::aAlias ) ) // browse obj arrays
::oSel := array( len( ::aAlias ) )
::BrwBasic()

::oWnd:bLostFocus := { || if( ::nLst <= 0, ::LstFcs(), ) }
::oWnd:bGotFocus := { || if( ::nLst <= 0, ::GotFcs(), ) }
::oWnd:bValid := { || ( ::End(), .t. ) }
::oWnd:bKeyDown := { | nKey, nFlags | ::Keys( nKey ) }
return( NIL )

METHOD Start() CLASS TMyBasic
local n := 0
if ::nWd == 1 // for MDIChilds
if !::lMax
for n := 1 to len( wndMain():oWndClient:aWnd )
if IsZoomed( wndMain():oWndClient:aWnd[ n ]:hWnd )
::lMax := .t.
exit
endif
next
endif
::oWnd:Activate( if( ::lMax, "MAXIMIZED", "NORMAL" ) )
::nPrvWnd := GetFocus()
::oWnd:SetFocus()
::Focus()
else // for dialogs
::oWnd:lHelpIcon = .F.
::oWnd:Activate( ,,,, { || ::End(), SetFocus( ::nPrvWnd ), .t. },, ;
{ || ::oWnd:Move( ::nWk1, ::nWk2, ::nWk3, ::nWk4, .t. ), ::DlgCtrl(), ;
::nPrvWnd := GetFocus(), ::PradIrs( ::cPrdKnt, ::aPrdBsn, ::cPrdAls ), ::oBrw[ ::nFld ]:SetFocus(), oApp:OpWd( ::cCargo, Self, 1 ) },,)
endif
return( NIL )

METHOD End() CLASS TMyBasic
local cCrg := ::cCargo
local n := 0
if ::bEnd !=NIL // codeblock for needfuls ends of windows
eval( ::bEnd )
endif
if ::oWnd != NIL
if ::lEnv
for n := 1 to len( ::aBrwID )
wbrw_save( ::cCargo, ::aBrwID[ n ], ::oBrw[ n ], ::aColSrw[ n ] )
next
wind_save( padr( ::cCargo, 10 ), ::oWnd )
endif
::LstFcs()
endif
if ::bEndPst !=NIL // another codeblock from my class
eval( ::bEndPst )
endif
oApp:OpWd( cCrg,, 2 ) // to release object from
::lEnd := .t.
if ::nWd == 1
// it hangs up in this place - I don't reach PostMessage function .
PostMessage( ::oWnd:hWnd, WM_CLOSE )
endif
return( NIL )

Any ideas and help are very appreciatable . With best regards !

P.S. Antonio , this isn't related to FiveHc or xHarbour , it was in earlier . Only at this moment I decided to direct for help .. :-)
Rimantas U.
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Rimantas,

We may need a self contained and reduced sample to reproduce the error using FWH standard FWH classes. Without that, its quite difficult to help.

You say the application hangs. Does it GPF ? Do you loose control of it ? No mouse response ? Keyboard response ? Does Windows report it is not responding ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Rimantas
Posts: 437
Joined: Fri Oct 07, 2005 12:56 pm
Location: Utena , Lithuania

Post by Rimantas »

Antonio Linares wrote:Rimantas,

We may need a self contained and reduced sample to reproduce the error using FWH standard FWH classes. Without that, its quite difficult to help.

You say the application hangs. Does it GPF ? Do you loose control of it ? No mouse response ? Keyboard response ? Does Windows report it is not responding ?
Hello Antonio !

Yes , you are right , if it shows on a small sample that will be easy to detect where is the problem . I understand that , from FWH samples redid one sample with MDIChilds . But that sample works fine . Of course , that can be only mine problem , but I can't to detect that , so I directed to newsgroup - maybe with something similar collided other developers ? Or give me an idea ?

At this time I solved that in my ::End() method . It works , not so clear, but works ... :-)) .

METHOD End() CLASS TMyBasic
local cCrg := ::cCargo
local n := 0
local oWnd
local lRest := .f.
if ::bEnd !=NIL
eval( ::bEnd )
endif
if ::oWnd != NIL
if ::lEnv
for n := 1 to len( ::aBrwID )
wbrw_save( ::cCargo, ::aBrwID[ n ], ::oBrw[ n ], ::aColSrw[ n ] )
next
wind_save( padr( ::cCargo, 10 ), ::oWnd )
endif
// added here some line - if window was maximized and with folders
if IsZoomed( ::oWnd:hWnd ) == .t. .and. ::lFld
lRest := .t.
::oWnd:Hide()
::oWnd:Restore() // minimize that window
endif
::LstFcs()
endif
if ::bEndPst !=NIL
eval( ::bEndPst )
endif
::lEnd := .t.
oApp:OpWd( cCrg,, 2 )
if ::nWd == 1
do while PostMessage( ::oWnd:hWnd, WM_CLOSE ) # 1
enddo
endif
Self := NIL
// if exist other windows then again restore them to maximize state , as after :Restore() methods others windows restore too .

if lRest .and. len( wndMain():oWndClient:aWnd ) > 0
wndMain():oWndClient:PrevWindow()
wndMain():oWndClient:GetActive():Maximize()
endif
return( NIL )

With best regards !
Rimantas U.
RayFS
Posts: 1
Joined: Sun Oct 23, 2005 8:04 pm

Post by RayFS »

Rimantas wrote: Of course , that can be only mine problem , but I can't to detect that , so I directed to newsgroup - maybe with something similar collided other developers ?
I can confirm this problem, but also don't have a solution.

Ray
Post Reply