XBOWSE : open dialog in bEditwhen , closing in bEditValid

XBOWSE : open dialog in bEditwhen , closing in bEditValid

Postby Franklin Demont » Sat Dec 29, 2012 11:38 am

Hello

Look at the code :

Code: Select all  Expand view

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
Franklin Demont
 
Posts: 166
Joined: Wed Aug 29, 2012 8:25 am

Re: XBOWSE : open dialog in bEditwhen , closing in bEditValid

Postby Rick Lipkin » Sat Dec 29, 2012 2: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: Select all  Expand view

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
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: XBOWSE : open dialog in bEditwhen , closing in bEditValid

Postby Franklin Demont » Sat Dec 29, 2012 6: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
Franklin Demont
 
Posts: 166
Joined: Wed Aug 29, 2012 8:25 am

Re: XBOWSE : open dialog in bEditwhen , closing in bEditValid

Postby Rick Lipkin » Sat Dec 29, 2012 7: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
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 114 guests