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

Username:   Password: 
 RegisterRegister   
 read n run another turing file from oneprogram???
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
xmen




PostPosted: Sun Mar 28, 2004 3:38 pm   Post subject: read n run another turing file from oneprogram???

u see rite now im making screensaverS for an assignment. it starts with a "menu" (just simply with GUI buttons) for viewing the 5 screensavers, so the first button is screen 1 n etc

but the problem is, if i was to copynpaste all 5 screensavers' codes and complie them into one program for this assignment, im thinking that i'll lag quite alot (especially with school computers). so i justwanna ask u if theres a command (for GUI button procedure) to read n run another turing file/program once i click GUI button 1,2,3...... so i'll hav 6 programs
with 5 screensavers and one "menu" page
Sponsor
Sponsor
Sponsor
sponsor
Delos




PostPosted: Sun Mar 28, 2004 3:45 pm   Post subject: (No subject)

Quite simple, in more than 1 context.

Case 1:
Each screen saver is compiled as a seperate programme.
In your menu, you will have x number of buttons. Each button has an associated procedure.
In each procedure have a Sys.Exec (pathName) condition. I.e.:
code:

procedure but1
if Sys.Exec ("screen1.exe") then
% some sort of hide/exit statement here for your menu.
else
put "Can't find screen1.exe!"
end if


Check out the F10 entry on Sys for more info.

Case 2:
Each screen saver is not compiled.
In this case, modularize all your programmes and then import all modules into your menu file. In your GUI button procedures, call the modular reference.

code:

module screen1
export main

procedure main
locate (Rand.Int (0,10), Rand.Int (0,10))
put "Hey!"
end main
end screen1


That would be screen1.t

code:

import screen1
% This may not work perfectly...you may need something like
% import screen1 in "screen1.t"
% I'm typing on the fly so no time to check.

procedure but1
screen1.main
% This will call the reference within the module.
end but1

% rest of code.


So there you go. I'm sure there are some good Module tutorials available for your viewing pleasure/leisure.
sport




PostPosted: Sun Mar 28, 2004 3:50 pm   Post subject: Applications

The thing that you can do is open them as applications.

For Internet Adress
code:

if not Sys.Exec ("http://www.holtsoft.com/turing/support") then
    put "The Sys.Exec call failed"
    put "Error: ", Error.LastMsg
end if


For application

code:

if not Sys.Exec ("app.exe") then
    put "The Sys.Exec call failed"
    put "Error: ", Error.LastMsg
end if


You have to describe the full path to the file
xmen




PostPosted: Sun Mar 28, 2004 3:59 pm   Post subject: (No subject)

well i didnt make standalone for the screensavers.....so i guess i should go with case2, but i dun reli get in

can someone explain to me again??thankyou
the_short1




PostPosted: Sun Mar 28, 2004 4:55 pm   Post subject: (No subject)

good stuff about the module... i kinda tried it for my virtual keyboard but i gave up cuz my stomach is growling and im hungry... meh!... thx foir the info...

and sport... that is exactly what the person above u posted Laughing its all good...

and im sorry i cant explain that module bussiness cuz i dont realy get it either at the moment.... ill work on it after supper (doing wahat that person said) and if i understand it more i will tell u more info...
Delos




PostPosted: Sun Mar 28, 2004 6:16 pm   Post subject: (No subject)

Hey short1, don't worry.

I looked around, couldn't find one, so I made a tutorial for modules:

http://www.compsci.ca/v2/viewtopic.php?t=4303

Hopefully that will ease you into their use.
sport




PostPosted: Sun Mar 28, 2004 9:09 pm   Post subject: (No subject)

When I started posting there was nothing I guess Delos posted while I was looking through the help and by the time I was finished Delos already posted.
recneps




PostPosted: Mon Mar 29, 2004 3:51 pm   Post subject: (No subject)

or just do it the way i did for my school FP:
code:
procedure screen1
var win:int:=Window.Open ("graphics:640;480")
%stuff
window.close(win)
end screen1

procedure screen2
var win:int:=Window.Open ("graphics:640;480")
%stuff
window.close(win)
end screen2

procedure screen3
var win:int:=Window.Open ("graphics:640;480")
%stuff
window.close(win)
end screen3

procedure screen4
var win:int:=Window.Open ("graphics:640;480")
%stuff
window.close(win)end screen4

procedure screen5
var win:int:=Window.Open ("graphics:640;480")
%stuff
window.close(win)
end screen5

GUI.CreateButton(x,y,0,"Screen1",screen5)
GUI.CreateButton(x,y,0,"Screen2",screen5)
GUI.CreateButton(x,y,0,"Screen3",screen5)
GUI.CreateButton(x,y,0,"Screen3",screen5)
GUI.CreateButton(x,y,0,"Screen5",screen5)


that way it can open several windows to view each screensaver, then closes the window when it finishes, and you can still view more without restarting prog. Wink (and you only have 1 exe to worry about, or just plain 1 file)
Sponsor
Sponsor
Sponsor
sponsor
the_short1




PostPosted: Tue Mar 30, 2004 8:14 am   Post subject: (No subject)

u forgot something spencer....

%% boolean to exit program if true
var exitprogram : boolean := false

% proc to handle the exit button
proc endprogram
exitprogram := true
end endprogram

% The exit BUTTON
var exitbtn := GUI.CreateButton (300,300,0,"Exit",endprogram)

% Main loop so the program acually uses the buttons
loop
if GUI.ProcessEvent then %% BEST WAY TO DO THIS!
end if
exit when exitprogram = true
end loop


the turing reference suggests u do
loop
exit when GUI.ProcessEvent
end loop

but... say u have a game and if a button has not been pressed it WONT exit that loop and ur program gets stuck...

loop
game
loop %%% would get stuck if u dont press a button..
exit when GUI.ProcessEvent
end loop
end loop


hope that helpe...
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  [ 9 Posts ]
Jump to:   


Style:  
Search: