


|
Technical
pages
Graphic programming interface
Version 1.7 of April 25,
2010
Written by jpb.forth
Windows server instructions
Dialogue boxes instructions
Use
Example
Principle
The goal of this
page is to describe the instructions allowing to create a graphic
application as the following window:

This description
is distributed in several chapters:
Windows server instructions
In the following
instructions:
- "fen" is an integer which, if it is positive
and not null, is corresponding to a window descriptor,
- "adr_prgm" is the pointer to a program called
by the
windows server. This program can have or not specific parameters bu
the last one is the window descriptor, not any parameter must be
returned, example:
...,fen FEN_PRGM -
The
instruction
"FEN:" must be used to create this program which is finished by ";" as
another FORTH instruction. In running mode, the pointer to the
execution area "adr_prgm" is posted on the data stack.
- FEN: NOM -
Creation
of a program "NOM" which can be called by the windows server.
This program is called as following: data1,...datan,fen --> -.
The number of datas, which can be 0, depends of the kind of program.
When
this instruction is used, it return a pointer "adr_prgm".
- FEN_CREE fen
Creation
of the parameter area of a new window.
This action is aborted if "fen"=0.
fen1,fen2 FEN_FILLE -
The window "fen1" is declared as the daughter of
the window "fen2".
fen FEN_DETRUIT
-
Destruction of the window "fen".
This action is aborted if "fen" have a daughter window.
adr_chaîne,fen FEN_NOM -
Initialization of the name (character string
pointed by "adr_chaîne") of the window "fen".
The name is displayed in the border of the window.
x,y,fen FEN_POSITION -
Initialization of the absolute position
(coordinates "x,y" left top) of the window "fen".
dx,dy,fen FEN_TAILLE -
Initialization of the user size (values "dx,dy"
without border) of the window "fen".
adr,fen FEN_PARAMETRES -
Initialization of the user parameters area address
of the window "fen".
This is an option.
dxmin,dymin,dxmax,dymax,fen FEN_DIMENSIONS -
Initialization of the minimum/maximum user size
(values "dxmin,dymin,dxmax,dymax") of the window "fen".
The symbol
is displayed in the border of the window.
This is an option.
fen FEN_ACTIVE -
First displaying of the window "fen" when all the
initializations are made.
fen FEN_SELECTIONNE -
Software selection of the window "fen" which is so
displayed as the top window.
adr_prgm,fen FEN_FERME -
Initialization of the program pointer "adr_prgm"
to close the window "fen".
The symbol
is displayed in the border of the window.
The program is called by the windows server as following: fen
--> -
This is an option.
adr_prgm,fen FEN_MENU -
Initialization of the program pointer "adr_prgm"
to display menu to the window "fen".
The symbol is
displayed in the border of the window.
The program is called by the windows
server as following: fen --> -
This is an option.
adr_prgm,fen FEN_A_PROPOS -
Initialization of the program pointer "adr_prgm"
to display a help to the window "fen".
The symbol is
displayed in the border of the window.
The program is called by the windows
server as following: fen --> -
This is an option.
adr_prgm,fen FEN_AFFICHE -
Initialization of the program pointer "adr_prgm"
to display the content of the window "fen".
The program is called by the windows
server as following: fen --> -
dx,dy,fen FEN_MOSAIQUE -
Initialization of the mosaic displaying mode of
the window "fen".
In this mode, the content of the window is displayed sequentialy by
little areas "dx,dy".
If "dx" ("dy") is positive, the mosaic displaying starts from
the left (top) size.
If "dx" ("dy") is negative,
the mosaic displaying starts from the right (bottom) size.
This instruction allows to optimize the
refresh time in case of a complex window.
This is an option.
adr_prgm,fen FEN_SORT -
Initialization of the program pointer "adr_prgm"
to quit the window "fen".
This program can be a specific displaying for the window "fen" when
another window is selected.
The program is called by the windows server as following: fen
--> -
This is an option.
t,adr_prgm1,adr_prgm2,fen FEN_CHRONO -
Initialization of a temporized displaying in order
to make an animation of the content of the window "fen".
"t" is the duration in millisecond before the displaying program
pointer "adr_prgm1" execution.
"adr_prgm2" is the task program pointer called by the windows server a
the end of the displaying.
The program is called by the windows
server as following: fen --> -
This is an option.
adr_prgm,fen FEN_ICONE -
Initialization of the displaying program pointer
"adr_prgm" in case of reduction of the window "fen" to an icon.
The program is called by the windows
server as following: fen --> -
This is an
option.
adr_prgm,fen FEN_CLAVIER -
Initialization of the program pointer "adr_prgm"
to manage the keyboard characters in the window "fen".
The program is called by the windows
server as following: car, fen --> -
"car" is the code of the character of the keyboard.
This is an
option.
adr_prgm,fen FEN_SOURIS -
Initialization
of the program pointer "adr_prgm" to manage the mouse in the window
"fen".
The program
is called by the windows server as following: x,y,bg,bd, fen -->
-
"x,y" are
the coordinates of the mouse pointer,
"bg,bd" are
the state of the left and right buttons of the mouse.
This is an
option.
adr_motif,fen FEN_MOTIF_SOURIS -
Initialization
of mouse shape pointer "adr_motif" (symbol matrix 2x16x16) in the
window "fen".
This is an
option.
fen FEN_DEVANT_? b
"b" is no
null if the window "fen" is selected.
teinte,x1,y1,x2,y2,fen FEN_TRACE_REC -
Rectangle
drawing:
teinte: tin
of the pixel or video inversion if > 255,
x1 , y1 ,
x2, y2: relative corners coordinates in the window "fen".
dx,dy,teinte,x,y,adr_motif,fen FEN_TRACE_MOTIF dx,dy,teinte,x,y
Symbol
drawing:
dx,dy: width
and height of the symbol in number of pixels (dx <=
16),
teinte: tin
of the pixel,
x,y:
relative coordinates from the left superior corner of the symbol
in the window "fen",
adr_motif :
address of the symbol matrix.
teinte,gen_car,x0,y0,adr,nbc,fen FEN_TRACE_CHAINE teinte,gen_car,x0,y0,adr
Character
string drawing:
teint: tin
of the pixel,
gen_car:
character matrix generator address,
x0,y0:
relative coordinates from the left superior corner of the firs
character in the window "fen",
adr:
character string address,
nbc:
character number.
image,x0,y0,fen FEN_ECRIT_REC -
Writing of a
rectangular picture:
image:
pointer on the picture contents
dx on 2 bytes
dy on 2 bytes
teinte1 on 1
byte
...
teinteN on
1 byte with N = dx*dy,
x0,y0:
relative coordinates from the left superior corner in
the window "fen".
teinte,x1,y1,x2,y2,fen FEN_TRACE_LIGNE -
Line drawing:
teinte: tin
of the pixel,
x1 , y1 ,
x2, y2: relative end points coordinates in the window "fen".
dx,dy,teinte,x,y,adr_motif,fen FEN_TRACE_MOTIF_RELIEF dx,dy,teinte,x,y
Symbol drawing
with 3D effect (same parameters as "FEN_TRACE_MOTIF").
teinte,gen_car,x0,y0,adr,nbc,fen FEN_TRACE_CHAINE_RELIEF teinte,gen_car,x0,y0,adr
Character
string drawing with 3D effect (same parameters as "FEN_TRACE_CHAINE").
teinte,actif,x0,y0,dx,dy,position,taille,total,fen
FEN_TRACE_POTAR -
Drawing of an
horizontal (dx>=dy) or vertical (dx<dy) rectilinear
potentiomter:
teinte: tin
of the bottom,
actif:
indicates in not null that the window "fen" is selected,
x0,y0:
relative corners coordinates in the window "fen",
dx,dy: width
and height of the potentiometer,
Position:
position of the cursor (0 to total),
taille: size
of the cursor (0 to total),
total: width
or height of the potentiometer.
- FEN_STRING" S_NOM chaîne
en français"
chaîne en anglais" -
Creation of
a
double character string "S_NOM".
When the
windows server is set in french language, the string
"chaîne en français" is displayed.
Else, the
string "chaîne en anglais" is displayed.
- FEN_TEINTES_? c_fond,c_fond_2,c_select,c_select_2,c_car,mode
Colours (8 bits) of the windows:
c_fond,c_fond2: background colours,
c_select,c_select_2: selection colours,
c_car: character colour,
mode: degraded mode.
- FEN_LANGUE_? b
Windows language, b is not equal
to 0 if english.
fen FEN_POSITION_? x,y
"x,y" are
the absolute coordinates (left top) of the window "fen".
fen FEN_TAILLE_? dx,dy
"dx,dy" are
the width and the
height of the window "fen".
fen FEN_PARAMETRES_? adr
"adr" is the user parameters area address of the
window "fen" initialized with "FEN_PARAMETRES".
fen FEN_NOM_? adr_chaîne
Name (character string
pointed by "adr_chaîne") of the
window "fen".
adr_chaîne FEN_NUMERO_? fen
Window "fen" corresponding to the name (character string
pointed by "adr_chaîne").
image,x1,y1,x2,y2,fen FEN_TAPISSE_REC -
Filling with a
rectangular picture:
image:
pointer on the picture contents
dx on 2 bytes
dy on 2 bytes
teinte1 on 1
byte
...
teinteN on
1 byte with N = dx*dy,
x1 , y1 ,
x2, y2: relative corners coordinates in the window "fen".
figure,x0,y0,y2,fen FEN_ECRIT_FIG -
Writing of a not regular figure:
figure:
pointer on the figure contents
picture address of color if less than 256 on 4 bytes
dx on 2 bytes
dy on 2 bytes
x1(y0),x2(y0) on 4 bytes
...
x1(yN),x2(yN) on 4 bytes with N = dy,
x0,y0:
relative coordinates from the left superior corner in
the window "fen".
Dialogue
boxes instructions
In the following
instructions:
- if adr_s is equal to 0, not any text is
printing at the top of the window,
- if fen is equal to 0, the dialogue boxe is
managed as a main window.
adr_s,fen FEN_DIALOGUE_MESSAGE -

Message displaying dialogue box:
adr_s: message character string address,
fen:
descriptor of the parent window.
adr_%,adr_prgm,adr_s,fen FEN_DIALOGUE_PROGRESSE -

Application running dialogue box
with execution percentage displaying:
adr_%: address of an integer 0 to 100 updated by the application,
adr_prgm: address of the application,
adr_s:
commen
character string address,
fen:
descriptor of the parent window.
adr_prgm,adr_s,fen FEN_DIALOGUE_EXECUTE -

Application running dialogue box:
adr_prgm: address of the application,
adr_s:
commen
character string address,
fen:
descriptor of the parent window.
b,adr_s,fen FEN_DIALOGUE_OUI/NON b'

Simple question dialogue box:
b: initial answer (0 for no, <>0 for yes),
adr_s:
question
character string address,
fen:
descriptor of the parent window,
b': final answer.
n,adr_s_choix,adr_s,fen FEN_DIALOGUE_CHOIX n'

Menu dialogue box:
n: initial choice (1 for the top),
adr_s_choix: menu character string address,
adr_s:
commen
character string address,
fen:
descriptor of the parent window,
n': final choice (0 if cancelled).
n,base,adr_s,fen FEN_DIALOGUE_NOMBRE n'

Integer input dialogue box:
n: initial integer,
base: coding base,
adr_s:
commen
character string address,
fen:
descriptor of the parent window,
n: final integer.
adr_s_texte,nbc_max,adr_s,fen FEN_DIALOGUE_TEXTE nbc

Text input dialogue box:
adr_s_text: initial text character string address,
nbc_max: maximum character number of the text,
adr_s:
commen
character string address,
fen:
descriptor of the parent window,
nbc: final text character number (-1 if the action is cancelled).
f,adr_s,fen FEN_DIALOGUE_FLOTTANT f'

Float number input dialogue box:
f: initial float number (64 bits),
adr_s:
commen
character string address,
fen:
descriptor of the parent window,
f': final float number.
adr_chemin/nom,lec/ecr,adr_s,fen FEN_DIALOGUE_FICHIER adr_chemin/nom'

File selection dialogue box:
adr_chemin/nom: initial file location character string,
lec/ecr: read or write file access (0 for write),
adr_s:
commen
character string address,
fen:
descriptor of the parent window,
adr_chemin/nom':
final file location character string (-1 if the action is cancelled).
c,adr_s,fen FEN_DIALOGUE_PALETTE c'

Palette
color selection dialogue box:
c: initial color (8 bits),
adr_s:
commen
character string address,
fen:
descriptor of the parent window,
c': final color
(-1 if the action is cancelled).
r,v,b,adr_s,fen FEN_DIALOGUE_RVB r',v',b',n

Red green
blue color selection dialogue box:
r,v,b: initial color (3x8 bits),
adr_s:
commen
character string address,
fen:
descriptor of the parent window,
r',v',b': final color,
n: <>0 if the action is cancelled.
Use
The following table contains 9 sample programs
of windows classified from simplest to most complex:
(click on the chosen window to have the corresponding source code of it)

Simple window 1 |

Window 1 + about |

Window 2 + sizes |

Window 3 + display |

Window 4 + menu |

Window 5 + keyboard |

Window 6 + icon |

Window 7 + mouse |

Window 8 + animation |
The code added and/or modified in the program of the following window
is preceded by (++++) and followed by ( ---- ).
Example
Here is a video able to give you an idea of
the graphic programming interface possibilities:
(this video
has been realized with the software Jing)
|
|
 |