Listin Gambas2
Création d'un programme en Gambas2 : un répertoire téléphonique pas à pas
Origine : http://listingambas.blogspot.com/2011/06/modulo-var-declarar-variables.htmlModule VAR: Déclarer les variables
Nos données sont les variables suivantes:
Données |
Nom de la variable |
Déclaration |
Id |
id () |
PUBLIC id AS NEW String[] |
n°SS |
dni () |
PUBLIC Dni
AS new String [] |
Nom |
nom () |
PUBLIC nom AS NEW String[] |
Prénom |
Prenom () |
PUBLIC prenom AS NEW String[] |
Entreprise |
Entreprise () |
PUBLIC entreprise AS NEW String [] |
Poste |
Poste () |
PUBLIC poste AS NEW String [] |
Téléphone société | tel_entreprise () |
PUBLIC tel_entreprise AS NEW String [] |
Téléphone personnel | tel_perso () |
PUBLIC tel_perso AS NEW String [] |
Fax |
Fax () |
PUBLIC Fax AS NEW
String [] |
Mobile Entreprise
|
Mobile_entreprise
() |
PUBLIC Mobile_entreprise
AS NEW String [] |
Mobile personnel |
Mobile_perso
() |
PUBLIC Mobile_perso
AS NEW String [] |
Page Web |
page () |
PUBLIC page AS NEW
String [] |
photo |
photo () |
PUBLIC photo AS NEW
String [] |
Adresse |
adresse () |
PUBLIC adresse AS NEW
String [] |
Commentaires | commentaires () |
PUBLIC commentaires
AS NEW String [] |
Date de données |
date_donees () |
PUBLIC date_donees
AS NEW String [] |
Adresse courriel |
Mail () | PUBLIC Mail AS NEW String [] |
Note: Les
données seront des chaînes de caractères (string)
et des tableaux (ou matrices), d'où le mot clé “NEW” et les crochets “[]”
|
Ensuite, nous allons créer
dans ce module, une subroutine qui initialise les variables
(ceci est fait chaque fois qu'on lance le programme Listin, ou chaque fois que nous chargeons un fichier de données).
(ceci est fait chaque fois qu'on lance le programme Listin, ou chaque fois que nous chargeons un fichier de données).
Cela donne : Module VAR
' Gambas
module file
PUBLIC id AS NEW String[]
PUBLIC dni AS NEW String[]
PUBLIC nom AS NEW String[]
PUBLIC prenoms AS NEW String[]
PUBLIC entreprise AS NEW String[]
PUBLIC poste AS NEW String[]
PUBLIC
tel_entreprise AS NEW String[]
PUBLIC telf_parti AS NEW String[]
PUBLIC fax AS NEW String[]
PUBLIC
mobile_entreprise AS NEW String[]
PUBLIC mobile_parti
AS NEW String[]
PUBLIC page AS NEW String[]
PUBLIC Photo AS NEW String[]
PUBLIC adresse AS NEW String[]
PUBLIC commentaires AS NEW String[]
PUBLIC
date_donees AS NEW String[]
PUBLIC mail AS NEW String[]
PUBLIC SUB initialise()
var.id.Resize(0)
var.dni.Resize(0)
var.nom.Resize(0)
var.prenoms.Resize(0)
var.entreprise.Resize(0)
var.poste.Resize(0)
var.tel_entreprise.Resize(0)
var.tel_persoi.Resize(0)
var.fax.Resize(0)
var.mobile_entreprise.Resize(0)
var.mobile_parti.Resize(0)
var.page.Resize(0)
var.photo.Resize(0)
var.adresse.Resize(0)
var.commentaires.Resize(0)
var.date_donnees.Resize(0)
var.mail.Resize(0)
END
PUBLIC SUB
Form_Open()
var.initialise()
END