Page 2 of 2

PostPosted: Mon Oct 30, 2006 1:13 pm
by pawelu
Antonio,

I check code my apps. Places where I use comma separated commands based on window are too much. In this moment I probably must think about completly rewriting program code.
This is very bad news for me ...

Pawel

PostPosted: Mon Oct 30, 2006 3:14 pm
by Antonio Linares
Pawel,

Place all that code inside a function and call just that function. Its easy.

PostPosted: Fri Nov 03, 2006 1:47 pm
by pawelu
Antonio,

Call this function don't solve problem. In several places program show important data for user and should by wait for end user actions. In other situation window contents is dependent of other window and I must to know when second window is closed and do action eg. refresh objects in first window etc. Where we have little big project with many windows and many objects like browse, say, get, button and other is there little problem to multiple pass parameters to function where window is activate.

Comma separated commands with modal-only window were is the best programming solution in FWPPC. Program code were simple and forceful.

Thanks
Pawel

PostPosted: Fri Nov 03, 2006 11:14 pm
by Antonio Linares
Pawel,

You may try this modification: In source\classes\window.prg Method Activate():

// if Self == oWndMain
WinRun()
// endif

This way, it will execute in a modal way. Please try it there and lets see how it works for you.

PostPosted: Sat Nov 04, 2006 7:15 am
by pawelu
Antonio,

After change this code only first call create second window. Message is show after close main window. I check process in PPC environment and when main window is closed program process still running.
When I change this in Window.Prg:

Code: Select all  Expand view
   if Self == oWndMain
      oWndMain = nil
      // PostQuitMessage( 0 )     
   endif 
   PostQuitMessage( 0 )     


it's look like windows is really modal now (windows and process is properly created and closed).

Thanks for help
Pawel

Sample code:
Code: Select all  Expand view
Function TestWnd1 ()
   Local oWnd := Nil
   Define Window oWnd Title 'Window 1'
   @ 50, 50 Button 'Window 2' Size 100, 20 Pixel Action TestWnd2 ()
   Activate Window oWnd
Return .T.

Function TestWnd2 ()
   Local oWnd := Nil
   Define Window oWnd Title 'Window 2'
   Activate Window oWnd
   MsgInfo ('Window closed')
Return .T.

PostPosted: Sat Nov 04, 2006 9:47 am
by pawelu
Antonio,

If there changes for window.prg is valid please update command for activate window eg. add clause modal (activate window wnd modal).

Thanks for help
Pawel

Changes for window.prg
Code: Select all  Expand view
   if Self == oWndMain .Or. ::lModal
      WinRun()
   endif
   if Self == oWndMain
      oWndMain = nil
      PostQuitMessage( 0 )
   else
       if ::lModal
          PostQuitMessage( 0 )
       endif
   endif

PostPosted: Sun Nov 05, 2006 8:37 am
by Antonio Linares
Pawel,

Ok, already implemented. Thanks,

PostPosted: Sun Nov 05, 2006 2:08 pm
by pawelu
Antonio,

Finally I change window.prg as is:

Code: Select all  Expand view
   if Self == oWndMain
      oWndMain = nil
      PostQuitMessage( 0 )
   else
       if ::lModal .And. ::ClassName() == "TWINDOW"
          PostQuitMessage( 0 )
       endif
   endif


Regards
Pawel

PostPosted: Sun Nov 05, 2006 4:11 pm
by Antonio Linares
Pawel,

Thanks!

PostPosted: Mon Nov 06, 2006 7:55 pm
by pawelu
Antonio,

This is finally construct for today (modal window with TFolder object doesn't executing clause after window close):

Code: Select all  Expand view
       if ::lModal .And. ::ClassName() $ "TFOLDER;TWINDOW"
          PostQuitMessage( 0 )
       endif


Regards
Pawel

PostPosted: Mon Nov 06, 2006 9:26 pm
by Antonio Linares
Pawel,

thanks,