Question about PlayBASIC project / Include Files

Started by servogod85, November 06, 2005, 12:09:22 PM

Previous topic - Next topic

servogod85

*If I write a psub in a source file different from the main.pb, can I recall it in the main source file?
*If I declare variables in a non-main.pb source file, can I use the variable in the main source?

Thanks,

Sal

kevin

Quote*If I write a psub in a source file different from the main.pb, can I recall it in the main source file?

yes, you can call it from any place within your program


Quote*If I declare variables in a non-main.pb source file, can I use the variable in the main source?

yes, provided that the declaration includes appear before their used.

Ie.

Imagine you have 3 includes  [Declares] , [Functions] & [Main]  arrange in that order.

Then you source is built like so


[Declares]
 All your declaration code


[Functions]
 Your functions & psubs

[Main]
  Your main program


Now since the declares are at the top, their visible to everything bellow it.

servogod85

I think I know what you mean, so I will test out what I think you said. So I just Declar e new surce.file called Declare and another source called Functions and make them subordinate to main?

(This is the Project Management area)

---Main.Pb
------Declares
------Funtions



Is that what you mean?? Lol I am sorry just be patient

Sal

kevin

Nah, that's backwards.  The declares should be first. (the top )

You can change the order of your includes in the Project / Manage Project  section of the IDE

So in our example, they'd be listed like so..


--1) Declares
--2) Functions
--3) Main

kevin

Here's an example project, doesn't do much, but it's set out like the above.

servogod85

Great, thaks a lot. Right now I am working, but in about....lets say...9 hours (I got college as well to handle) I will check  it out. Thanks once again for the help.

Sal