Menu actions

pawelu
Posts: 126
Joined: Thu Oct 06, 2005 10:18 pm
Location: Poland
Contact:

Post 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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Pawel,

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

Antonio Linares
www.fivetechsoft.com
pawelu
Posts: 126
Joined: Thu Oct 06, 2005 10:18 pm
Location: Poland
Contact:

Post 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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post 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.
regards, saludos

Antonio Linares
www.fivetechsoft.com
pawelu
Posts: 126
Joined: Thu Oct 06, 2005 10:18 pm
Location: Poland
Contact:

Post 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

   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

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.
pawelu
Posts: 126
Joined: Thu Oct 06, 2005 10:18 pm
Location: Poland
Contact:

Post 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

   if Self == oWndMain .Or. ::lModal
      WinRun()
   endif 
   if Self == oWndMain
      oWndMain = nil
      PostQuitMessage( 0 ) 
   else
       if ::lModal
          PostQuitMessage( 0 ) 
       endif
   endif 
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Pawel,

Ok, already implemented. Thanks,
regards, saludos

Antonio Linares
www.fivetechsoft.com
pawelu
Posts: 126
Joined: Thu Oct 06, 2005 10:18 pm
Location: Poland
Contact:

Post by pawelu »

Antonio,

Finally I change window.prg as is:

Code: Select all

   if Self == oWndMain 
      oWndMain = nil 
      PostQuitMessage( 0 ) 
   else 
       if ::lModal .And. ::ClassName() == "TWINDOW"
          PostQuitMessage( 0 ) 
       endif 
   endif 
Regards
Pawel
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Pawel,

Thanks!
regards, saludos

Antonio Linares
www.fivetechsoft.com
pawelu
Posts: 126
Joined: Thu Oct 06, 2005 10:18 pm
Location: Poland
Contact:

Post by pawelu »

Antonio,

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

Code: Select all

       if ::lModal .And. ::ClassName() $ "TFOLDER;TWINDOW" 
          PostQuitMessage( 0 ) 
       endif 
Regards
Pawel
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Pawel,

thanks,
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply