closewithreturn not working...

In the Activate event, there is a line of code to close the
current response(w_response) window but the code after this
line continues to run in this window without giving control
back to the calling window.  The response windows was opened
with...

openwithparm(w_response, lv_id )	

Then after some code is run it is supposed to close...

closewithreturn(w_response, "continue")
more code...

This code was originally written in PB5 and the program has
since been migrated to PB10.  Any thoughts or ideas are
appreciated.

Thanks in advance,
Milo
0
Milo
10/24/2006 2:50:07 PM
sybase.powerbuilder.general 62418 articles. 11 followers. Follow

11 Replies
551 Views

Similar Articles

[PageSpeed] 16

IME, this most often indicates that something else is being triggered that
trashes the contents of the message object. Given such a substantial migration,
it's likely that the order of events have changed such that the juggling act
someone has been playing with the message object no longer works. 

Often, identifying the one interfering with the pass-off creates a strong
candidate for change. If not, extending the message object and creating your own
more robust version of CloseWithReturn is pretty conceivable. 

Good luck,

Terry [TeamSybase] and Sequel the techno-kitten

On 24 Oct 2006 07:50:07 -0700,
 in sybase.public.powerbuilder.general
 <Milo> wrote: 
>In the Activate event, there is a line of code to close the
>current response(w_response) window but the code after this
>line continues to run in this window without giving control
>back to the calling window.  The response windows was opened
>with...
>
>openwithparm(w_response, lv_id )	
>
>Then after some code is run it is supposed to close...
>
>closewithreturn(w_response, "continue")
>more code...
>
>This code was originally written in PB5 and the program has
>since been migrated to PB10.  Any thoughts or ideas are
>appreciated.
>
>Thanks in advance,
>Milo

*********************************
PowerBuilder for $95? No.
Personal use PowerBuilder Enterprise *AND* PocketBuilder *AND* DataWindow.NET
*AND* Sybase IQ as free benefits of am ISUG membership. See
http://www.isug.com/ISUG3/Membership_benefits.html for details.

*********************************
Click once a day to help the hungry
http://www.thehungersite.com
*********************************
User Manual
===========
TeamSybase <> Sybase employee
Forums = Peer-to-peer
Forums <> Communication with Sybase
IsNull (AnswerTo (Posting)) can return TRUE
Forums.Moderated = TRUE, so behave or be deleted
*********************************

Sequel's Sandbox: http://www.techno-kitten.com
Home of PBL Peeper, a free PowerBuilder Developer's Toolkit. 
Version 3.0.02 now available at the Sandbox
PB Futures updated Apr 24/2006
See the PB Troubleshooting & Migration Guides at the Sandbox
^ ^
o o
=*=
0
Terry
10/24/2006 4:11:44 PM
Milo,

    If I understand you correctly, all you need to do is add a "RETURN"
statement after the closewithreturn call.  The help for close with return
states:

Just as with Close, CloseWithReturn removes a window from view, closes it,
and executes the script for the CloseQuery and Close events, if any. Before
executing the event scripts, it also stores returnvalue in the Message
object. Then PowerBuilder executes the rest of the script that called the
CloseWithReturn function.

    In particular, look at the last sentence.  That is the way PB has always
worked to my knowledge.

Richard

<Milo> wrote in message news:453e281f.5a2e.1681692777@sybase.com...
> In the Activate event, there is a line of code to close the
> current response(w_response) window but the code after this
> line continues to run in this window without giving control
> back to the calling window.  The response windows was opened
> with...
>
> openwithparm(w_response, lv_id )
>
> Then after some code is run it is supposed to close...
>
> closewithreturn(w_response, "continue")
> more code...
>
> This code was originally written in PB5 and the program has
> since been migrated to PB10.  Any thoughts or ideas are
> appreciated.
>
> Thanks in advance,
> Milo


0
Richard
10/24/2006 4:28:03 PM
Hi Richard,

I tried adding 'Return' and the calling window still does
not regain control and finish running the code after calling
the response window.  Interestingly though, when I put
another "CloseWithReturn" call in open event it actually
works.  So, there must be something about calling
CloseWithReturn in the Activate event that does not work the
same in PB10 as it did in PB5.

If you have any further suggestions please post.
Thanks in advance,
Milo

> Milo,
>
>     If I understand you correctly, all you need to do is
> add a "RETURN" statement after the closewithreturn call.
> The help for close with return states:
>
> Just as with Close, CloseWithReturn removes a window from
> view, closes it, and executes the script for the
> CloseQuery and Close events, if any. Before executing the
> event scripts, it also stores returnvalue in the Message
> object. Then PowerBuilder executes the rest of the script
> that called the CloseWithReturn function.
>
>     In particular, look at the last sentence.  That is the
> way PB has always worked to my knowledge.
>
> Richard
>
> <Milo> wrote in message
> > news:453e281f.5a2e.1681692777@sybase.com... In the
> > Activate event, there is a line of code to close the
> current response(w_response) window but the code after
> > this line continues to run in this window without giving
> > control back to the calling window.  The response
> > windows was opened with...
> >
> > openwithparm(w_response, lv_id )
> >
> > Then after some code is run it is supposed to close...
> >
> > closewithreturn(w_response, "continue")
> > more code...
> >
> > This code was originally written in PB5 and the program
> > has since been migrated to PB10.  Any thoughts or ideas
> > are appreciated.
> >
> > Thanks in advance,
> > Milo
>
>
0
Milo
10/24/2006 5:47:10 PM
I just moved the original code from the Activate event to
the Open event and it works.  That is great and I will move
on, but the question is why?  All opinions are appreciated.

Thanks,
Milo

> Milo,
>
>     If I understand you correctly, all you need to do is
> add a "RETURN" statement after the closewithreturn call.
> The help for close with return states:
>
> Just as with Close, CloseWithReturn removes a window from
> view, closes it, and executes the script for the
> CloseQuery and Close events, if any. Before executing the
> event scripts, it also stores returnvalue in the Message
> object. Then PowerBuilder executes the rest of the script
> that called the CloseWithReturn function.
>
>     In particular, look at the last sentence.  That is the
> way PB has always worked to my knowledge.
>
> Richard
>
> <Milo> wrote in message
> > news:453e281f.5a2e.1681692777@sybase.com... In the
> > Activate event, there is a line of code to close the
> current response(w_response) window but the code after
> > this line continues to run in this window without giving
> > control back to the calling window.  The response
> > windows was opened with...
> >
> > openwithparm(w_response, lv_id )
> >
> > Then after some code is run it is supposed to close...
> >
> > closewithreturn(w_response, "continue")
> > more code...
> >
> > This code was originally written in PB5 and the program
> > has since been migrated to PB10.  Any thoughts or ideas
> > are appreciated.
> >
> > Thanks in advance,
> > Milo
>
>
0
Milo
10/24/2006 6:09:44 PM
One assumes that the code was placed in the Activate event for a reason. 
Check the difference between Activate and Open before leaving the change as 
you have done it, as you may be removing required functionality.

<Milo> wrote in message news:453e56e8.5ec9.1681692777@sybase.com...
>I just moved the original code from the Activate event to
> the Open event and it works.  That is great and I will move
> on, but the question is why?  All opinions are appreciated.
>
> Thanks,
> Milo
>
>> Milo,
>>
>>     If I understand you correctly, all you need to do is
>> add a "RETURN" statement after the closewithreturn call.
>> The help for close with return states:
>>
>> Just as with Close, CloseWithReturn removes a window from
>> view, closes it, and executes the script for the
>> CloseQuery and Close events, if any. Before executing the
>> event scripts, it also stores returnvalue in the Message
>> object. Then PowerBuilder executes the rest of the script
>> that called the CloseWithReturn function.
>>
>>     In particular, look at the last sentence.  That is the
>> way PB has always worked to my knowledge.
>>
>> Richard
>>
>> <Milo> wrote in message
>> > news:453e281f.5a2e.1681692777@sybase.com... In the
>> > Activate event, there is a line of code to close the
>> current response(w_response) window but the code after
>> > this line continues to run in this window without giving
>> > control back to the calling window.  The response
>> > windows was opened with...
>> >
>> > openwithparm(w_response, lv_id )
>> >
>> > Then after some code is run it is supposed to close...
>> >
>> > closewithreturn(w_response, "continue")
>> > more code...
>> >
>> > This code was originally written in PB5 and the program
>> > has since been migrated to PB10.  Any thoughts or ideas
>> > are appreciated.
>> >
>> > Thanks in advance,
>> > Milo
>>
>> 


0
Andrew
10/25/2006 12:59:47 AM
 There is the original problem .. the coder did not understand that the
"Activate" event occurs more than once during the Window instantiation and
before the Open!


<Milo> wrote in message news:453e56e8.5ec9.1681692777@sybase.com...
> I just moved the original code from the Activate event to
> the Open event and it works.  That is great and I will move
> on, but the question is why?  All opinions are appreciated.
>
> Thanks,
> Milo
>
> > Milo,
> >
> >     If I understand you correctly, all you need to do is
> > add a "RETURN" statement after the closewithreturn call.
> > The help for close with return states:
> >
> > Just as with Close, CloseWithReturn removes a window from
> > view, closes it, and executes the script for the
> > CloseQuery and Close events, if any. Before executing the
> > event scripts, it also stores returnvalue in the Message
> > object. Then PowerBuilder executes the rest of the script
> > that called the CloseWithReturn function.
> >
> >     In particular, look at the last sentence.  That is the
> > way PB has always worked to my knowledge.
> >
> > Richard
> >
> > <Milo> wrote in message
> > > news:453e281f.5a2e.1681692777@sybase.com... In the
> > > Activate event, there is a line of code to close the
> > current response(w_response) window but the code after
> > > this line continues to run in this window without giving
> > > control back to the calling window.  The response
> > > windows was opened with...
> > >
> > > openwithparm(w_response, lv_id )
> > >
> > > Then after some code is run it is supposed to close...
> > >
> > > closewithreturn(w_response, "continue")
> > > more code...
> > >
> > > This code was originally written in PB5 and the program
> > > has since been migrated to PB10.  Any thoughts or ideas
> > > are appreciated.
> > >
> > > Thanks in advance,
> > > Milo
> >
> >


0
Chris
10/25/2006 12:58:20 PM
> the coder did not
> understand that the "Activate" event occurs more than once
> during the Window instantiation and BEFORE the Open!
Interesting statement. Any chance you can prove it?
0
Philip
10/25/2006 2:32:29 PM
I'm not sure I agree with the statement about timing (I try never to count on
sequences of events that aren't documented), but I'd also suspect a lack of
understanding may be involved here. A *lot* of Activate code I see seems to make
assumptions about when and how often it's occurs (and it occurs a lot more than
a lot of people expect). 

My suggestion for OP is that if the business requirement is met by putting the
code in the Open event, then IMHO the Activate event was the wrong place to put
the code in the first place. If it needs to happen *once* when the window is
instantiated, then *Open* is the trigger it should be tied to. The change in
behaviour is probably just a change in an undocumented, hence unguaranteed,
sequence of events.

Good luck,

Terry [TeamSybase] and Sequel the techno-kitten

On 25 Oct 2006 07:32:29 -0700,
 in sybase.public.powerbuilder.general
 <Philip Salgannik> wrote: 
>> the coder did not
>> understand that the "Activate" event occurs more than once
>> during the Window instantiation and BEFORE the Open!
>Interesting statement. Any chance you can prove it?

*********************************
PowerBuilder for $95? No.
Personal use PowerBuilder Enterprise *AND* PocketBuilder *AND* DataWindow.NET
*AND* Sybase IQ as free benefits of am ISUG membership. See
http://www.isug.com/ISUG3/Membership_benefits.html for details.

*********************************
Click once a day to help the hungry
http://www.thehungersite.com
*********************************
User Manual
===========
TeamSybase <> Sybase employee
Forums = Peer-to-peer
Forums <> Communication with Sybase
IsNull (AnswerTo (Posting)) can return TRUE
Forums.Moderated = TRUE, so behave or be deleted
*********************************

Sequel's Sandbox: http://www.techno-kitten.com
Home of PBL Peeper, a free PowerBuilder Developer's Toolkit. 
Version 3.0.02 now available at the Sandbox
PB Futures updated Apr 24/2006
See the PB Troubleshooting & Migration Guides at the Sandbox
^ ^
o o
=*=
0
Terry
10/25/2006 2:57:04 PM
This can happen if during the instantation process you have in the activate
event something like a MessageBox or you open another windows and that
windows do some processing and close inmediatly, but in regular conditions
(empty application) this should not happen (at less you are debugging in the
activate event).

--

Alexander Pire
PowerObjects
www.powerobjects.com
612.339.3355
**IT Solutions - Outside the Box**

<Philip Salgannik> wrote in message
news:453f757d.70e9.1681692777@sybase.com...
> > the coder did not
> > understand that the "Activate" event occurs more than once
> > during the Window instantiation and BEFORE the Open!
> Interesting statement. Any chance you can prove it?


0
Alexander
10/25/2006 3:03:10 PM
 I use an event logging utility (old PB advanced course thingy) and it shows
the Activate and GetFocus being done repeatedly before the Open. Alos,
between PB and O/S releases, the timing of the events has changed as well. A
very dangerous place to code (just like the "other" event).


<Philip Salgannik> wrote in message
news:453f757d.70e9.1681692777@sybase.com...
> > the coder did not
> > understand that the "Activate" event occurs more than once
> > during the Window instantiation and BEFORE the Open!
> Interesting statement. Any chance you can prove it?


0
Chris
10/25/2006 3:14:04 PM
My point exactly: ensure that a move of the code to the Open event still 
meets *all* business requirements, ie give some thought to why it might have 
been put in the Activate event deliberately and correctly.  If there is 
nothing suggesting that this was the case (suggesting that the Activate 
event was the wrong place to put it originally) and the move to the Open 
event meets all business requirements then, yes, move it.  My post was a 
warning to make sure that all business requirements had been determined and 
considered before moving the code.

-- 
Andrew Giulinn
Senior Analyst/Programmer
Integrated Aviation Software Pty Ltd

"Terry Voth" <sequel@techno-kitten.com> wrote in message 
news:453f7b40@forums-1-dub...
> I'm not sure I agree with the statement about timing (I try never to count 
> on
> sequences of events that aren't documented), but I'd also suspect a lack 
> of
> understanding may be involved here. A *lot* of Activate code I see seems 
> to make
> assumptions about when and how often it's occurs (and it occurs a lot more 
> than
> a lot of people expect).
>
> My suggestion for OP is that if the business requirement is met by putting 
> the
> code in the Open event, then IMHO the Activate event was the wrong place 
> to put
> the code in the first place. If it needs to happen *once* when the window 
> is
> instantiated, then *Open* is the trigger it should be tied to. The change 
> in
> behaviour is probably just a change in an undocumented, hence 
> unguaranteed,
> sequence of events.
>
> Good luck,
>
> Terry [TeamSybase] and Sequel the techno-kitten
>
> On 25 Oct 2006 07:32:29 -0700,
> in sybase.public.powerbuilder.general
> <Philip Salgannik> wrote:
>>> the coder did not
>>> understand that the "Activate" event occurs more than once
>>> during the Window instantiation and BEFORE the Open!
>>Interesting statement. Any chance you can prove it?
>
> *********************************
> PowerBuilder for $95? No.
> Personal use PowerBuilder Enterprise *AND* PocketBuilder *AND* 
> DataWindow.NET
> *AND* Sybase IQ as free benefits of am ISUG membership. See
> http://www.isug.com/ISUG3/Membership_benefits.html for details.
>
> *********************************
> Click once a day to help the hungry
> http://www.thehungersite.com
> *********************************
> User Manual
> ===========
> TeamSybase <> Sybase employee
> Forums = Peer-to-peer
> Forums <> Communication with Sybase
> IsNull (AnswerTo (Posting)) can return TRUE
> Forums.Moderated = TRUE, so behave or be deleted
> *********************************
>
> Sequel's Sandbox: http://www.techno-kitten.com
> Home of PBL Peeper, a free PowerBuilder Developer's Toolkit.
> Version 3.0.02 now available at the Sandbox
> PB Futures updated Apr 24/2006
> See the PB Troubleshooting & Migration Guides at the Sandbox
> ^ ^
> o o
> =*= 


0
Andrew
10/25/2006 11:44:12 PM
Reply:

Similar Artilces:

Powerbuilder 10 and MAPI does not work, works in PB 7
Hi, I have a powerbuilder application that uses MAPI to send e-mails using the customers e-mail client. Customer uses Netscape 4.7 With Powerbuilder 7.0, everything worked fine. Now with PB 10, the mailLogon function always fails. With PB 7 it works with Netscape, Outlook and Outlook Express. With PB 10, it does NOT work with Netscape and Outlook Express. It works with Outlook 2000, but only if I put the real e-mail address in both 'name' and 'address' Problem is: customer definitely uses Netscape. Anyone has any ideas ? Perhaps something to do with PB 10 w...

Powerbuilder 10 and MAPI does not work, works in PB 7
Hi, I have a powerbuilder application that uses MAPI to send e-mails using the customers e-mail client. Customer uses Netscape 4.7 With Powerbuilder 7.0, everything worked fine. Now with PB 10, the mailLogon function always fails. With PB 7 it works with Netscape, Outlook and Outlook Express. With PB 10, it does NOT work with Netscape and Outlook Express. It works with Outlook 2000, but only if I put the real e-mail address in both 'name' and 'address' Problem is: customer definitely uses Netscape. Anyone has any ideas ? Perhaps something to do with PB 10 w...

Select in Powerbuilder Database painter WORKS but does NOT in Powerbuilder run mode.
I have enclosed the actual information from a debug run. Will apprecaite any hints. Thanks Jim jimo@jdssc.com in ls_mod_string DataWindow.Table.Select="SELECT DISTINCT ~"inv_dtl~".~"inv_id~", ~"inv_dtl~".~"orig_cost~", ~"inv_dtl~".~"last_cost~", ~"inv_dtl~".~"regular_cost~", ~"inv_dtl~".~"orig_price~", ~"inv_dtl~".~"current_price~", ~"inv_dtl~".~"sugg_price~", ~"inv~".~"vend_id~", ~"inv~".~"style~", ~...

Working
I have two servers running NW65sp4A (different trees). I initially installed BM3.8 patched to sp4 with VPN services ( Firewall services to follow after I know I have VPN working). My problem is that it appears to be working but its not working. I can open my Windows Explorer (from the SLAVE side network) and reach the MASTER, authenticate and open files. The MASTER NRM VPN monitor shows 1 (one) Active Connections 0 (zero) Packets Received and lots of Packets Sent. The VPN Member List Status shows both servers as ´┐ŻBeing Configured´┐Ż. The Audit Log has two recurring RED entrie...

Select in Powerbuilder Database painter WORKS but does NOT in Powerbuilder run mode.
I have enclosed the actual information for a debug run. Will apprecaite any hints. Thanks Jim jimo@jdssc.com in ls_mod_string DataWindow.Table.Select="SELECT DISTINCT ~"inv_dtl~".~"inv_id~", ~"inv_dtl~".~"orig_cost~", ~"inv_dtl~".~"last_cost~", ~"inv_dtl~".~"regular_cost~", ~"inv_dtl~".~"orig_price~", ~"inv_dtl~".~"current_price~", ~"inv_dtl~".~"sugg_price~", ~"inv~".~"vend_id~", ~"inv~".~"style~",...

CloseWithReturn not working
I am trying to alter a print dialog box, inherited from w_print, pfc_w_print, w_response, pfc_w_response. The descendant window has a close() on the pfc_default and pfc_cancel events. I am trying to change this to a CloseWithReturn(). It will not work at all, no matter what I try to pass back. The CloseWithReturn always returns -1. The close event script does execute, but the window stays open. Is this overridden at all in the pfc ancestry? Ben try using messageparam.string Ben Watt wrote: > I am trying to alter a print dialog box, inherited from w_pr...

What generals generally do
Reading a McChrystal thread elsewhere, I came across someone quoting a US general http://en.wikipedia.org/wiki/Smedley_Butler > I spent 33 years and four months in active military service and > during that period I spent most of my time as a high class thug for > Big Business, for Wall Street and the bankers. In short, I was a > racketeer, a gangster for capitalism. I helped make Mexico and > especially Tampico safe for American oil interests in 1914. I helped > make Haiti and Cuba a decent place for the National City Bank boys to > collect revenues in. I ...

Generally worked well
Name: Atif Email: rmpjayatgmaildotcom Product: Gran Paradiso Alpha 1 Summary: Generally worked well Comments: It fails to load videos on youtube.com I hope that this does get ironed out, because Firefox is highly unstable with Windows x64 (which im running) Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.2 x64; en-US; rv:1.9a1) Gecko/20061007 Minefield/3.0a1 ...

PowerBuilder Does not work with Informix
PowerBuilder Does not work with Informix please be more specific. what version of pb, informix, what doesn't work, any error message etc. -- Terry Dykstra (TeamSybase) http://powerbuilder.codeXchange.sybase.com/ http://www.pb9books.com Enhancement Requests: http://www.isug.com/cgi-bin/ISUG2/submit_enhancement <L> wrote in message news:40914533.62c4.1681692777@sybase.com... > PowerBuilder Does not work with Informix ...

mobilink general working
I have read the mobilink help but still do not understand how it works. I would appreciate if someone could help me with these questions in the situation we upload the consolidated database from a desktop remote database. 1. dbmlsync is the program which creates the upload stream? 2. to create the upload stream the information send to the consolidated database is taken from the log file and not from the db file. 3. because the data comes from the log file the sync software knows which records are deleted at the remote database. Is this correct? Thanks Eric There ...

General shortcuts not working
i'm using openSUSE 11.1 and KDE 4.2.2 release 114 after last update general shortcuts stoped working when I go to Personal Settings->Keyboard & Mouse->Keyboard Shortcuts I get this dialog: Code: -------------------- Failed to contact KDE global shortcuts daemon Message: No such object path '/KdedGlobalAccel' Error: org.freedesktop.DBus.Error.UnknownObject -------------------- if I try to change general shortcuts in any application, dialog saying "The shortcut '-typed shortcut-' conflicts with the following key combinations:&quo...

powerbuilder working with DB2
Hi All, I have a question about powerbuilder working with DB2. The situation is that using powerbuilder as front-end tools and DB2 as back-end tools. But DB2 SQL statement just accepts single quote of string data type and powerbuilder using double quote for string . So there will occurs error when update datawindow because of the problem of double quote. Are there any solutions to solve the problem? Thanks a lot !! Eric ...

working on branches in powerbuilder
When working on our project we can occasionally have people working different branches of the code. Is there any way to manage this inside of powerbuilder 9 without putting each branch in it's own repository and then checking out from that repository when doing work? "Rich Catlett" <rc2581@sbc.com> wrote in message news:%235xMyl8RDHA.298@forums-2-dub... > When working on our project we can occasionally have people working > different branches of the code. Is there any way to manage this inside of > powerbuilder 9 without putting each branch in it'...

Does not work as Safari works
Name: Norihide Kimura Email: nkimuraatwtadotattdotnedotjp Product: Firefox Release Candidate Summary: Does not work as Safari works Comments: Please refer to the URL http://web.mac.com/nori44/. There is PHOTOS(PARTY) which is clicable name on the topline of the page. When you click of it, ther should be appeared the photographs and you will be able to enjoy slidshows on Mac Safari or Firefox Windows version. But it doesn't work on Firefox Mac version. Browser Details: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; ja-JP-mac; rv:1.9) Gecko/2008051202 Firefox/3.0 From...

Web resources about - closewithreturn not working... - sybase.powerbuilder.general

Resources last updated: 12/8/2015 9:37:14 PM