tech:notes_gambas

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
tech:notes_gambas [2025/04/26 11:10] Jean-Baptistetech:notes_gambas [2025/11/19 09:37] (Version actuelle) Jean-Baptiste
Ligne 119: Ligne 119:
  
 Exemple Exemple
-<code - hello.gbs>+ 
 +''hello.gbs'' 
 +<code vb>
 #!/usr/bin/env gbs3 #!/usr/bin/env gbs3
 Public Sub Main() Public Sub Main()
Ligne 158: Ligne 160:
  
 From the Integrated Development Environment file, create a class file rhubarbstructure.class as follows:  From the Integrated Development Environment file, create a class file rhubarbstructure.class as follows: 
-<code ->+<code vb>
 PUBLIC foo AS STRING PUBLIC bar AS INTEGER  PUBLIC foo AS STRING PUBLIC bar AS INTEGER 
 </code> </code>
 +
 It is now possible to define a variable utilizing that class, by creating an appropriate definition in the code module as follows:  It is now possible to define a variable utilizing that class, by creating an appropriate definition in the code module as follows: 
-<code ->+<code vb>
 DIM rhubarb AS rhubarbstructure DIM rhubarb AS rhubarbstructure
 </code> </code>
 +
  
 === Les variables === Les variables
Ligne 175: Ligne 179:
  
 In Gambas it is necessary to declare every variable. To dimension a variable, the code is: In Gambas it is necessary to declare every variable. To dimension a variable, the code is:
-<code ->+<code vb>
 Dim variablename as type Dim variablename as type
 </code> </code>
 +
 You can just skip the word Dim , so the following is also correct: You can just skip the word Dim , so the following is also correct:
-<code ->+<code vb>
 variablename as type variablename as type
 </code> </code>
Ligne 193: Ligne 198:
 Les tableaux peuvent avoir plusieurs dimension (60 !?) Les tableaux peuvent avoir plusieurs dimension (60 !?)
  
-<code ->+<code vb>
 Dim Tab(15,5) Dim Tab(15,5)
 Tab(1,2) = 10 Tab(1,2) = 10
 </code> </code>
 +
  
 ==== Création de structure (Struct) ==== Création de structure (Struct)
  
-<code ->+<code vb>
 PUBLIC STRUCT Article PUBLIC STRUCT Article
   Ref AS STRING   Ref AS STRING
Ligne 210: Ligne 216:
  
 Utilisation Utilisation
-<code ->+<code vb>
 Dim ArticleAchete As Article Dim ArticleAchete As Article
 Dim ArticleVendu As Article Dim ArticleVendu As Article
Ligne 230: Ligne 236:
  
 Pour accèder à ces variables vous devez utiliser le nom du module ou du formulaire ''Main''. Pour accèder à ces variables vous devez utiliser le nom du module ou du formulaire ''Main''.
-<code ->+<code vb>
 MyMainModule.MyGlobalVariable or MyMainForm.MyGlobalVariable MyMainModule.MyGlobalVariable or MyMainForm.MyGlobalVariable
 </code> </code>
Ligne 241: Ligne 247:
  
 Exemple Exemple
-<code ->+<code vb>
 Sub Option1_Click () Sub Option1_Click ()
   Dim i   Dim i
Ligne 258: Ligne 264:
  
 Examples Examples
-<code ->+<code vb>
 Print "/home/gambas" &/ ".bashrc" Print "/home/gambas" &/ ".bashrc"
 Print "/home/gambas" &/ "/tmp" &/ "foo.bar" Print "/home/gambas" &/ "/tmp" &/ "foo.bar"
 </code> </code>
 +
  
 === Les fichiers === Les fichiers
Ligne 270: Ligne 277:
  
 Ouvrir un fichier Ouvrir un fichier
-<code ->+<code vb>
 Dim handle As File Dim handle As File
 handle = Open "myfile" For Read handle = Open "myfile" For Read
 </code> </code>
 +
  
 === Traduction === Traduction
  
 Translate Translate
-<code ->+<code vb>
 Print ("Tranlate me") Print ("Tranlate me")
 Print "But do not translate me!" Print "But do not translate me!"
 </code> </code>
 +
  
 === Substitution === Substitution
  
 Substitution avec Subst Substitution avec Subst
-<code ->+<code vb>
 Print Subst(("Substitution of &1, &2 and &3"), "first", "second", "third") Print Subst(("Substitution of &1, &2 and &3"), "first", "second", "third")
 </code> </code>
Ligne 301: Ligne 310:
  
 Fonction Fonction
-<code ->+<code vb>
 Function Fonc1(Param1 As Float, Param2 As Float) As Float Function Fonc1(Param1 As Float, Param2 As Float) As Float
   Dim Ret As Float   Dim Ret As Float
Ligne 310: Ligne 319:
  
 Appel de la fonction Appel de la fonction
-<code ->+<code vb>
 Print (Fonc1(2, 3)) Print (Fonc1(2, 3))
 </code> </code>
tech/notes_gambas.1745658658.txt.gz · Dernière modification : de Jean-Baptiste

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki