FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour XBOWSE : open dialog in bEditwhen , closing in bEditValid
Posts: 166
Joined: Wed Aug 29, 2012 08:25 AM
XBOWSE : open dialog in bEditwhen , closing in bEditValid
Posted: Sat Dec 29, 2012 11:38 AM
Hello

Look at the code :

Code (fw): Select all Collapse
oCol:bEditWhen  :={||ShowDlg(@oDDlg),;
                SetActiveWindow(oDlg:hWnd) , .T. }


oCol:bEditValid    := {|oGet|IIF(oDdlg<>nil,(oDdlg:end(),tracelog(oDdlg,"After")),);
                                          , .T.}


The when clausule opens a dialog (shows some values) , the edit field become focus

The valid clausule doesn't close the dialog. Tracelog is executed , also oddlg:end()

Result :
Type: O >>>{ TDIALOG Object }<<<
Type: C >>>After<<<

Why is the dialog not closed and why is oDdlg <> nil ???????????

Frank
test
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: XBOWSE : open dialog in bEditwhen , closing in bEditValid
Posted: Sat Dec 29, 2012 02:35 PM
Frank

I have found that when you end() an object it still has some properties remaining and it is neither empty() or nil.

What I would do is after you close your dialog, set your object to nil .. try it this way ..

Code (fw): Select all Collapse
oCol:bEditValid := {|oGet|IIF(oDdlg<>nil,( (oDdlg:end(),oDdlg := nil),tracelog(oDdlg,"After")),);
                                          , .T.}


Or .. you can set oDdlg to nil on the way out of ShowDlg().

Hope this helps ..
Rick Lipkin
Posts: 166
Joined: Wed Aug 29, 2012 08:25 AM
Re: XBOWSE : open dialog in bEditwhen , closing in bEditValid
Posted: Sat Dec 29, 2012 06:35 PM

Rick,

I do expect :

1) Close oDdlg
2) After closing oDdlg it should be nil

When oDdlg:end is executed it has no result : oDdlg is still open

After setting oDdlg to nil , why should that end the dialog ?

Frank

test
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: XBOWSE : open dialog in bEditwhen , closing in bEditValid
Posted: Sat Dec 29, 2012 07:28 PM

Frank

When you close any object .. it ( generally ) is not set to nil. If I use Statics or even Locals, when I close or End() an object .. I always reset the variable to nil.

Several reasons for that .. especially if you use a lot of Static variables as they are always active in memory for the life of your program.. If you never Nil out out Statics, you will be consuming more memory than you expected.

Rick Lipkin

Continue the discussion