Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 RunTime Error: Inopened or dosed stream passed to 'setactive
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
syntax0r




PostPosted: Fri May 13, 2005 10:19 pm   Post subject: RunTime Error: Inopened or dosed stream passed to 'setactive

In my Turing 4.0.4c program, I get an a run time error, however:

-This error only occurs when the program is compiled to an .exe. I get NO errors when I'm running in the source code in the turing IDE.

-Even when compiled, the program works as it's supposed to. The error seems not to affect the performance of the program (except for being visible onscreen)

-When compiled, the error only occurs in the program when the user clicks on any GUI exit button with of course a quit procedure. I can hit the "X" on the window, and the error would not pup up.


I've uploaded the picture of the error. This is quite an anomaly, but I'm starting to suspicious of the quit button intefering with my several "read" and "write" (load, save) procedures.

I don't want to give away my source code as of now, but I'm willing to give it privately for those kind enough to help fix the problem.

And here's the quit procedure used for the "quit" button's action. Notice how I don't use the GUI.Quit action, I just close the main window of my program.

code:
proc closeWindow %To close main Menu. Procedure will close the "mainWindow"
    Window.Close (mainWindow)
end closeWindow



rt - error .jpg
 Description:
run time error
 Filesize:  28.87 KB
 Viewed:  2814 Time(s)

rt - error .jpg


Sponsor
Sponsor
Sponsor
sponsor
Dan




PostPosted: Sat May 14, 2005 1:38 am   Post subject: (No subject)

From the error alone it looks like a problem with i/o streams, so it probly has to do with your reading and writing to files that u mentioned. It whould be helpfull if you posted more of your code.

Also turing compleing to exes has never been 100% and is know to be buggy so it is posabl you found another bug in that if u get no errors when u run it in turing. Inadtion, there are spick ways you should deal with opening and closing windows in turing, i blive there is a tutoral on it some where in the turing sections.
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
Delos




PostPosted: Sat May 14, 2005 9:39 am   Post subject: (No subject)

This error looks familiar...a while back a friend of mine and I were working on a database system for our grade 12 assignment, and a very similar error kept popping up. If I recall correctly, it occured even in the OOT environment, and had to do with the activation/inactivation of the various onscreen windows.
He fixed the problem, but it involved editting the OOT system modules. I never did quite understand how he did it, but then again his methods were generally legendary.
I don't think the error has anything to do with files, because it involves "setactive". Chances are its the windows that are screwing you up.
Check your code and make sure that window activation is clean throughout - i.e., you don't try call a closed window at any time, or anything like that...
syntax0r




PostPosted: Sat May 14, 2005 3:31 pm   Post subject: (No subject)

Oh man Sad...

Thanks for the input tho.

I checked my code and it looks fine. Either I should blame turing or myself.

If anyone wants to view my source code (mind u that I'd only sent u the .t file, not all the pics/sounds and etc), id be more than happy to do so.
7h3Q




PostPosted: Wed May 18, 2005 9:24 am   Post subject: Same Problem

i'm having a very similar problem, if not the same. my problem originates in line 295 of wigdetmodule.tu. i did not create this file, so i assume its a file generated by turing. this error also occurs only when i exit a compiled exe, otherwise the program runs fine
Bacchus




PostPosted: Wed May 18, 2005 8:57 pm   Post subject: (No subject)

ya i think i had that one before, but i fixed it by changing something in the file that gave the error. it was like a typo or something, cant really remember Sad
syntax0r




PostPosted: Wed May 18, 2005 10:02 pm   Post subject: (No subject)

Do you think it was an error with the open, close stremin, stremout (read, write) commands, or just the Turing's GUI file? or perhaps both?

The save load and the Quit button closing the widget window ID.
Bacchus




PostPosted: Thu May 19, 2005 6:09 am   Post subject: (No subject)

im pretty sure it was something in the GUI file
Sponsor
Sponsor
Sponsor
sponsor
syntax0r




PostPosted: Thu May 19, 2005 9:26 am   Post subject: (No subject)

Damn Turing

I found the source of the error

code:

import GUI

var mainWindow : int := Window.Open ("graphics")
proc closeWindow %To close main Menu. Procedure will close the "mainWindow"
    Window.Close (mainWindow)
end closeWindow


var buttonQuit : int := GUI.CreateButton (maxx div 2 - 51, maxy div 2 - 90, 0, "Quit", closeWindow)

loop
    exit when GUI.ProcessEvent
end loop

Compile that to an .EXE and u should get an error.

I thought it had to do with save load procedures. guess not.


So, is there any solution?
Bacchus




PostPosted: Thu May 19, 2005 10:14 pm   Post subject: (No subject)

the error your getting there is because ur closing the window before the GUI can check for the event which uses the curent windows ID. but wait! how can the GUI check the current windows ID if the current window is non-existent!. just add GUI.Quit just before you close the main window. not sure if u place it somewhere else, that all i tried
syntax0r




PostPosted: Fri May 20, 2005 6:22 am   Post subject: (No subject)

Thank you so much Bachus! It works.

Here's what u suggested

code:


import GUI

var mainWindow : int := Window.Open ("graphics")
proc closeWindow %To close main Menu. Procedure will close the "mainWindow"
   
   
end closeWindow


var buttonQuit : int := GUI.CreateButton (maxx div 2 - 51, maxy div 2 - 90, 0, "Quit", GUI.Quit)

loop
    exit when GUI.ProcessEvent
end loop
Window.Close (mainWindow)
syntax0r




PostPosted: Fri May 20, 2005 10:28 am   Post subject: (No subject)

Ok, I fixed it! But there's another problem. I get the same error somewhere else in my program, which does not feature GUI buttons, because I cannot get a get and a gui button working together.

code:

        View.Set ("cursor,echo")
        locate (maxrow div 2, maxcol div 2)
        get choice
        if choice = 1 then
            save
        else
            exit
        end if

    end loop

    Window.Close (mainWindow)


end mainMonkey



There's no GUI buttons but I get an error same as i had earlier.

If it put a GUI.Quit i get another error "Close closed stream" or something.

I am not sure what is happening, any help?
Bacchus




PostPosted: Fri May 20, 2005 3:19 pm   Post subject: (No subject)

post the full proc, so like:
code:

proc blahblah
..
end blahblah

var theguibutton:int:=GUI.blahblah

loop
exit when GUI.ProcessEvent
end loop
syntax0r




PostPosted: Sat May 21, 2005 12:29 am   Post subject: (No subject)

Thanks for the help, but I've already found a solution. Yes, yes... sometimes you just have to be creative Razz

I gave you some bits for the very kind, invaluable help.
Bacchus




PostPosted: Sat May 21, 2005 11:20 am   Post subject: (No subject)

y ty Very Happy glad i could be of some help
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 15 Posts ]
Jump to:   


Style:  
Search: