Why doesn't project close?

Here's where to discuss using Stéphane Leys' very well done alternative runtime editor. If you're a control freak at runtime you have to check this out!

Why doesn't project close?

Postby drpitcairn » Sat Nov 20, 2010 6:49 pm

If I go to File/Close project... the entire project does not go away. One window remains. Here is what it looks like.
not closing window.gif
not closing window.gif (57.14 KiB) Viewed 6123 times


If I repeat this process, go to File/Close project... again, then it does a final close.

Why must I do it twice?
User avatar
drpitcairn
 
Posts: 1023
Joined: Thu Apr 02, 2009 9:39 am
Location: Sedona, Arizona

Re: Why doesn't project close?

Postby Dave_Higgins » Sat Nov 20, 2010 7:30 pm

I would suggest typing "trace" into the msg box, then going after the menu (first run). Stepping through, you will probably find out there what's going on.
My two favorite teams are Detroit and whoever's playing Chicago.
User avatar
Dave_Higgins
 
Posts: 454
Joined: Mon Jul 07, 2008 9:50 am
Location: Dark Side Of The Moon

Re: Why doesn't project close?

Postby drpitcairn » Sun Nov 21, 2010 9:07 am

Well I tried your excellent suggestion many times without result. I have a closeproject script in place and I put "trace" into the beginning of it, but no trace happens until I close the project a second time. So something happening at the very beginning.
Here is the script (which refers to other scripts):
Code: Select all
on closeproject
    global textColorChange, colorIndicatorHolder
    close resources
    set the textcolor of line textColorChange of cd fld "index" of cd "Rubric list" to colorIndicatorHolder
    closeinsertedmenus
    set lockMessages to true
    answer "Do you have any entries in the Analysis you want to save?" with "Yes" or "No"
    if it is "no" then
        cleanup
    end if
    compact
end closeproject

On first closing the project the "answer" part does not activate, but it does on the second closing. So best I can tell there is something that happens before this. I have tried putting "trace" at the beginning of the script but no trace happens until the second closing.
I have turned off the lines from "close resources" to "set lockMessages to true" and there is no difference in what happens.
So, seems I am stuck and will appreciate suggestions.
User avatar
drpitcairn
 
Posts: 1023
Joined: Thu Apr 02, 2009 9:39 am
Location: Sedona, Arizona

Re: Why doesn't project close?

Postby Anderson » Sun Nov 21, 2010 9:09 am

May be multi window project and window that does not close is not the first window.???
Anderson.
iMac - Yosemite - SC(4.73)
User avatar
Anderson
 
Posts: 215
Joined: Mon Jul 21, 2008 9:00 am
Location: Perth County, Canada

Re: Why doesn't project close?

Postby drpitcairn » Sun Nov 21, 2010 9:18 am

Yes, it is a 2 window project. Are you saying that the windows close in a certain order? If so, should I change the order of the windows somehow? SuperEdit?
User avatar
drpitcairn
 
Posts: 1023
Joined: Thu Apr 02, 2009 9:39 am
Location: Sedona, Arizona

Re: Why doesn't project close?

Postby JimTheParr » Sun Nov 21, 2010 9:51 am

I don't see any "pass closeproject" in your handler. It doesn't sound like that's your only problem, but unless you execute "pass closeproject", your handler will intercept the close message and the project won't receive it.

Do you have another "closeProject" handler that might be intercepting the message before this one can receive it?

Good luck.                               --Jim
JimTheParr
 
Posts: 40
Joined: Sun Jul 06, 2008 2:18 pm
Location: Bloomington IL

Re: Why doesn't project close?

Postby drpitcairn » Sun Nov 21, 2010 10:06 am

Jim, good suggestion but not a solution. I added in the "pass closeproject" at the end of the script but made no difference. A real puzzle as the first close does not close any windows. What happens is that another window closes but then stops there.
User avatar
drpitcairn
 
Posts: 1023
Joined: Thu Apr 02, 2009 9:39 am
Location: Sedona, Arizona

Re: Why doesn't project close?

Postby Didier Gross » Sun Nov 21, 2010 10:21 am

rpitcairn wrote:On first closing the project the "answer" part does not activate, but it does on the second closing.


Probably the sign you have another closeProject handler (#1) which doesn't pass closeProject to this handler (#2).

The first time you close the project from the menu, the handler #1 executes, but as it doesn't pass closeProject, nothing more happens. I'd bet it relies in a window script and that this window closes properly. Once closed, the handler #2 gets the closeProject message when it is sent a second time.
Didier Gross
 
Posts: 47
Joined: Thu Sep 16, 2010 11:32 pm
Location: City of god Lug

Re: Why doesn't project close?

Postby Dave_Higgins » Sun Nov 21, 2010 10:50 am

Well, my first suggestion about using trace in the msg box won't do... It starts with the menuBarClick... So, you could try this:

Hold down the shiftKey while selecting "Close Project" menu item... This will allow you to edit the script of the menu item for "Close Project"... You will probably find it empty (this will be the menu item from RTE).

Enter the following script in there:

Code: Select all
on itemSelect
    trace
    pass itemSelect
end itemSelect


Now, when you go back to run that menu item, you'll be tracing through RTE's close project routine, but you may be able to figure out what's going on...

Just don't forget to go back and remove this script when you're done. :)
My two favorite teams are Detroit and whoever's playing Chicago.
User avatar
Dave_Higgins
 
Posts: 454
Joined: Mon Jul 07, 2008 9:50 am
Location: Dark Side Of The Moon

Re: Why doesn't project close?

Postby drpitcairn » Sun Nov 21, 2010 12:35 pm

I tried this but every time I hold down the shift key and use the MPI File/Close Project... then it opens up SC Help project. Tried several times. So???
Sorry to be so dense but I am over my head here.
User avatar
drpitcairn
 
Posts: 1023
Joined: Thu Apr 02, 2009 9:39 am
Location: Sedona, Arizona

Re: Why doesn't project close?

Postby Dave_Higgins » Sun Nov 21, 2010 1:38 pm

rpitcairn wrote:I tried this but every time I hold down the shift key and use the MPI File/Close Project... then it opens up SC Help project. Tried several times. So???
Sorry to be so dense but I am over my head here.

My boo boo... I missed that we were in the MPI forum. I was thinking you were using RTE.
My two favorite teams are Detroit and whoever's playing Chicago.
User avatar
Dave_Higgins
 
Posts: 454
Joined: Mon Jul 07, 2008 9:50 am
Location: Dark Side Of The Moon

Re: Why doesn't project close?

Postby S. Leys » Mon Nov 22, 2010 1:03 am

rpitcairn wrote:every time I hold down the shift key and use the MPI File/Close Project... then it opens up SC Help project.


Yes, this is the expected behavior in MPI, shift clicking an element or selecting a menu opens the corresponding help file.

You probably have in some close handler something which moves to another card and thus aborts the closing process.
For instance, something like that :
Code: Select all
on closewindow
    go cd 1
end closewindow


S.
User avatar
S. Leys
 
Posts: 628
Joined: Sun Jul 06, 2008 11:03 am

Re: Why doesn't project close?

Postby drpitcairn » Mon Nov 22, 2010 8:24 am

I have checked thoroughly. Using the Find function in MPI there is no other script that has "closeproject" in it.
Here is my script, all of it made non-active except for the handlers as you can see. Nonetheless, the same behavior happens. When I do a File/Close project..., then one visible window closes but the other stays open. The Overview window shows that nothing has really closed until I do it a second time.
I am out of ideas.

Code: Select all
on closeproject
    --    global textColorChange, colorIndicatorHolder
    --    close resources
    --    set the textcolor of line textColorChange of cd fld "index" of cd "Rubric list" to colorIndicatorHolder
    --    closeinsertedmenus
    --    set lockMessages to true
    --    answer "Do you have any entries in the Analysis you want to save?" with "Yes" or "No"
    --    if it is "no" then
    --        cleanup
    --    end if
    --    compact
    --    pass closeproject
end closeproject
User avatar
drpitcairn
 
Posts: 1023
Joined: Thu Apr 02, 2009 9:39 am
Location: Sedona, Arizona

Re: Why doesn't project close?

Postby Scott » Mon Nov 22, 2010 8:32 am

First of all, I would suggest eliminating the runtime editors; Quit SuperCard, open your project in SuperEdit, and select the Run command from the File menu.

This will open your project in the runtime without the Runtime Editor or MPI (at least I would hope no MPI but I can't say for sure).

Now… you have a menu in your own project for closing/quitting the project? Try that and see if you get the expected behavior.
User avatar
Scott
Site Admin
 
Posts: 1235
Joined: Sat Jul 05, 2008 1:37 pm
Location: Northern Sierra Nevada

Re: Why doesn't project close?

Postby drpitcairn » Mon Nov 22, 2010 10:06 am

I tried this but didn't have a close script. However, I finally realized (and with the suggestion from Stephane) that the problem is (I think I understand) that the closeproject message is going to wd 3 which has a script in it to open wd 2. So I think that is why it gets stuck. The first time I do it, wd 3 closes, then next time (wd 3 being closed) now wd 2 will close properly.
I know this works OK as a standalone, so maybe I should just let it be, especially as I cannot figure out how to make it different.
Thanks for your help.
User avatar
drpitcairn
 
Posts: 1023
Joined: Thu Apr 02, 2009 9:39 am
Location: Sedona, Arizona

Re: Why doesn't project close?

Postby drpitcairn » Sat Nov 27, 2010 6:26 am

An update: Yes, I can see now that the script results in a return to a card (to clean up some things), so apparently this aborts the script. Works OK in a stand alone, so maybe not a problem.
User avatar
drpitcairn
 
Posts: 1023
Joined: Thu Apr 02, 2009 9:39 am
Location: Sedona, Arizona


Return to Using MPI

Who is online

Users browsing this forum: No registered users and 1 guest