Discussion forum about PANORAMIC language

Mac, Windows & Android application development with PANORAMIC language
 
HomeFAQSearchRegisterMemberlistUsergroupsLog in
Latest topics
» Hello world.
by Mon Jun 19, 2017 1:37 am

» Biomorphes de PICKOVER
by Sun Jun 18, 2017 2:33 am

» In less than 10 lines of code
by Fri Jun 16, 2017 5:03 am

» Effect Dopler
by Fri Jun 16, 2017 3:29 am

» SuperEllipse
by Wed Jun 14, 2017 4:01 am

» Plants
by Wed Jun 14, 2017 3:38 am

» Mira's attractor
by Wed Jun 14, 2017 3:30 am

» Triangle of Sierpinski
by Wed Jun 14, 2017 3:22 am

» Esthétique polaire
by Wed Jun 14, 2017 3:16 am

» Butterfly effect : Lorenz equations
by Wed Jun 14, 2017 3:08 am

» Collision detection
by Tue Jun 13, 2017 5:09 am

» The Bees Laline Paull Epub Books
by Mon Oct 10, 2016 8:58 pm

» PANORAMIC for Mac OSX 10 is available
by Tue Aug 09, 2016 6:08 pm

» ide
by Sat Jul 16, 2016 12:27 am

» Can I change the program icon/logo in my application ?
by Thu Jul 07, 2016 3:32 am

Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

Share | 
 

 Beginner Tutorial - Part 1 Basics

View previous topic View next topic Go down 
AuthorMessage
Gregory



Number of posts : 9
Age : 35
Localisation : South Africa
Registration date : 2010-05-12

PostSubject: Beginner Tutorial - Part 1 Basics   Mon Jun 07, 2010 12:03 pm

Welcome to to the first in this series of tutorials for users of
Panoramic Basic. These tutorials were designed with beginners in
mind, but may contain ideas for older user as well.

Panoramic Basic (PB), is an easy to use programming language for
creating flexible and dynamic windows applications in the shortest
amount of time. The syntax is clear and easy to learn and understand
without sacrificing and performance when compared to other languages.
Here is a quick example:

Code:

rem Set the windows width and height...
width 0, 400
height 0, 400

Now push the lightning bolt button on the toolbar to run the application
and you should see a window a popup with a width of 400 pixels and height
of 400. Only three lines and we have a window! (2 minus the comment)
Panoramic automatically defines the first window for you and stores it
in the system object 0. A system object can be thought of as a handle
from other languages. What the system object 0 does is, allow you
control or change aspects about the window through its number identifier,
in this case being 0.

Lets go over this code line by line...

Code:

rem Set the windows width and height...

This line is known as a comment as will be ignored by the PB. The only
purpose of this line is to let the programmer write short lines that
explain what the code he/she has written does, or it allows the programmer
to make notes for future reference. In our case it states what the size
of the window will be, 400 wide and 400 high.

Code:

width 0, 400
height 0, 400

Using the windows number identfier of 0, this line of code tell PB to
make the window 400 pixels wide, and 400 pixels high. There are ways
to set the exact postion of the window as well which we will cover
shortly.
Now lets add a button...

Code:

rem Set the windows width and height...
width 0, 400
height 0, 400

rem Create a button to close the window...
button 1
caption 1, "Quit"

As you can see from the code above, the button gets a number identifier
as well, 1. Through this, we change anything about the button we
like, such as the title you see on the button. To change the button's
title we, use the caption keyword. If you run the program now,
you should see your window you created, plus a Quit button in the top
left corner, thats not very convienient so lets change it...

Code:

rem Create a button to close the window...
button 1
caption 1, "Quit"
top 1, 170
left 1, 150

Remember when i said you could set the position of the window? Well you
can do the same with buttons, with any system object in fact, simply by
using the two keywords, top and left. Top, works along the
Y axis, up or down. Left works along the X axis, left to right. But using
these two keywords, you can place the button anywhere you like inside the
windows area, also known as the client area. But wait you say!! The button
does nothing when clicked! This is because we have to set an event for the
button before it knows what you need it to do. An event, simply tells the
button which action to perform, eg: close window, open next window, etc.
Before you can create an event handler for your button, you need to know
what labels are.

Code:

rem The close window sub...
label QuitApp

The lines of code above, define a label in PB. A label can be thought
of as just that. If you had a list of chores to do, eg: Ironing, Cooking etc,
each chore you have to do has a name, and according to that name, each chore
has its own actions that you need to perform, such as cooking the roast or
letting the iron get hot. Its exactly the same in PB. You define a label that
covers what actions you need to perform. What this label also does is define
the name of the Sub which will perform these acions or commands. We will cover
Subs in a later tutorial but for now you can think of them as individual groups
of actions. Lets see this in action with the button we made, and the QuitAapp
label.

Code:

label CloseApp

rem Create a button to close the window...
button 1
caption 1, "Quit"
top 1, 170
left 1, 150

rem Wait here...
end

rem The subs defined by the labels...
QuitApp:
    terminate


Here we are introduced to a new keyword, <b>end</b>. The end keyword is placed
on the last line of our program, right before the labels we defined earlier begin
to take action. If we never placed the end keyword in our program, PB would run
straight down into our Subs, and our program would cease to run correctly. This is
not limited to PB only, but computer programming in general. To stop this behaviour,
you must place the end keyword, before any of your subs defined by the labels. After
the QuitApp label, there is a semi-colon, you can think of this as simply PB's way
of knowing where you are stating what actions need to be performed by that Sub. Again,
dont worry if you are unsure about Subs, they will be explained in depth.

In the next part of these tutorials, we will begin to learn how the event works and start to uncover the secrets of PB
Back to top Go down
View user profile
Severin



Number of posts : 19
Localisation : Germany/Braunschweig
Registration date : 2010-12-13

PostSubject: Re: Beginner Tutorial - Part 1 Basics   Sat Mar 30, 2013 8:00 am

****************************************
PANORAMIC V 0.9.24 ist verfügbar
PANORAMIC V 0.9.24 is available
PANORAMIC V 0.9.24 est disponible
PANORAMIC V 0.9.24 es disponible

Das Forum Panoramic ist wieder aktiv.
Bitte besucht uns.

The forum Panoramic is active again.

Please, visits us.

Le forum Panoramic est actif de nouveau.

S'il vous plaît, nous visite.

El foro Panoramic es de nuevo activo.

Por favor, nos visita.
********************************************
Back to top Go down
View user profile
 
Beginner Tutorial - Part 1 Basics
View previous topic View next topic Back to top 
Page 1 of 1
 Similar topics
-
» Beginner Selinium Webdriver
» Any video/flash tutorials available for selenium?
» I know the volcano story is becoming part of history.
» Selenium tutorials for beginners/newbie
» Social Engineering Tutorial

Permissions in this forum:You cannot reply to topics in this forum
Discussion forum about PANORAMIC language :: Panoramic for Windows :: Source code (snippets)-
Jump to: