tech:notes_gambas
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Prochaine révision | Révision précédente | ||
| tech:notes_gambas [2025/03/24 15:06] – créée - modification externe 127.0.0.1 | tech:notes_gambas [2025/11/19 09:37] (Version actuelle) – Jean-Baptiste | ||
|---|---|---|---|
| Ligne 119: | Ligne 119: | ||
| Exemple | Exemple | ||
| - | <code - hello.gbs> | + | |
| + | '' | ||
| + | <code vb> | ||
| # | # | ||
| 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: | ||
| - | < | + | < |
| PUBLIC foo AS STRING PUBLIC bar AS INTEGER | PUBLIC foo AS STRING PUBLIC bar AS INTEGER | ||
| </ | </ | ||
| + | |||
| 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: | ||
| - | < | + | < |
| DIM rhubarb AS rhubarbstructure | DIM rhubarb AS rhubarbstructure | ||
| </ | </ | ||
| + | |||
| === 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: | ||
| - | < | + | < |
| Dim variablename as type | Dim variablename as type | ||
| </ | </ | ||
| + | |||
| 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: | ||
| - | < | + | < |
| variablename as type | variablename as type | ||
| </ | </ | ||
| Ligne 193: | Ligne 198: | ||
| Les tableaux peuvent avoir plusieurs dimension (60 !?) | Les tableaux peuvent avoir plusieurs dimension (60 !?) | ||
| - | < | + | < |
| Dim Tab(15,5) | Dim Tab(15,5) | ||
| Tab(1,2) = 10 | Tab(1,2) = 10 | ||
| </ | </ | ||
| + | |||
| ==== Création de structure (Struct) | ==== Création de structure (Struct) | ||
| - | < | + | < |
| PUBLIC STRUCT Article | PUBLIC STRUCT Article | ||
| Ref AS STRING | Ref AS STRING | ||
| Ligne 210: | Ligne 216: | ||
| Utilisation | Utilisation | ||
| - | < | + | < |
| 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 '' | Pour accèder à ces variables vous devez utiliser le nom du module ou du formulaire '' | ||
| - | < | + | < |
| MyMainModule.MyGlobalVariable or MyMainForm.MyGlobalVariable | MyMainModule.MyGlobalVariable or MyMainForm.MyGlobalVariable | ||
| </ | </ | ||
| Ligne 241: | Ligne 247: | ||
| Exemple | Exemple | ||
| - | < | + | < |
| Sub Option1_Click () | Sub Option1_Click () | ||
| Dim i | Dim i | ||
| Ligne 258: | Ligne 264: | ||
| Examples | Examples | ||
| - | < | + | < |
| Print "/ | Print "/ | ||
| Print "/ | Print "/ | ||
| </ | </ | ||
| + | |||
| === Les fichiers | === Les fichiers | ||
| Ligne 270: | Ligne 277: | ||
| Ouvrir un fichier | Ouvrir un fichier | ||
| - | < | + | < |
| Dim handle As File | Dim handle As File | ||
| handle = Open " | handle = Open " | ||
| </ | </ | ||
| + | |||
| === Traduction | === Traduction | ||
| Translate | Translate | ||
| - | < | + | < |
| Print (" | Print (" | ||
| Print "But do not translate me!" | Print "But do not translate me!" | ||
| </ | </ | ||
| + | |||
| === Substitution | === Substitution | ||
| Substitution avec Subst | Substitution avec Subst | ||
| - | < | + | < |
| Print Subst((" | Print Subst((" | ||
| </ | </ | ||
| Ligne 301: | Ligne 310: | ||
| Fonction | Fonction | ||
| - | < | + | < |
| 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 | ||
| - | < | + | < |
| Print (Fonc1(2, 3)) | Print (Fonc1(2, 3)) | ||
| </ | </ | ||
| Ligne 340: | Ligne 349: | ||
| * Chiffrer simplement un mot de passe (Vault) ? | * Chiffrer simplement un mot de passe (Vault) ? | ||
| * Créer dynamiquement des " | * Créer dynamiquement des " | ||
| - | ** You can create controls and menu dynamically, | + | |
| * " | * " | ||
| * Faire appel à du code écrit dans un autre langage (mais dans un autre langage compiler tel que Go) peut-être via les IPC, les sockets, via API Rest Microservices | * Faire appel à du code écrit dans un autre langage (mais dans un autre langage compiler tel que Go) peut-être via les IPC, les sockets, via API Rest Microservices | ||
| Ligne 362: | Ligne 371: | ||
| Limitation : | Limitation : | ||
| * La commande **Shell** n'est pas capable de récupérer la STDERR !? | * La commande **Shell** n'est pas capable de récupérer la STDERR !? | ||
| - | ** Voir les instructions SHELL, EXEC et la class Process | + | |
| * Ils n'y a pas d' | * Ils n'y a pas d' | ||
tech/notes_gambas.1742825205.txt.gz · Dernière modification : de 127.0.0.1
