PANORAMIC HINTS

MAIN PAGE

1 GENERALITIES

2 - 3D WORLD

3 OBJECTS

4 MULTIMEDIA : SOUNDS, MUSICS, MOVIES

5 MISC

1 GENERALS

1.1 - What is the structure of a program?

The adviced structure of a program is as follow:

1 - Statement: LABEL and DIM

2 - Main program: definition of components (objects), calculations, behaviour, END

3 - Events handling

Example : create a button displaying "Clic on me", then "Hello!" when it is clicked.

rem declaration of used labels
LABEL clk

rem declaration of used variables
DIM a$

rem --- MAIN PROGRAM ---
a$="Click on me"
rem creation of an OBJECT
button 1
rem give it a small text to display
caption 1,a$
rem define the treatment when it is clicked
on_click 1,clk

rem --- END OF MAIN PROGRAM---
end

rem --- EVENT HANDLING ---
Clk:
caption 1,"Hello !"
return

to the top

2 - 3D WORLD

2.1- How to create a 3D world?

1 - First of all, create an object to display your 3D world with the keyword scene3d and give it a number:

scene3d 1

Then, a 3D camera and a 3D light are automatically created with your scene3d and now you can use them (to position them and to aim a point with the camera)

2 Place objects in your 3D world

You can create predefined 3D objects (3d_box, 3d_cube, 3d_cone, 3d_torus, 3d_sphere, 3d_cylinder, 3d_text, 3d_teapot, 3d_dodecahedron) or 3d objects formatted : 3d_mesh (in "3DS", format of 3D Studio Max) or 3d_actor (in "MD2", format of Quake).

With the corresponding keyword, you give it a 3D number:

3d_teapot 1

3 You can then move, scale, rotate, color, texture your objects...

to the top

2.2 - How to have a 3D world taking all the available space?

Create a 3d world :

scene3D 1

Give it all the available space in FORM number 0 :

full_space 1

Remark : to give all the space of the screen to FORM number 0 :

full_space 0

Combining the 2 commands, you have a 3D world taking all the screen :

full_space 0 : rem FORM0 take all the space on the screen
scene3D 1
full_space 1 : rem SCENE3D take all the space on FORM0

to the top

2.3 - How to have two 3D worlds with 3D objects?

Use 3D_TARGET_IS to designate the receiver of 3D object

scene3d 1 : rem create the first 3D world
scene3d 2 : rem create the second 3D world
left 2,210 : rem position it (otherwise it covers the first one)
3d_teapot 1 : rem create the first 3D object in the first 3D world
3d_target_is 2 : rem assign the second 3D world as receiver of 3D commands
3d_teapot 2 : rem create the second 3D object in the second 3D world

to the top

2.4 - How to color the background of a 3D world?

Use the number N of the scene3D (3D world has been created by command scene3d N) in the command color:

color N, Red, Green, Blue

to the top

2.5 - How to use 3D rotations ?

3D_X_rotate, 3D_Y_rotate, 3D_Z_rotate are relating to the own axes of the object.

The own axes of the 3D object are the axes which were parallel to the world axes when the 3D object was created.

The rotation angles are expressed in relation to the initial position:

3D_X_rotate N,30 : rem rotate the 3D object N of 30° in relation to its initial position

to the top

2.6 - How to move a 3D object?

All the 3D objects are created at position (0,0,0).

To move a 3D object, use the commands : 3d_x_position, 3d_y_position, 3d_z_position

Example:

rem the sphere n1 with radius=2 is created at (0,0,0)
3d_sphere 1,2

rem move it to (5,6,7)
3d_x_position 1,5
3d_y_position 1,6
3d_z_position 1,7

to the top

2.7 - How to use a 3D object created in 3DS format (3D Studio Max)?

rem create a scene3D (3D world)
scene3d 1 : rem 1 is the object number

rem create a 3D object "mesh"
3d_mesh 1 : rem 1 is the 3D object number

rem load your file in the 3D object number 1
3d_load_object 1,"MyObject.3ds"

to the top

2.8 - How to use a 3D object created in MD2 format (Quake)?

rem create a scene3D
scene3d 1 : rem 1 is the Object number

rem create a 3D object "actor"
3d_actor 1 : rem 1 is the 3D object number

rem load your file in the 3D object number 1
3d_load_object 1,"MyObject.md2"

to the top

3 OBJECTS

3.1 - How to color the background of a FORM ?

Use the number N of the FORM in the command color (0 for Base FORM, or N for a FORM created by command form N) :

color N, Red, Green, Blue

to the top

3.2 - It is adviced to pause after coloring a form :

rem color background in white color
color 0,255,255,255 : display

to the top

3.3 - How to color the background of a PICTURE?

A picture has been created by command picture N. Use the number N in the command color:

color N, Red, Green, Blue

to the top

3.4 - How to create a MENU ?

See the following example :

rem create the object "main menu"
main_menu 1

rem create 2 objects "sub menus" at the same level (sons of the object number 1)
sub_menu 2 : caption 2,"File" : parent 2,1
sub_menu 3 : caption 3,"Edit" : parent 3,1

rem create 3 "sub menus" sons of the object number 2
sub_menu 4 : caption 4,"Open" : parent 4,2
sub_menu 5 : caption 5,"Save" : parent 5,2
sub_menu 6 : caption 6,"Quit" : parent 6,2

rem create 3 "sub menus" sons of the object number 3
sub_menu 7 : caption 7,"Copy" : parent 7,3
sub_menu 8 : caption 8,"Paste" : parent 8,3
sub_menu 9 : caption 9,"Undo" : parent 9,3

to the top

3.5 - How to use LEFT, TOP, WIDTH, HEIGHT ?

left and top are used to position an object on its father (the container).

width and height are used to dimension an objectt.

to the top

3.6 - How to place a BUTTON (or another OBJECT) on another FORM than FORM number 0 ?

First possibility :

form 3 : rem create another form (number 3)
button 1 : rem create a BUTTON (number 1)
parent 1,3 : rem the BUTTON goes on its father (the container) : FORM number 3

Second possibility :

form 3 : rem create another form (number 3)
command_target_is 3 : rem all the commands go to object number 3
button 1 : rem create a BUTTON : it goes on FORM number 3

to the top

3.7 - How to place a MENU on another FORM than FORM number 0 ?

form 3 : rem create another form (number 3)
command_target_is 3 : rem all the commands go to object number 3
main_menu 1 : rem create a menu on FORM number 3
caption 1,"Menu" : rem make it visible by giving it a caption

to the top

3.8 - How to use an OPEN_DIALOG to chose a file ?

An open_dialog is created by the command open_dialog N, and is used by the command file_name$(N), N being the number of the open_dialog.

As file_name$ returns either the name of file chosen by the user or the character underscore "_" if no file is chosen, the returned value must be stored in a string variable then compared with "_".

dim a$ : rem declare a string variable

open_dialog 1 : rem create an open_dialog
a$=file_name$(1) : rem choose a name of file with the open_dialog number 1
if a$ <> "_" then - - - : rem if a$ contains a name of file, then - - -

to the top

3.9 - How to save a MEMO in a file using a SAVE_DIALOG ?

A save_dialog is created by the command save_dialog N, and is used by the command file_name$(N), N being the number of the save_dialog.

save_dialog 1 : rem create a save_dialog
memo 2 : rem create a memo

rem to save the content of the memo with the save_dialog
file_save 2,file_name$(1)

to the top

3.10 - How to load a PICTURE with a file, the absolute name of which is in a$ ?

dim a$ : rem declare a string variable

picture 1 : rem create a picture
a$="c:\MyPicture.bmp" : rem define the file name
file_load 1,a$ : rem the file is loaded in the picture

to the top

3.11 - How to load a PICTURE with a file pointed by an OPEN_DIALOG ?

dim a$ : rem declare a string variable

picture 1 : rem create a picture
open_dialog 2 : rem create an open_dialog
a$=file_name$(2) : rem activates the open_dialog number 2
if a$ <> "_" then file_load 1,a$ : rem if a file is chosen, load it in the picture

Recall : the function file_name returns the underline character "_" if no file is chosen by the user. It is why the variable a$ must be compared with "_" : if a$ <> "_"

to the top

3.12 - How to load a MEMO with a file chosen by an OPEN_DIALOG ?

dim a$ : rem declare a string variable

memo 1 : rem create a memo
open_dialog 2 : rem create an open_dialog
a$= file_name$(2) : rem activates the open_dialog number 2
if a$ <> "_" then file_load 1,a$ : rem if a file is chosen, load it in the memo

Recall : the function file_name returns the underline character "_" if no file is chosen by the user. It is why the variable a$ must be compared with "_" : if a$ <> "_"

to the top

3.13 - CAPTION is possible only with BUTTON, OPTION, CHECK, ALPHA or FORM

caption N,"Hello" : rem N must be button, option, check, alpha or form number

This command on another type of object generates an error.

to the top

3.14 - TEXT is possible only with EDIT or COMBO

text N,"Hello" : rem N must be the number of an EDIT or of a COMBO.

This command on another type of object generates an error.

to the top

3.15 - How to use the bars?

There are 3 kinds of bars : track_bar, scroll_bar and progress_bar.

- To read the position of the cursor :

A=position(N) : rem N is the object number of the bar.

- To change the position of cursor :

position N,P : rem P is the position to be taken by the cursor of the bar number N.

When you create the bars, they have standard values for the minimum and the maximum.

- To change the minimum value :

min N,M : rem M is the minimum value, N is the object number of the bar.

- To change the maximum value :

max N,M : rem M is the maximum value, N is the object number of the bar.

to the top

4 MULTIMEDIA : SOUNDS, MUSICS, MOVIES

4.1 - How to load and play a MIDI music file ?

sound 1 : rem create a sound
file_load 1,"file.mid" : rem load a file
play 1 : rem play it

to the top

4.2 - How to load and play a WAV sound file ?

sound 1 : rem create a sound
file_load 1,"file.wav" : rem load a file
play 1 : rem play it

to the top

4.3 - How to load and play a MP3 music file ?

sound 1 : rem create a sound
file_load 1,"file.mp3" : rem load a file
play 1 : rem play it

to the top

4.4 - How to load and play a movie with a file, the absolute name of which is in a$

dim a$ : rem declare a string variable

a$="c:\MyMovie.avi" : rem define the file name
movie 1 : rem create a movie
file_load 1,a$ : rem load the file
play 1 : rem play it

to the top

5 MISC

5.1 - How to use missing mathematic functions ?

Tan(x) = Sin(x) / Cos(x)

-> use SIN(X)/COS(X)

ArcSin(x) = ArcTan(x/sqr(1-sqr(x)))

-> use ATN(X/SQR(1-SQR(X)))

ArcCos(x) = ArcTan(sqr(1-sqr(x))/x)

-> use ATN(SQR(1-SQR(X))/X)

to the top

5.2 - How to use INKEY$ ?

See the following example :

dim a$
label loop

loop:
a$=inkey$
if a$="" then goto loop

rem here, a$ is the pressed key

to the top

5.3 - How to use the subroutines ?

A subroutine is a group of commands which can be processed a certain number of times.

A subroutine begins by a label (which has to be declared by the keywordd LABEL) and ends by RETURN.

When RETURN is executed, the program execution returns to the command immediately after the GOSUB command.

to the top

5.4 - How to use the events ?

When an event (click, change) occurs on an object, you define in a subroutine the commands to be processed to respond to the event.

A subroutine begins by a LABEL and ends by RETURN.

Attention : some events are not possible with some objects !

to the top

Last update : April 25, 2008