[futurebasic] Re: [FB] Re: Skeletons

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : June 2002 : Group Archive : Group : All Groups

From: Jay <jktr@...>
Date: Sun, 2 Jun 02 18:27:06 -0500
>Here is another example of why I'd like a shell. Without a shell all 
>I can do is study this example. With a shell I could drop this code 
>in an appropriate location and run it to see what it does. This is 
>mainly an issue with my being a novice with this language (although 
>I've studied BASIC before, it's been so long that it is effectively a 
>new language to me, especially with all the GUI elements).
>
>Thanks,
>-- 
>--- Chip - n1mie@...
>     FN31xm
Chip,

First off, welcome. You've had so much input in such a short time that I 
hesitate to pile more on, but this post hilights a point I think you may 
have missed about FB.

You say you'd like a shell in which to run Ken's code... Try this:

1. Copy the lines below (Ken's example reproduced.)

dim as rect r
setrect( r , 20, 50, 400, 300 )
window 1, "test window 1", @r
offsetrect( r, 50, 50 )
window 2, "test window 2", @r
offsetrect( r, 50, 50 )
window 3, "test window 3", @r
insetrect( r, 50, 50 )
window 4, "test window 4", @r
offsetrect( r, 50, 50 )
window 5, "test window 3", @r

do
handleevents
until fn button

2. Go to the FB^3 editor, select New, and then Paste.

3. Choose Standard BASIC* from the Command menu.

4. Cmd-R to run it.

Voila, you see Ken's demo in action. One of the reasons we don't have 
lots of established skeletons in our closets it that FB is versatile 
enough to allow us to do this kind of thing without them. If you 
experiment with the Console Runtime*, you'll see you can even do this 
kind of thing:

1. select New, then type (or paste) the following line:
print "pi ^ pi ="; pi ^ pi

2. Make sure Console is selected in the Command menu

3. Run to see the value of pi to the power pi. Can you believe it's that 
simple?

Sometimes the trick is to find the right question to ask. When you asked 
about shells, Ken provided a very useful and workable starting point and 
others have amplified it, but no one seems to have recognized that you 
may have been asking, "How do FB programmers manage all the things that 
have to be managed in a program?"

Yes, for major projects there are PG and a variety of shells, but for 
small things (almost anything that can be posted to this list), it really 
isn't necessary to deal with all that stuff.

*Console vs Standard BASIC--

Anything creating windows, edit fields, buttons, etc., requires the 
Standard BASIC runtime (or Appearance) and, usually, an event loop, as 
jonathan or someone mentioned. You can paste an event loop into your code 
by choosing BASIC Event Loop from the Scripts menu.

If you don't need windows or other objects, you can use the Console 
runtime and FB will handle all the interface. (Be sure you DON'T have an 
event loop in Console.)

HTH,
 e-e
 =J= a  y
  "