Code is executing after ACTIVATE WINDOW

Code is executing after ACTIVATE WINDOW

Postby shri_fwh » Sun Dec 23, 2012 10:32 am

Hi All,

I searched in the forum but I could not found the answer may be I could not co-relate with my problem. Basically I want to execute the code after a calling procedure execution is over. A calling procedure create and activate window ( not a dialog ) as WINDOW behavior it does not wait as dialog. I know we have VALID clause to execute the code after the WINDOW close (end) as per my need I can not use VALID clause. I am calling a procedure in the button action's block please see below. so do we have any solution apart from VALID clause ?
Thanks in advance.

Code: Select all  Expand view
  aoBTN[2]:bAction := <||

                        IF oRGSQry:vt_id == C_CHQ_RETURN_VT_ID
                           trv_dbrcpt( oRGSQry:vou_id )  // New Window Activates
                        ENDIF
                           --- below code should be execute after closing previous window
                           oRGSQry := oApp:gDBServer:Query( C_VT_REG( C_VR_VT_ID, C_VR_FROM_DATE, C_VR_TO_DATE  ) )
                           oBrwRGS:SetDolphin(oRGSQry)
                           oBrwRGS:Refresh()
                           --
                 
                       >

Thanks
Shridhar
Thanks
Shridhar
FWH 19.12, BCC 7 32 bit, MariaDB
shri_fwh
 
Posts: 301
Joined: Mon Dec 07, 2009 2:49 pm

Re: Code is executing after ACTIVATE WINDOW

Postby Antonio Linares » Sun Dec 23, 2012 12:48 pm

Shridhar,

I am not sure about what you want to do exactly, but maybe you could use oWnd:bStart that is executed just once, when the window is initially shown
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42089
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Code is executing after ACTIVATE WINDOW

Postby James Bott » Sun Dec 23, 2012 2:50 pm

Shirdhar,

Try the code below.

Regards,
James

Code: Select all  Expand view
 aoBTN[2]:bAction := {|oBrwRGS| ;
           IIF(oRGSQry:vt_id == C_CHQ_RETURN_VT_ID, ;
           trv_dbrcpt( oRGSQry:vou_id )), ;    // New Window Activates
           oRGSQry := oApp:gDBServer:Query( C_VT_REG( C_VR_VT_ID, C_VR_FROM_DATE, C_VR_TO_DATE  ) ),;
           oBrwRGS:SetDolphin(oRGSQry),;
           oBrwRGS:Refresh(),;
           }
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Code is executing after ACTIVATE WINDOW

Postby Enrico Maria Giordano » Sun Dec 23, 2012 10:04 pm

Or you can use this:

Code: Select all  Expand view
ACTIVATE WINDOW oWnd;
         VALID ( oWnd := NIL, .T. )

STOPUNTIL( { || oWnd = NIL } )

// Here goes your code


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8713
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Code is executing after ACTIVATE WINDOW

Postby James Bott » Mon Dec 24, 2012 2:31 am

Enrico,

Hey, I like that. Much easier.

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Code is executing after ACTIVATE WINDOW

Postby shri_fwh » Mon Dec 24, 2012 9:22 am

Hi All,

Thanks a lot..! for your great support.

Hi Antonio ,

Actually I want execute the code after a particular window operation is over. As WINDOW's behaviour the execute after ACTIVATE WINDOW that I do not need. Simply when we say ACTIVATE WINDOW oWnd it should wait till the Window is closed and continue with next code.

Hi Enrico ,

As I read in our forum the below function should not be used. Can we use this function in our code ? Please correct me if I am worng. Thanks in advance.

Code: Select all  Expand view

STOPUNTIL( { || oWnd = NIL } )
 


Thanks
Shridhar
Thanks
Shridhar
FWH 19.12, BCC 7 32 bit, MariaDB
shri_fwh
 
Posts: 301
Joined: Mon Dec 07, 2009 2:49 pm

Re: Code is executing after ACTIVATE WINDOW

Postby Enrico Maria Giordano » Mon Dec 24, 2012 10:16 am

It's already used in rpreview.prg so yes, you can use it in your code.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8713
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Code is executing after ACTIVATE WINDOW

Postby shri_fwh » Mon Dec 24, 2012 2:55 pm

Hi Enrico ,

I tried but its not working and also when I closed entire application still the Window's task manager shows status is running.

Thanks
Shridhar
Thanks
Shridhar
FWH 19.12, BCC 7 32 bit, MariaDB
shri_fwh
 
Posts: 301
Joined: Mon Dec 07, 2009 2:49 pm

Re: Code is executing after ACTIVATE WINDOW

Postby FranciscoA » Mon Dec 24, 2012 3:18 pm

Hi, if I understood, please look at this:
viewtopic.php?f=3&t=18270&start=0&hilit=oWnd%3Abpostend
Best regards
Francisco J. Alegría P.
Chinandega, Nicaragua.

Fwxh-MySql-TMySql
User avatar
FranciscoA
 
Posts: 2158
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Re: Code is executing after ACTIVATE WINDOW

Postby Enrico Maria Giordano » Mon Dec 24, 2012 3:57 pm

A working sample:

Code: Select all  Expand view
#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oWnd

    DEFINE WINDOW oWnd

    ACTIVATE WINDOW oWnd;
             VALID ( oWnd := NIL, .T. )

    STOPUNTIL( { || oWnd = NIL } )

    ? "The end!"

    RETURN NIL


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8713
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Code is executing after ACTIVATE WINDOW

Postby shri_fwh » Tue Dec 25, 2012 4:34 am

Hi Enrico ,

Extremely sorry..! I had not added the VALID clause in the ACTIVATE WINDOW command.

Code: Select all  Expand view

 VALID ( oWnd := NIL, .T. )
 


Thanks
Shridhar
Thanks
Shridhar
FWH 19.12, BCC 7 32 bit, MariaDB
shri_fwh
 
Posts: 301
Joined: Mon Dec 07, 2009 2:49 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 114 guests